tHandle packages with "~" in version in package_newer() - amprolla - devuan's apt repo merger
git clone git://parazyd.org/amprolla.git
Log
Files
Refs
README
LICENSE
---
commit acdff2408cb6a5fc0bdbbdb89b68ee46bc75f55d
parent e8d7a7be178d435ff59f32ae1729a601cb4ccb9f
Author: parazyd 
Date:   Sun, 17 Dec 2017 01:41:58 +0100

Handle packages with "~" in version in package_newer()

This commit also implements a hardcoded list of packages we don't
want to version-check.

Diffstat:
  M lib/package.py                      |       9 +++++++++

1 file changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/lib/package.py b/lib/package.py
t@@ -111,6 +111,11 @@ def package_newer(pkg1, pkg2):
 
     Ref: https://www.debian.org/doc/debian-policy/#version
     """
+    # Hardcoded list of packages we don't want to check
+    _skips = []
+    if pkg1.get('Package') in _skips:
+        return False
+
     # The choice of dropping [1:] is because we don't care for +deb or +devuan
     hi_prio = pkg1.get('Version').split('+')[0]
     lo_prio = pkg2.get('Version').split('+')[0]
t@@ -136,6 +141,10 @@ def package_newer(pkg1, pkg2):
     if len(hi_prio) > 1 and len(lo_prio) > 1:
         hi_prio[1] = hi_prio[1].replace('.', '')
         lo_prio[1] = lo_prio[1].replace('.', '')
+        if '~' in hi_prio[1]:
+            hi_prio[1] = hi_prio[1].split('~')[0]
+        if '~' in lo_prio[1]:
+            lo_prio[1] = lo_prio[1].split('~')[0]
         if int(lo_prio[1]) > int(hi_prio[1]):
             return True