← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rockstar/launchpad/bug-602333 into lp:launchpad/devel

 

Paul Hummer has proposed merging lp:~rockstar/launchpad/bug-602333 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #598397 makeSourcePackageRecipeBuildJob creates an arch-agnostic BuildQueue
  https://bugs.launchpad.net/bugs/598397


This branch fixes an inconsistency in the factory that I introduced by making the production recipe builds force a nominatedarchindep.  The factory wasn't created recipes in a similar manner, and so I just changed the factory method to be better.
-- 
https://code.launchpad.net/~rockstar/launchpad/bug-602333/+merge/29679
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rockstar/launchpad/bug-602333 into lp:launchpad/devel.
=== modified file 'lib/lp/code/interfaces/sourcepackagerecipebuild.py'
--- lib/lp/code/interfaces/sourcepackagerecipebuild.py	2010-06-30 02:27:10 +0000
+++ lib/lp/code/interfaces/sourcepackagerecipebuild.py	2010-07-12 09:17:46 +0000
@@ -76,9 +76,6 @@
     def getFileByName(filename):
         """Return the file under +files with specified name."""
 
-    def destroySelf():
-        """Delete the build itself."""
-
 
 class ISourcePackageRecipeBuildSource(Interface):
     """A utility of this interface be used to create source package builds."""

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2010-06-30 02:27:10 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2010-07-12 09:17:46 +0000
@@ -288,12 +288,6 @@
         removeSecurityProxy(recent_build).datecreated += a_second
         self.assertContentEqual([recent_build], get_recent())
 
-    def test_destroySelf(self):
-        # ISourcePackageRecipeBuild should make sure to remove jobs and build
-        # queue entries and then invalidate itself.
-        build = self.factory.makeSourcePackageRecipeBuild()
-        build.destroySelf()
-
 
 class TestAsBuildmaster(TestCaseWithFactory):
 

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2010-07-08 11:54:57 +0000
+++ lib/lp/testing/factory.py	2010-07-12 09:17:46 +0000
@@ -99,6 +99,7 @@
     ISourcePackageRecipeBuildSource,
     )
 from lp.code.model.diff import Diff, PreviewDiff, StaticDiff
+from lp.code.model.sourcepackagerecipebuild import SourcePackageRecipeBuild
 from lp.codehosting.codeimport.worker import CodeImportSourceDetails
 
 from lp.registry.interfaces.distribution import IDistributionSet
@@ -1832,6 +1833,13 @@
         if distroseries is None:
             distroseries = self.makeDistroSeries(
                 distribution=archive.distribution)
+        if distroseries.nominatedarchindep is None:
+            # Recipe builds need to target have a specific nominatedarchindep
+            # because we don't want to use the ARM or lpia builders.
+            distroseries.nominatedarchindep = distroseries.newArch(
+                'i386', ProcessorFamily.get(1), False, recipe.owner,
+                supports_virtualized=True)
+
         if requester is None:
             requester = self.makePerson()
         spr_build = getUtility(ISourcePackageRecipeBuildSource).new(
@@ -1852,14 +1860,9 @@
         if recipe_build is None:
             recipe_build = self.makeSourcePackageRecipeBuild(
                 sourcename=sourcename)
-        recipe_build_job = recipe_build.makeJob()
 
         store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        bq = BuildQueue(
-            job=recipe_build_job.job, lastscore=score,
-            job_type=BuildFarmJobType.RECIPEBRANCHBUILD,
-            estimated_duration = timedelta(seconds=estimated_duration),
-            virtualized=virtualized)
+        bq = SourcePackageRecipeBuild.queueBuild(recipe_build)
         store.add(bq)
         return bq