amprolla

devuan's apt repo merger
git clone git://parazyd.org/amprolla.git
Log | Files | Refs | README | LICENSE

commit 8ca483989a4f8b86153c12c576d7683bc3004325
parent 0b16e6b79ff7319b967c445bc459a84d4757df3a
Author: parazyd <parazyd@dyne.org>
Date:   Thu,  6 Jul 2017 17:43:16 +0200

refactor merge() to be able to merge any number of repos properly

Diffstat:
Mamprolla_merge.py | 52++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/amprolla_merge.py b/amprolla_merge.py @@ -75,34 +75,34 @@ def merge(packages_list): all_repos = [] print('Loading packages: %s' % packages_list) - devuan = load_packages_file(packages_list[0]) - if devuan: - all_repos.append({'name': 'devuan', 'packages': devuan}) - - debian_sec = load_packages_file(packages_list[1]) - if debian_sec: - all_repos.append({'name': 'debian-security', 'packages': debian_sec}) - - debian = load_packages_file(packages_list[2]) - if debian: - all_repos.append({'name': 'debian', 'packages': debian}) - - if basename(packages_list[0]) == 'Packages.gz': - print('Merging packages') - src = False - new_pkgs = merge_packages_many(all_repos, banned_packages=banpkgs, - rewriter=devuan_rewrite) - elif basename(packages_list[0]) == 'Sources.gz': - print('Merging sources') - src = True - new_pkgs = merge_packages_many(all_repos, rewriter=devuan_rewrite) + for i in range(len(repo_order)): + pkgs = load_packages_file(packages_list[i]) + if pkgs: + all_repos.append({'name': repo_order[i], 'packages': pkgs}) + + for i in range(len(repo_order)): + if packages_list[i]: + if basename(packages_list[i]) == 'Packages.gz': + print('Merging packages') + src = False + new_pkgs = merge_packages_many(all_repos, + banned_packages=banpkgs, + rewriter=devuan_rewrite) + elif basename(packages_list[i]) == 'Sources.gz': + print('Merging sources') + src = True + new_pkgs = merge_packages_many(all_repos, + rewriter=devuan_rewrite) + break print('Writing packages') - # replace the devuan subdir with our mergedir that we plan to fill - # FIXME: do not assume Devuan always exists - new_out = packages_list[0].replace(join(spooldir, - repos['devuan']['dists']), - join(mergedir, mergesubdir)) + for i in range(len(repo_order)): + if packages_list[i]: + new_out = packages_list[i].replace(join(spooldir, + repos[repo_order[i]]['dists']), + join(mergedir, mergesubdir)) + break + if src: write_packages(new_pkgs, new_out, sources=True) else: