Merge lp:~rockstar/launchpad/delete-recipes into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Merged at revision: 11076
Proposed branch: lp:~rockstar/launchpad/delete-recipes
Merge into: lp:launchpad
Diff against target: 53 lines (+16/-6)
3 files modified
lib/lp/code/interfaces/sourcepackagerecipebuild.py (+3/-0)
lib/lp/code/model/sourcepackagerecipebuild.py (+7/-6)
lib/lp/code/model/tests/test_sourcepackagerecipebuild.py (+6/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/delete-recipes
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Approve
Review via email: mp+28773@code.launchpad.net

Description of the change

This branch fixes bug #597376. Basically, in some cases, a SourcePackageRecipeBuild won't have a buildqueue entry. In the cases where it does, we'll need to delete the build queue entry and the job itself as part of deleting the build.

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/interfaces/sourcepackagerecipebuild.py'
--- lib/lp/code/interfaces/sourcepackagerecipebuild.py 2010-06-02 15:59:47 +0000
+++ lib/lp/code/interfaces/sourcepackagerecipebuild.py 2010-06-29 17:21:31 +0000
@@ -68,6 +68,9 @@
68 def getFileByName(filename):68 def getFileByName(filename):
69 """Return the file under +files with specified name."""69 """Return the file under +files with specified name."""
7070
71 def destroySelf():
72 """Delete the build itself."""
73
7174
72class ISourcePackageRecipeBuildSource(Interface):75class ISourcePackageRecipeBuildSource(Interface):
73 """A utility of this interface be used to create source package builds."""76 """A utility of this interface be used to create source package builds."""
7477
=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py 2010-06-12 13:34:11 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py 2010-06-29 17:21:31 +0000
@@ -219,12 +219,13 @@
219219
220 def destroySelf(self):220 def destroySelf(self):
221 store = Store.of(self)221 store = Store.of(self)
222 job = self.buildqueue_record.job222 if self.buildqueue_record is not None:
223 store.remove(self.buildqueue_record)223 job = self.buildqueue_record.job
224 store.find(224 store.remove(self.buildqueue_record)
225 SourcePackageRecipeBuildJob,225 store.find(
226 SourcePackageRecipeBuildJob.build == self.id).remove()226 SourcePackageRecipeBuildJob,
227 store.remove(job)227 SourcePackageRecipeBuildJob.build == self.id).remove()
228 store.remove(job)
228 store.remove(self)229 store.remove(self)
229230
230 @classmethod231 @classmethod
231232
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2010-06-12 13:34:11 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2010-06-29 17:21:31 +0000
@@ -240,6 +240,12 @@
240 removeSecurityProxy(recent_build).datecreated += a_second240 removeSecurityProxy(recent_build).datecreated += a_second
241 self.assertContentEqual([recent_build], get_recent())241 self.assertContentEqual([recent_build], get_recent())
242242
243 def test_destroySelf(self):
244 # ISourcePackageRecipeBuild should make sure to remove jobs and build
245 # queue entries and then invalidate itself.
246 build = self.factory.makeSourcePackageRecipeBuild()
247 build.destroySelf()
248
243249
244class TestAsBuildmaster(TestCaseWithFactory):250class TestAsBuildmaster(TestCaseWithFactory):
245251