← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/launchpad/depwait-crash-bug-707077 into lp:launchpad

 

Julian Edwards has proposed merging lp:~julian-edwards/launchpad/depwait-crash-bug-707077 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #707077 cesium:retry-depwait failure to parse dependencies
  https://bugs.launchpad.net/bugs/707077

For more details, see:
https://code.launchpad.net/~julian-edwards/launchpad/depwait-crash-bug-707077/+merge/47317

Make buildd-retry-depwait report an OOPS and skip over binaries with bad dependencies instead of crashing.
-- 
https://code.launchpad.net/~julian-edwards/launchpad/depwait-crash-bug-707077/+merge/47317
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/depwait-crash-bug-707077 into lp:launchpad.
=== modified file 'lib/lp/soyuz/interfaces/binarypackagebuild.py'
--- lib/lp/soyuz/interfaces/binarypackagebuild.py	2011-01-21 02:51:05 +0000
+++ lib/lp/soyuz/interfaces/binarypackagebuild.py	2011-01-24 21:14:33 +0000
@@ -13,6 +13,7 @@
     'IBinaryPackageBuild',
     'IBuildRescoreForm',
     'IBinaryPackageBuildSet',
+    'UnparsableDependencies',
     ]
 
 from lazr.enum import (
@@ -52,6 +53,10 @@
     _message_prefix = "Cannot rescore build"
 
 
+class UnparsableDependencies(Exception):
+    """Raised when parsing invalid dependencies on a binary package."""
+
+
 class IBinaryPackageBuildView(IPackageBuild):
     """A Build interface for items requiring launchpad.View."""
     id = Int(title=_('ID'), required=True, readonly=True)

=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py	2011-01-21 16:52:57 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py	2011-01-24 21:14:33 +0000
@@ -90,6 +90,7 @@
     CannotBeRescored,
     IBinaryPackageBuild,
     IBinaryPackageBuildSet,
+    UnparsableDependencies,
     )
 from lp.soyuz.interfaces.publishing import active_publishing_status
 from lp.soyuz.model.binarypackagename import BinaryPackageName
@@ -496,7 +497,7 @@
         try:
             parsed_deps = apt_pkg.ParseDepends(self.dependencies)
         except (ValueError, TypeError):
-            raise AssertionError(
+            raise UnparsableDependencies(
                 "Build dependencies for %s (%s) could not be parsed: '%s'\n"
                 "It indicates that something is wrong in buildd-slaves."
                 % (self.title, self.id, self.dependencies))
@@ -1078,7 +1079,12 @@
             # We're changing 'build' so make sure we have an object from
             # the master store.
             build = IMasterObject(build)
-            build.updateDependencies()
+            try:
+                build.updateDependencies()
+            except UnparsableDependencies, e:
+                logger.error(e)
+                continue
+
             if build.dependencies:
                 logger.debug(
                     "Skipping %s: %s" % (build.title, build.dependencies))

=== modified file 'lib/lp/soyuz/tests/test_binarypackagebuild.py'
--- lib/lp/soyuz/tests/test_binarypackagebuild.py	2011-01-14 18:20:24 +0000
+++ lib/lp/soyuz/tests/test_binarypackagebuild.py	2011-01-24 21:14:33 +0000
@@ -31,6 +31,7 @@
 from lp.soyuz.interfaces.binarypackagebuild import (
     IBinaryPackageBuild,
     IBinaryPackageBuildSet,
+    UnparsableDependencies,
     )
 from lp.soyuz.interfaces.buildpackagejob import IBuildPackageJob
 from lp.soyuz.interfaces.component import IComponentSet
@@ -246,22 +247,22 @@
         # None is not a valid dependency values.
         depwait_build.dependencies = None
         self.assertRaises(
-            AssertionError, depwait_build.updateDependencies)
+            UnparsableDependencies, depwait_build.updateDependencies)
 
         # Missing 'name'.
         depwait_build.dependencies = u'(>> version)'
         self.assertRaises(
-            AssertionError, depwait_build.updateDependencies)
+            UnparsableDependencies, depwait_build.updateDependencies)
 
         # Missing 'version'.
         depwait_build.dependencies = u'name (>>)'
         self.assertRaises(
-            AssertionError, depwait_build.updateDependencies)
+            UnparsableDependencies, depwait_build.updateDependencies)
 
         # Missing comman between dependencies.
         depwait_build.dependencies = u'name1 name2'
         self.assertRaises(
-            AssertionError, depwait_build.updateDependencies)
+            UnparsableDependencies, depwait_build.updateDependencies)
 
     def testBug378828(self):
         # `IBinaryPackageBuild.updateDependencies` copes with the


Follow ups