← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thumper/launchpad/bugjam-684515-recipe-builds into lp:launchpad

 

Tim Penhey has proposed merging lp:~thumper/launchpad/bugjam-684515-recipe-builds into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #684515 daily builds try to rebuild manually triggered build
  https://bugs.launchpad.net/bugs/684515


If a user requests a daily build for a recipe, don't try to automatically build it.

The caveat to that is that the recipe is built into the daily build PPA.

This change does mean that if a manual build is requested for a subset of the distro series into the daily build PPA, that an automatic build of the remaining distroseries will not be attempted.  However, we may want to simplify the request build process and the distroseries to not have differences - this isn't however part of the change in this branch.
-- 
https://code.launchpad.net/~thumper/launchpad/bugjam-684515-recipe-builds/+merge/43730
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/bugjam-684515-recipe-builds into lp:launchpad.
=== modified file 'lib/lp/code/model/sourcepackagerecipe.py'
--- lib/lp/code/model/sourcepackagerecipe.py	2010-12-07 05:18:25 +0000
+++ lib/lp/code/model/sourcepackagerecipe.py	2010-12-15 02:58:55 +0000
@@ -246,6 +246,11 @@
         queue_record = build.buildqueue_record
         if manual:
             queue_record.manualScore(queue_record.lastscore + 100)
+        # If this build is going into the daily build archive, then we don't
+        # want to attempt to build it during the next automatic daily build
+        # run.
+        if archive == self.daily_build_archive:
+            self.is_stale = False
         return build
 
     def getBuilds(self, pending=False):

=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py	2010-11-30 12:23:01 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py	2010-12-15 02:58:55 +0000
@@ -201,7 +201,6 @@
                     errorlog.globalErrorUtility.raising(info)
                 else:
                     builds.append(build)
-            recipe.is_stale = False
         return builds
 
     def _unqueueBuild(self):

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py	2010-12-01 11:26:57 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py	2010-12-15 02:58:55 +0000
@@ -366,6 +366,25 @@
         queue_record.score()
         self.assertEqual(2605, queue_record.lastscore)
 
+    def test_requestBuild_into_daily_ppa_resets_stale(self):
+        # A stale recipe that is requested to build into the daily ppa is no
+        # longer stale.
+        recipe = self.factory.makeSourcePackageRecipe()
+        recipe.requestBuild(recipe.daily_build_archive,
+            recipe.owner, list(recipe.distroseries)[0],
+            PackagePublishingPocket.RELEASE)
+        self.assertFalse(recipe.is_stale)
+
+    def test_requestBuild_into_other_ppa_is_still_stale(self):
+        # A stale recipe that is requested to build into a PPA other than the
+        # daily PPA is still considered stale.
+        recipe = self.factory.makeSourcePackageRecipe()
+        ppa = self.factory.makeArchive()
+        recipe.requestBuild(
+            ppa, ppa.owner, list(recipe.distroseries)[0],
+            PackagePublishingPocket.RELEASE)
+        self.assertTrue(recipe.is_stale)
+
     def test_requestBuild_relative_build_score(self):
         """Offsets for archives are respected."""
         recipe = self.factory.makeSourcePackageRecipe()

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2010-11-19 12:22:15 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2010-12-15 02:58:55 +0000
@@ -252,6 +252,9 @@
         second_distroseries = \
             self.factory.makeSourcePackageRecipeDistroseries("hoary")
         recipe.distroseries.add(second_distroseries)
+        # The scanner normally marks recipes as stale when new revisions are
+        # pushed.  For this test fake it.
+        removeSecurityProxy(recipe).is_stale = True
         builds = SourcePackageRecipeBuild.makeDailyBuilds()
         self.assertEqual(
             [second_distroseries], [build.distroseries for build in builds])