launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03759
[Merge] lp:~julian-edwards/launchpad/packageupload-with-pcj into lp:launchpad/db-devel
Julian Edwards has proposed merging lp:~julian-edwards/launchpad/packageupload-with-pcj into lp:launchpad/db-devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~julian-edwards/launchpad/packageupload-with-pcj/+merge/62631
Add package_copy_job property to PackageUpload. It's already in the schema.
--
https://code.launchpad.net/~julian-edwards/launchpad/packageupload-with-pcj/+merge/62631
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/packageupload-with-pcj into lp:launchpad/db-devel.
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2011-05-20 14:36:26 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2011-05-27 11:28:58 +0000
@@ -773,7 +773,7 @@
"""
def createQueueEntry(pocket, changesfilename, changesfilecontent,
- archive, signingkey=None):
+ archive, signingkey=None, package_copy_job=None):
"""Create a queue item attached to this distroseries.
Create a new records respecting the given pocket and archive.
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2011-05-20 14:36:26 +0000
+++ lib/lp/registry/model/distroseries.py 2011-05-27 11:28:58 +0000
@@ -1591,7 +1591,7 @@
get_property_cache(spph).newer_distroseries_version = version
def createQueueEntry(self, pocket, changesfilename, changesfilecontent,
- archive, signing_key=None):
+ archive, signing_key=None, package_copy_job=None):
"""See `IDistroSeries`."""
# We store the changes file in the librarian to avoid having to
# deal with broken encodings in these files; this will allow us
@@ -1620,7 +1620,8 @@
return PackageUpload(
distroseries=self, status=PackageUploadStatus.NEW,
pocket=pocket, archive=archive,
- changesfile=changes_file, signing_key=signing_key)
+ changesfile=changes_file, signing_key=signing_key,
+ package_copy_job=package_copy_job)
def getPackageUploadQueue(self, state):
"""See `IDistroSeries`."""
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2011-05-24 17:41:47 +0000
+++ lib/lp/soyuz/configure.zcml 2011-05-27 11:28:58 +0000
@@ -177,6 +177,7 @@
displayversion
is_delayed_copy
isPPA
+ package_copy_job
components
isAutoSyncUpload"/>
<require
=== modified file 'lib/lp/soyuz/interfaces/queue.py'
--- lib/lp/soyuz/interfaces/queue.py 2011-03-22 14:27:50 +0000
+++ lib/lp/soyuz/interfaces/queue.py 2011-05-27 11:28:58 +0000
@@ -45,6 +45,7 @@
from canonical.launchpad import _
+from lp.soyuz.interfaces.packagecopyjob import IPackageCopyJob
from lp.soyuz.enums import PackageUploadStatus
@@ -139,6 +140,12 @@
"associated with this upload")
signing_key = Attribute("Changesfile Signing Key.")
+
+ package_copy_job = Reference(
+ schema=IPackageCopyJob,
+ description=_("The PackageCopyJob for this upload, if it has one."),
+ title=_("Package Copy Job"), required=False, readonly=True)
+
archive = exported(
Reference(
# Really IArchive, patched in _schema_circular_imports.py
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2011-05-25 10:56:35 +0000
+++ lib/lp/soyuz/model/queue.py 2011-05-27 11:28:58 +0000
@@ -25,7 +25,9 @@
)
from storm.locals import (
Desc,
+ Int,
Join,
+ Reference,
)
from storm.store import Store
from zope.component import getUtility
@@ -152,6 +154,9 @@
signing_key = ForeignKey(foreignKey='GPGKey', dbName='signing_key',
notNull=False)
+ package_copy_job_id = Int(name='package_copy_job', allow_none=True)
+ package_copy_job = Reference(package_copy_job_id, 'PackageCopyJob.id')
+
# XXX julian 2007-05-06:
# Sources should not be SQLMultipleJoin, there is only ever one
# of each at most.
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2011-03-15 14:46:27 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2011-05-27 11:28:58 +0000
@@ -7,7 +7,10 @@
import os
import shutil
+from storm.store import Store
+
from zope.component import getUtility
+from zope.security.proxy import removeSecurityProxy
from canonical.config import config
from canonical.testing.layers import LaunchpadZopelessLayer
@@ -345,3 +348,19 @@
# the partner archive.
pub = package_upload.realiseUpload()[0]
self.assertEqual("partner", pub.archive.name)
+
+
+class TestPackageUploadWithPackageCopyJob(TestCaseWithFactory):
+
+ layer = LaunchpadZopelessLayer
+ dbuser = config.uploadqueue.dbuser
+
+ def test_package_copy_job_property(self):
+ # Test that we can set and get package_copy_job.
+ pcj = removeSecurityProxy(
+ self.factory.makePlainPackageCopyJob()).context
+ pu = self.factory.makePackageUpload(package_copy_job=pcj)
+ Store.of(pu).flush()
+
+ self.assertEqual(pcj, pu.package_copy_job)
+
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2011-05-24 17:41:47 +0000
+++ lib/lp/testing/factory.py 2011-05-27 11:28:58 +0000
@@ -265,6 +265,7 @@
IComponent,
IComponentSet,
)
+from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
from lp.soyuz.interfaces.packageset import IPackagesetSet
from lp.soyuz.interfaces.processor import IProcessorFamilySet
from lp.soyuz.interfaces.publishing import IPublishingSet
@@ -3361,7 +3362,8 @@
def makePackageUpload(self, distroseries=None, archive=None,
pocket=None, changes_filename=None,
changes_file_content=None,
- signing_key=None, status=None):
+ signing_key=None, status=None,
+ package_copy_job=None):
if archive is None:
archive = self.makeArchive()
if distroseries is None:
@@ -3375,7 +3377,7 @@
pocket = PackagePublishingPocket.RELEASE
package_upload = distroseries.createQueueEntry(
pocket, changes_filename, changes_file_content, archive,
- signing_key=signing_key)
+ signing_key=signing_key, package_copy_job=package_copy_job)
if status is not None:
naked_package_upload = removeSecurityProxy(package_upload)
status_changers = {
@@ -4076,6 +4078,26 @@
return getUtility(IPublisherConfigSet).new(
distribution, root_dir, base_url, copy_base_url)
+ def makePlainPackageCopyJob(
+ self, package_name=None, package_version=None, source_archive=None,
+ target_archive=None, target_distroseries=None, target_pocket=None):
+ """Create a new `PlainPackageCopyJob`."""
+ if package_name is None and package_version is None:
+ package_name = self.makeSourcePackageName().name
+ package_version = unicode(self.getUniqueInteger()) + 'version'
+ package_tuple = (package_name, package_version)
+ if source_archive is None:
+ source_archive = self.makeArchive()
+ if target_archive is None:
+ target_archive = self.makeArchive()
+ if target_distroseries is None:
+ target_distroseries = self.makeDistroSeries()
+ if target_pocket is None:
+ target_pocket = self.getAnyPocket()
+ return getUtility(IPlainPackageCopyJobSource).create(
+ package_tuple, source_archive, target_archive,
+ target_distroseries, target_pocket)
+
# Some factory methods return simple Python types. We don't add
# security wrappers for them, as well as for objects created by
Follow ups