[sysadmin-bin: 1/2] Update version check for ftpadmin




commit afe60e920fcb29bf24be80f857cb9d6ca8f6e47f
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Sep 16 18:20:28 2020 +0100

    Update version check for ftpadmin
    
    Starting from the September 2020 development cycle, GNOME will change
    its versioning scheme to this:
    
    https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235/
    
    The new scheme has only a major and a minor component; stable releases
    have the minor component monotonically increase starting from 0, while
    development releases will be one of "alpha", "beta", or "rc".
    
    The current version comparison check inside ftpadmin can cope with
    non-numeric components, but it does not sort them correctly: we want
    "alpha", "beta", and "rc" to always sort earlier than numeric
    components.

 ftpadmin | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/ftpadmin b/ftpadmin
index e9fc2a9..1a39075 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -102,6 +102,12 @@ def version_cmp(a, b):
             c = cmp(a, b) if (a.startswith('0') or b.startswith('0')) else cmp(int(a, 10), int(b, 10))
             if c:
                 return c
+        elif a.isalpha() and b.isdigit():
+            if a == 'alpha' or a == 'beta' or a == 'rc':
+                return -1
+        elif a.isdigit() and b.isalpha():
+            if b == 'alpha' or b == 'beta' or b == 'rc':
+                return 1
         else:
             c = cmp(a.upper(), b.upper())
             if c:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]