Skip to contentSkip to conversation

backports: fix coccinelle version check

PATCH New Eliad Peller 1 participant 1 message Apr 27, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: fix coccinelle version check

bpreqs.py assumes the max rc level is 20. However, backports currently requires coccinelle 1.0.0-rc24 (which is the latest rc before 1.0.0).

This resulted in 1.0.0-rc24 getting higher weight than 1.0.0, which failed the dependency check.

Fix it by increasing the max rc to 25 (and use a constant for it)

---
 lib/bpreqs.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/bpreqs.py +3 -1
index 6c46670..1325fd2 100644
@@ -78,6 +78,8 @@ class Req:
             sys.stdout.write("You are using for version: %s\n" % stdout.split()[version_pos])
             sys.stdout.write("Specifically your idx, element: %s\n" % ([[i, x] for i, x in enumerate(stdout.split())][version_pos]))
         return stdout.split()[version_pos]
+
+    MAX_RC = 25
     def __compute_rel_weight(self, rel_specs):
         weight = 0
         extra = 0
@@ -98,7 +100,7 @@ class Req:
                 if (rc == ""):
                     rc = 0
                 else:
-                    rc = int(rc) - 20
+                    rc = int(rc) - (Req.MAX_RC + 1)
                 extra = int(rc)
             else:
                 extra = int(rel_specs['EXTRAVERSION']) + 10
Signature · 1 line
1.8.5.2.229.g4448466.dirty