tFixups to the version compare algorithm. - 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 a688b275e622eb666ff4f4129047e4b1b2a99194 DIR parent ad0266535fd140ce675448424718ee607fffd092 HTML Author: KatolaZ <katolaz@freaknet.org> Date: Tue, 19 Dec 2017 02:08:15 +0100 Fixups to the version compare algorithm. Diffstat: M lib/package.py | 4 ++-- M lib/parse.py | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) --- DIR diff --git a/lib/package.py b/lib/package.py t@@ -116,7 +116,7 @@ def package_newer(pkg1, pkg2): if pkg1.get('Package') in _skips: return False - if cmppkgver(pkg1.get('Version'), pkg2.get('Version')) < 1: + if cmppkgver(pkg1.get('Version'), pkg2.get('Version')) < 0: return True return False t@@ -162,7 +162,7 @@ def merge_packages(pkg1, pkg2, name1, name2, banned_packages=set(), if obsoletepkgs: obsoletepkgs = '\n'.join(obsoletepkgs) + '\n' logtofile('%s-oldpackages.txt' % globalvars.suite, obsoletepkgs, - redo=True) + redo=False) return new_pkgs DIR diff --git a/lib/parse.py b/lib/parse.py t@@ -6,8 +6,6 @@ Parsing functions/helpers from time import mktime, strptime -from lib.log import info - def get_time(date): """ t@@ -259,6 +257,9 @@ def compare_non_epoch(s1, s2): alpha1, tail1 = get_non_digit(s1) alpha2, tail2 = get_non_digit(s2) if alpha1 == alpha2: + if not tail1 and not tail2: + diff = 0 + break num1, s1 = get_digit(tail1) num2, s2 = get_digit(tail2) if num1 == num2: t@@ -291,20 +292,14 @@ def cmppkgver(ver1, ver2): ec = compare_epochs(epoch1, epoch2) if ec != 0: # The two versions differ on epoch - info('differing epochs: %d\n' % ec) return ec - else: - info('equal epochs') upst1, rev1 = get_upstream(rest1) upst2, rev2 = get_upstream(rest2) - info('v1: up: %s deb: %s' % (upst1, rev1)) - info('v2: up: %s deb: %s' % (upst2, rev2)) - - up_diff = compare_deb_str(upst1, upst2) + up_diff = compare_non_epoch(upst1, upst2) if up_diff == 0: - return compare_deb_str(rev1, rev2) + return compare_non_epoch(rev1, rev2) return up_diff