← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/check-dependency-strict-compare into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/check-dependency-strict-compare into lp:launchpad.

Commit message:
Fix handling of << and >> dep-waits.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/check-dependency-strict-compare/+merge/279960

<< and >> dep-waits were handled incorrectly and so were only sometimes cleared automatically: apt_pkg.version_compare may return any negative or positive integer respectively for such cases, not just -1/1.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/check-dependency-strict-compare into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py	2015-09-11 12:21:16 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py	2015-12-08 23:59:52 +0000
@@ -545,7 +545,7 @@
             # any version is acceptable if no relationship is given
             '': lambda x: True,
             # strictly later
-            '>>': lambda x: x == 1,
+            '>>': lambda x: x > 0,
             # later or equal
             '>=': lambda x: x >= 0,
             # strictly equal
@@ -553,7 +553,7 @@
             # earlier or equal
             '<=': lambda x: x <= 0,
             # strictly earlier
-            '<<': lambda x: x == -1,
+            '<<': lambda x: x < 0,
             }
 
         # Use apt_pkg function to compare versions

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py	2015-11-26 15:46:38 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py	2015-12-08 23:59:52 +0000
@@ -325,6 +325,21 @@
         depwait_build.updateDependencies()
         self.assertEqual(depwait_build.dependencies, u'')
 
+    def testStrictInequalities(self):
+        depwait_build = self._setupSimpleDepwaitContext()
+        self.layer.txn.commit()
+
+        for dep, expected in (
+                (u'dep-bin (<< 444)', u'dep-bin (<< 444)'),
+                (u'dep-bin (>> 444)', u''),
+                (u'dep-bin (<< 888)', u''),
+                (u'dep-bin (>> 888)', u'dep-bin (>> 888)'),
+                ):
+            depwait_build.updateStatus(
+                BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': dep})
+            depwait_build.updateDependencies()
+            self.assertEqual(expected, depwait_build.dependencies)
+
     def testDisjunctions(self):
         # If one of a set of alternatives becomes available, that set of
         # alternatives is dropped from the outstanding dependencies.


Follow ups