commit a9c75db0eb4ef83bb40b00e3685181bd6841102d
parent 9d912834790c8c7407ff49f164d80166dd1f05a2
Author: parazyd <parazyd@dyne.org>
Date: Mon, 29 May 2017 18:02:11 +0200
write new packages to their proper place
Diffstat:
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/amprolla-merge b/amprolla-merge
@@ -9,7 +9,7 @@ from time import time
from lib.package import (write_packages, load_packages_file,
merge_packages_many)
from lib.config import (aliases, banpkgs, repo_order, repos,
- spooldir, suites)
+ spooldir, suites , mergedir, mergesubdir)
def prepare_merge_dict():
@@ -18,7 +18,7 @@ def prepare_merge_dict():
that need to be merged in an ordered fashion. Orders them using the
repo_order list found in lib.config
Example output:
- { ascii: ['ascii', None, 'stretch'] },
+ {'ascii': ['ascii', None, 'stretch']},
"""
merge_dict = {}
@@ -79,7 +79,11 @@ def merge(packages_list):
new_pkgs = merge_packages_many(all_repos, banned_packages=banpkgs, rewriter=devuan_rewrite)
print('Writing packages')
- write_packages(new_pkgs, 'Packages.merged')
+ # replace the devuan subdir with our mergedir that we plan to fill
+ new_out = packages_list[0].replace(join(spooldir,
+ repos['devuan']['dists']),
+ join(mergedir, mergesubdir))
+ write_packages(new_pkgs, new_out)
t2 = time()
print('time:', t2-t1)
diff --git a/lib/config.py b/lib/config.py
@@ -5,7 +5,7 @@
spooldir = './spool'
sign_key = 'fa1b0274'
mergedir = './merged'
-mergedsubdirs = ['dists', 'pool']
+mergesubdir = 'dists'
banpkgs = {'systemd', 'systemd-sysv'}
# checksums = [ 'md5sum', 'sha1', 'sha256', 'sha512' ]
diff --git a/lib/package.py b/lib/package.py
@@ -1,3 +1,4 @@
+import os
from gzip import open as gzip_open
from lib.parse import (parse_packages, parse_dependencies)
@@ -9,6 +10,7 @@ def write_packages(packages, filename, sort=True):
Writes `packages` to a file (per debian Packages format)
If sort=True, the packages are sorted by name.
"""
+ os.makedirs(os.path.dirname(filename), exist_ok=True)
f = open(filename, 'w+')
pkg_items = packages.items()