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
1=== modified file 'lib/lp/soyuz/scripts/packagecopier.py'
2--- lib/lp/soyuz/scripts/packagecopier.py 2011-09-26 06:30:07 +0000
3+++ lib/lp/soyuz/scripts/packagecopier.py 2011-10-27 16:13:30 +0000
4@@ -32,6 +32,7 @@
5 from lp.soyuz.adapters.packagelocation import build_package_location
6 from lp.soyuz.enums import (
7 ArchivePurpose,
8+ BinaryPackageFileType,
9 SourcePackageFormat,
10 )
11 from lp.soyuz.interfaces.archive import CannotCopy
12@@ -489,6 +490,10 @@
13 for binary_file in binary_pub.binarypackagerelease.files:
14 if binary_file.libraryfile.expires is not None:
15 raise CannotCopy('source has expired binaries')
16+ if (self.archive.is_main and
17+ binary_file.filetype == BinaryPackageFileType.DDEB):
18+ raise CannotCopy(
19+ "Cannot copy DDEBs to a primary archive")
20
21 # Check if there is already a source with the same name and version
22 # published in the destination archive.
23
24=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
25--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-09-26 06:30:07 +0000
26+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2011-10-27 16:13:30 +0000
27@@ -790,6 +790,18 @@
28 status=PackagePublishingStatus.PUBLISHED)
29 self.assertCanCopyBinaries(delayed=True)
30
31+ def test_cannot_copy_ddebs_to_primary_archives(self):
32+ # The primary archive cannot (yet) cope with DDEBs, see bug
33+ # 724237 and anything tagged "ddebs".
34+ ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
35+ self.archive = self.test_publisher.ubuntutest.main_archive
36+ self.series = self.test_publisher.breezy_autotest
37+ self.source = self.test_publisher.getPubSource(archive=ppa)
38+ self.test_publisher.getPubBinaries(
39+ pub_source=self.source, with_debug=True)
40+ self.assertCannotCopyBinaries(
41+ 'Cannot copy DDEBs to a primary archive')
42+
43
44 class CopyCheckerTestCase(TestCaseWithFactory):
45