Merge lp:~julian-edwards/launchpad/prevent-ddeb-copy-bug-747558 into lp:launchpad

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 14204
Proposed branch: lp:~julian-edwards/launchpad/prevent-ddeb-copy-bug-747558
Merge into: lp:launchpad
Diff against target: 44 lines (+17/-0)
2 files modified
lib/lp/soyuz/scripts/packagecopier.py (+5/-0)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+12/-0)
To merge this branch: bzr merge lp:~julian-edwards/launchpad/prevent-ddeb-copy-bug-747558
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+80592@code.launchpad.net

Commit message

[r=julian-edwards][bug=747558] Prevent copying of DDEBs into primary archives.

Description of the change

= Summary =
Prevent copying of DDEBs into primary archives.

== Proposed fix ==
Adds a check to the packagecopier to raise an error if the target archive
is a primary distro archive.

== Pre-implementation notes ==
This is required as part of finally allowing DDEBs to be published in PPAs
because putting DDEBs in the main archive causes the publisher to faint. Or
is that feint...

== Implementation details ==
See the diff, it's trivial.

== Tests ==
bin/test -cvv test_copypackage test_cannot_copy_ddebs

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/scripts/packagecopier.py'
--- lib/lp/soyuz/scripts/packagecopier.py 2011-09-26 06:30:07 +0000
+++ lib/lp/soyuz/scripts/packagecopier.py 2011-10-27 16:13:30 +0000
@@ -32,6 +32,7 @@
32from lp.soyuz.adapters.packagelocation import build_package_location32from lp.soyuz.adapters.packagelocation import build_package_location
33from lp.soyuz.enums import (33from lp.soyuz.enums import (
34 ArchivePurpose,34 ArchivePurpose,
35 BinaryPackageFileType,
35 SourcePackageFormat,36 SourcePackageFormat,
36 )37 )
37from lp.soyuz.interfaces.archive import CannotCopy38from lp.soyuz.interfaces.archive import CannotCopy
@@ -489,6 +490,10 @@
489 for binary_file in binary_pub.binarypackagerelease.files:490 for binary_file in binary_pub.binarypackagerelease.files:
490 if binary_file.libraryfile.expires is not None:491 if binary_file.libraryfile.expires is not None:
491 raise CannotCopy('source has expired binaries')492 raise CannotCopy('source has expired binaries')
493 if (self.archive.is_main and
494 binary_file.filetype == BinaryPackageFileType.DDEB):
495 raise CannotCopy(
496 "Cannot copy DDEBs to a primary archive")
492497
493 # Check if there is already a source with the same name and version498 # Check if there is already a source with the same name and version
494 # published in the destination archive.499 # published in the destination archive.
495500
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-09-26 06:30:07 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-10-27 16:13:30 +0000
@@ -790,6 +790,18 @@
790 status=PackagePublishingStatus.PUBLISHED)790 status=PackagePublishingStatus.PUBLISHED)
791 self.assertCanCopyBinaries(delayed=True)791 self.assertCanCopyBinaries(delayed=True)
792792
793 def test_cannot_copy_ddebs_to_primary_archives(self):
794 # The primary archive cannot (yet) cope with DDEBs, see bug
795 # 724237 and anything tagged "ddebs".
796 ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
797 self.archive = self.test_publisher.ubuntutest.main_archive
798 self.series = self.test_publisher.breezy_autotest
799 self.source = self.test_publisher.getPubSource(archive=ppa)
800 self.test_publisher.getPubBinaries(
801 pub_source=self.source, with_debug=True)
802 self.assertCannotCopyBinaries(
803 'Cannot copy DDEBs to a primary archive')
804
793805
794class CopyCheckerTestCase(TestCaseWithFactory):806class CopyCheckerTestCase(TestCaseWithFactory):
795807