commit:     e3e72ec761ab556f62b272a226b48726dab5cfde
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 21 02:54:25 2017 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 02:54:25 2017 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-bumpchecker.git/commit/?id=e3e72ec7

gnome: Hack latest version to see newstable release when official version is 
still at release candidate

When running against e.g 3.23.92 release before a 3.24.0 versions file from 
gnome releng
exists to run against, we want to still see the 3.24.0 releases, should any 
exist. So hack
the logic to look into latest newstable version, if any exist, and the version 
is not a 0.x
(for which the gnome numbering might not follow odd-even nomenclature).
Without this all the 3.24.0 releases that are coming out on "tarballs due" date 
and the
preceeding weekend aren't seen by bumpchecker, as we don't have a 3.24.0 to -r 
<ver> against.

 modules/gnome_module.py   | 5 ++++-
 modules/package_module.py | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/gnome_module.py b/modules/gnome_module.py
index 38639ee..a9fd306 100644
--- a/modules/gnome_module.py
+++ b/modules/gnome_module.py
@@ -96,9 +96,12 @@ class GNOME:
             if pkg.major_minor not in data[3]:
                 print("Warning: can't find latest version for %s-%s" % (name, 
pkg.major-minor))
                 continue
+            major_minor = pkg.major_minor
+            if pkg.major != "0" and pkg.minor.isdigit() and int(pkg.minor) % 2 
and "%s.%d" % (pkg.major, int(pkg.minor)+1) in data[3]:
+                major_minor = "%s.%d" % (pkg.major, int(pkg.minor)+1)
             latest = False
             # Some modules contain more than LATEST-IS-* for some reason, so 
we need to iterate and find the correct item instead of [0] (even though it is 
firsy always, but lets be future-proof)
-            for tarball in data[3][pkg.major_minor]:
+            for tarball in data[3][major_minor]:
                 if tarball.startswith('LATEST-IS-'):
                     latest = tarball[10:] # len('LATEST-IS-') == 10
                     break

diff --git a/modules/package_module.py b/modules/package_module.py
index 30f79a2..e967973 100644
--- a/modules/package_module.py
+++ b/modules/package_module.py
@@ -82,6 +82,14 @@ class Package(object):
     def parse_mm(self, version):
         return '.'.join(version.split('.')[0:2])
 
+    @property
+    def major(self):
+        return self.major_minor.split('.')[0]
+
+    @property
+    def minor(self):
+        return self.major_minor.split('.')[1]
+
     def print_info(self):
         print("Name: " + str(self.name))
         print("Version: " + str(self.package_version))

Reply via email to