launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08048
[Merge] lp:~stevenk/launchpad/populate-spph-pu into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/populate-spph-pu into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/populate-spph-pu/+merge/105601
When calling newSourcePublication() from IPackageUpload.realiseUpload(), pass in the new packageupload parameter, so that we can grab the packageupload easily after the fact.
This can't land until 15-0 is applied on prod and merged into devel, but I thought I'd get it reviewed first.
I have drive-by'd a text fix in ISPPH's interface (and screwed up what diff thinks what was added, sigh).
--
https://code.launchpad.net/~stevenk/launchpad/populate-spph-pu/+merge/105601
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/populate-spph-pu into lp:launchpad.
=== modified file 'lib/lp/_schema_circular_imports.py'
--- lib/lp/_schema_circular_imports.py 2012-05-01 10:20:07 +0000
+++ lib/lp/_schema_circular_imports.py 2012-05-14 04:48:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Update the interface schema values due to circular imports.
@@ -370,6 +370,8 @@
patch_reference_property(
ISourcePackagePublishingHistory, 'ancestor',
ISourcePackagePublishingHistory)
+patch_reference_property(
+ ISourcePackagePublishingHistory, 'packageupload', IPackageUpload)
# IArchive apocalypse.
patch_reference_property(IArchive, 'distribution', IDistribution)
=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
--- lib/lp/soyuz/interfaces/publishing.py 2012-04-16 15:48:58 +0000
+++ lib/lp/soyuz/interfaces/publishing.py 2012-05-14 04:48:18 +0000
@@ -499,7 +499,17 @@
Reference(
IPerson,
title=_('Publication sponsor'),
- description=_('The IPerson who sponsored the creation of'
+ description=_('The IPerson who sponsored the creation of '
+ 'this publication.'),
+ required=False, readonly=True
+ ))
+
+ packageupload = exported(
+ Reference(
+ # Really IPackageUpload, fixed in _schema_circular_imports.
+ Interface,
+ title=_('Package upload'),
+ description=_('The Package Upload that caused the creation of '
'this publication.'),
required=False, readonly=True
))
@@ -1023,6 +1033,8 @@
sourcepackagerelease's creator will be used.
:param sponsor: An optional `IPerson` indicating the sponsor of this
publication.
+ :param packageupload: An optional `IPackageUpload` that caused this
+ publication to be created.
datecreated will be UTC_NOW.
status will be PackagePublishingStatus.PENDING
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2012-02-24 03:47:44 +0000
+++ lib/lp/soyuz/model/publishing.py 2012-05-14 04:48:18 +0000
@@ -457,6 +457,8 @@
sponsor = ForeignKey(
dbName='sponsor', foreignKey='Person',
storm_validator=validate_public_person, notNull=False, default=None)
+ packageupload = ForeignKey(
+ dbName='packageupload', foreignKey='PackageUpload', default=None)
@property
def package_creator(self):
@@ -1502,7 +1504,7 @@
def newSourcePublication(self, archive, sourcepackagerelease,
distroseries, component, section, pocket,
ancestor=None, create_dsd_job=True,
- creator=None, sponsor=None):
+ creator=None, sponsor=None, packageupload=None):
"""See `IPublishingSet`."""
# Avoid circular import.
from lp.registry.model.distributionsourcepackage import (
@@ -1520,7 +1522,8 @@
datecreated=UTC_NOW,
ancestor=ancestor,
creator=creator,
- sponsor=sponsor)
+ sponsor=sponsor,
+ packageupload=packageupload)
DistributionSourcePackage.ensure(pub)
if create_dsd_job:
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2012-01-05 14:05:10 +0000
+++ lib/lp/soyuz/model/queue.py 2012-05-14 04:48:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# pylint: disable-msg=E0611,W0212
@@ -1215,7 +1215,8 @@
distroseries=self.packageupload.distroseries,
component=self.sourcepackagerelease.component,
section=self.sourcepackagerelease.section,
- pocket=self.packageupload.pocket)
+ pocket=self.packageupload.pocket,
+ packageupload=self.packageupload)
class PackageUploadCustom(SQLBase):
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2012-01-20 15:42:44 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2012-05-14 04:48:18 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test Build features."""
@@ -363,6 +363,16 @@
self.assertEqual(spr.sourcepackagename.name, upload.package_name)
self.assertEqual(spr.version, upload.package_version)
+ def test_publish_sets_packageupload(self):
+ # Publishing a PackageUploadSource will pass itself to the source
+ # publication that was created.
+ upload = self.factory.makeSourcePackageUpload()
+ self.factory.makeComponentSelection(
+ upload.distroseries, upload.sourcepackagerelease.component)
+ upload.setAccepted()
+ [spph] = upload.realiseUpload()
+ self.assertEqual(spph.packageupload, upload)
+
class TestPackageUploadWithPackageCopyJob(TestCaseWithFactory):
Follow ups