launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09226
[Merge] lp:~cjwatson/launchpad/copy-custom-uploads-fix into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/copy-custom-uploads-fix into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #231371 in Launchpad itself: "support dist-upgrader-all pocket copy"
https://bugs.launchpad.net/launchpad/+bug/231371
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads-fix/+merge/112122
== Summary ==
https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads/+merge/111653 failed QA due to missing DB permissions.
== Implementation details ==
I moved the tests from test_copypackage to test_packagecopyjob, since the script is eventually going to go away anyway and we want everything to end up as PCJs. The PCJ test is clearly more stringent.
== LOC Rationale ==
+29. Same rationale as https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads/+merge/111653.
== Tests ==
bin/test -vvct test_packagecopyjob
== Demo and Q/A ==
Same as https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads/+merge/111653.
== Lint ==
As with https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads/+merge/111653, pre-existing lint in ./lib/lp/soyuz/scripts/tests/test_copypackage.py.
--
https://code.launchpad.net/~cjwatson/launchpad/copy-custom-uploads-fix/+merge/112122
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/copy-custom-uploads-fix into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2012-06-26 00:46:41 +0000
+++ database/schema/security.cfg 2012-06-26 14:28:34 +0000
@@ -1093,6 +1093,7 @@
public.packagesetinclusion = SELECT, INSERT
public.packagesetsources = SELECT, INSERT
public.packageupload = SELECT, INSERT, UPDATE
+public.packageuploadcustom = SELECT, INSERT, UPDATE
public.packageuploadsource = SELECT
public.packaging = SELECT, INSERT
public.person = SELECT
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2012-06-25 08:35:33 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2012-06-26 14:28:34 +0000
@@ -1660,41 +1660,6 @@
self.assertIsNone(copied_source.sponsor)
- def test_copy_custom_upload_files(self):
- # Custom upload files are queued for republication when they are
- # copied.
- self.test_publisher.breezy_autotest.status = SeriesStatus.CURRENT
- source = self.test_publisher.getPubSource(
- pocket=PackagePublishingPocket.PROPOSED)
- self.test_publisher.getPubBinaries(
- pocket=PackagePublishingPocket.PROPOSED, pub_source=source)
- [build] = source.getBuilds()
- custom_file = self.factory.makeLibraryFileAlias()
- build.package_upload.addCustom(
- custom_file, PackageUploadCustomFormat.DIST_UPGRADER)
- # Make the new librarian file available.
- self.layer.txn.commit()
-
- self.doCopy(
- source, source.archive, source.distroseries,
- PackagePublishingPocket.UPDATES, include_binaries=True)
- [upload] = source.distroseries.getPackageUploads(
- status=PackageUploadStatus.ACCEPTED, archive=source.archive,
- pocket=PackagePublishingPocket.UPDATES,
- custom_type=PackageUploadCustomFormat.DIST_UPGRADER)
-
- # The upload is targeted to the right publishing context.
- self.assertEqual(source.archive, upload.archive)
- self.assertEqual(source.distroseries, upload.distroseries)
- self.assertEqual(PackagePublishingPocket.UPDATES, upload.pocket)
-
- # It contains only the custom files.
- self.assertEqual([], list(upload.sources))
- self.assertEqual([], list(upload.builds))
- self.assertEqual(
- [custom_file],
- [custom.libraryfilealias for custom in upload.customfiles])
-
class TestDoDelayedCopy(TestCaseWithFactory, BaseDoCopyTests):
=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py 2012-06-25 09:10:14 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py 2012-06-26 14:28:34 +0000
@@ -34,6 +34,7 @@
from lp.soyuz.enums import (
ArchivePurpose,
PackageCopyPolicy,
+ PackageUploadCustomFormat,
PackageUploadStatus,
SourcePackageFormat,
)
@@ -1166,6 +1167,68 @@
for source_file in copied_source.sourcepackagerelease.files:
self.assertFalse(source_file.libraryfile.restricted)
+ def test_copy_custom_upload_files(self):
+ # Custom upload files are queued for republication when they are
+ # copied.
+ publisher = SoyuzTestPublisher()
+ publisher.prepareBreezyAutotest()
+ publisher.breezy_autotest.status = SeriesStatus.CURRENT
+ spph = publisher.getPubSource(
+ pocket=PackagePublishingPocket.PROPOSED)
+ publisher.getPubBinaries(
+ pocket=PackagePublishingPocket.PROPOSED, pub_source=spph)
+ [build] = spph.getBuilds()
+ custom_file = self.factory.makeLibraryFileAlias()
+ build.package_upload.addCustom(
+ custom_file, PackageUploadCustomFormat.DIST_UPGRADER)
+ # Make the new librarian file available.
+ self.layer.txn.commit()
+
+ # Create the copy job.
+ source = getUtility(IPlainPackageCopyJobSource)
+ requester = self.factory.makePerson()
+ with person_logged_in(spph.archive.owner):
+ spph.archive.newPocketUploader(
+ requester, PackagePublishingPocket.UPDATES)
+ job = source.create(
+ package_name=spph.sourcepackagerelease.name,
+ package_version=spph.sourcepackagerelease.version,
+ source_archive=spph.archive,
+ target_archive=spph.archive,
+ target_distroseries=spph.distroseries,
+ target_pocket=PackagePublishingPocket.UPDATES,
+ include_binaries=True,
+ requester=requester)
+
+ # Start, accept, and run the job.
+ self.assertRaises(SuspendJobException, self.runJob, job)
+ job.suspend()
+ switch_dbuser("launchpad_main")
+ pu = getUtility(IPackageUploadSet).getByPackageCopyJobIDs(
+ [removeSecurityProxy(job).context.id]).one()
+ self.assertEqual(PackageUploadStatus.UNAPPROVED, pu.status)
+ pu.acceptFromQueue()
+ self.assertEqual(PackageUploadStatus.ACCEPTED, pu.status)
+ self.runJob(job)
+ self.assertEqual(PackageUploadStatus.DONE, pu.status)
+
+ [upload] = spph.distroseries.getPackageUploads(
+ status=PackageUploadStatus.ACCEPTED, archive=spph.archive,
+ pocket=PackagePublishingPocket.UPDATES,
+ custom_type=PackageUploadCustomFormat.DIST_UPGRADER)
+
+ # The upload is targeted to the right publishing context.
+ self.assertEqual(spph.archive, upload.archive)
+ self.assertEqual(spph.distroseries, upload.distroseries)
+ self.assertEqual(PackagePublishingPocket.UPDATES, upload.pocket)
+
+ # It contains only the custom files.
+ self.assertEqual([], list(upload.sources))
+ self.assertEqual([], list(upload.builds))
+ self.assertEqual(
+ [custom_file],
+ [custom.libraryfilealias for custom in upload.customfiles])
+
def test_findMatchingDSDs_matches_all_DSDs_for_job(self):
# findMatchingDSDs finds matching DSDs for any of the packages
# in the job.
Follow ups