timplement proper logging of obsolete packages - amprolla - devuan's apt repo merger HTML git clone git://parazyd.org/amprolla.git DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 49c69630e07a897c57d9cc5eeafe315bf88b75ee DIR parent 78478d1f634efb94105a68997428ab7ea840c2d0 HTML Author: parazyd <parazyd@dyne.org> Date: Mon, 6 Nov 2017 13:03:39 +0100 implement proper logging of obsolete packages This commit now logs the obsolete packages to per-suite files, writing only once, after the merge of the suite is done. Diffstat: M lib/package.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- DIR diff --git a/lib/package.py b/lib/package.py t@@ -127,6 +127,7 @@ def merge_packages(pkg1, pkg2, name1, name2, banned_packages=set(), """ new_pkgs = {} package_names = set(pkg1.keys()).union(set(pkg2.keys())) + obsoletepkgs = [] for pkg in package_names: pkg1_pkg = pkg1.get(pkg) t@@ -137,12 +138,10 @@ def merge_packages(pkg1, pkg2, name1, name2, banned_packages=set(), pkg1_pkg = rewriter(pkg1_pkg, name1) new_pkgs[pkg] = pkg1_pkg if package_newer(pkg1_pkg, pkg2_pkg): - logtofile('%s-oldpackages.txt' % globalvars.suite, - '%s,%s,%s,%s\n' % (globalvars.suite, - pkg1_pkg.get('Package'), - pkg1_pkg.get('Version'), - pkg2_pkg.get('Version')), - redo=True) + obsoletepkgs.append('%s,%s,%s,%s' % (globalvars.suite, + pkg1_pkg.get('Package'), + pkg1_pkg.get('Version'), + pkg2_pkg.get('Version'))) elif pkg1_pkg: if not package_banned(pkg1_pkg, banned_packages): if rewriter: t@@ -156,6 +155,11 @@ def merge_packages(pkg1, pkg2, name1, name2, banned_packages=set(), else: assert False, 'Impossibru' + if obsoletepkgs: + obsoletepkgs = '\n'.join(obsoletepkgs) + logtofile('%s-oldpackages.txt' % globalvars.suite, obsoletepkgs, + redo=True) + return new_pkgs