Merge lp:~al-maisan/launchpad/parc-456551 into lp:launchpad/db-devel

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/launchpad/parc-456551
Merge into: lp:launchpad/db-devel
Diff against target: 166 lines
To merge this branch: bzr merge lp:~al-maisan/launchpad/parc-456551
Reviewer Review Type Date Requested Status
Julian Edwards (community) code Approve
Review via email: mp+14430@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

The branch at hand fixes bug #456551.

When a source package upload (to the partner archive) lacks the orig.tar.gz
file we should look for it in the Ubuntu main archive *and* in the partner
archive.

Previously we were looking for missing files in the Ubuntu *main* archive
only.

Pre-implementation call with Julian E.

Tests to run:

    bin/test -vv -t upload

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Nice branch Muharem, let's land it when 3.1.11 opens. Thanks!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archiveuploader/dscfile.py'
--- lib/lp/archiveuploader/dscfile.py 2009-06-24 23:33:29 +0000
+++ lib/lp/archiveuploader/dscfile.py 2009-11-05 20:23:11 +0000
@@ -34,7 +34,7 @@
34 re_valid_pkg_name, re_valid_version, re_issource)34 re_valid_pkg_name, re_valid_version, re_issource)
35from canonical.encoding import guess as guess_encoding35from canonical.encoding import guess as guess_encoding
36from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale36from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale
37from lp.soyuz.interfaces.archive import ArchivePurpose37from lp.soyuz.interfaces.archive import ArchivePurpose, IArchiveSet
38from canonical.launchpad.interfaces import (38from canonical.launchpad.interfaces import (
39 GPGVerificationError, IGPGHandler, IGPGKeySet,39 GPGVerificationError, IGPGHandler, IGPGKeySet,
40 ISourcePackageNameSet, NotFoundError)40 ISourcePackageNameSet, NotFoundError)
@@ -323,7 +323,17 @@
323323
324 :raise: `NotFoundError` when the wanted file could not be found.324 :raise: `NotFoundError` when the wanted file could not be found.
325 """325 """
326 if (self.policy.archive.purpose == ArchivePurpose.PPA and326 # We cannot check the archive purpose for partner archives here,
327 # because the archive override rules have not been applied yet.
328 # Uploads destined for the Ubuntu main archive and the 'partner'
329 # component will eventually end up in the partner archive though.
330 if (self.policy.archive.purpose == ArchivePurpose.PRIMARY and
331 self.component_name == 'partner'):
332 archives = [
333 getUtility(IArchiveSet).getByDistroPurpose(
334 distribution=self.policy.distro,
335 purpose=ArchivePurpose.PARTNER)]
336 elif (self.policy.archive.purpose == ArchivePurpose.PPA and
327 filename.endswith('.orig.tar.gz')):337 filename.endswith('.orig.tar.gz')):
328 archives = [self.policy.archive, self.policy.distro.main_archive]338 archives = [self.policy.archive, self.policy.distro.main_archive]
329 else:339 else:
330340
=== added directory 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3'
=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz'
331Binary files lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz 1970-01-01 00:00:00 +0000 and lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz 2009-11-05 20:23:11 +0000 differ341Binary files lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz 1970-01-01 00:00:00 +0000 and lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz 2009-11-05 20:23:11 +0000 differ
=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc'
--- lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc 1970-01-01 00:00:00 +0000
+++ lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc 2009-11-05 20:23:11 +0000
@@ -0,0 +1,10 @@
1Format: 1.0
2Source: foocomm
3Version: 1.0-3
4Binary: foocomm
5Maintainer: Launchpad team <launchpad@lists.canonical.com>
6Architecture: any
7Standards-Version: 3.6.2
8Files:
9 ad436f97a58df5b233209857439f1e7c 171 foocomm_1.0.orig.tar.gz
10 e03c530973064ebbbde9226e03868cb1 595 foocomm_1.0-3.diff.gz
011
=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes'
--- lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes 1970-01-01 00:00:00 +0000
+++ lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes 2009-11-05 20:23:11 +0000
@@ -0,0 +1,27 @@
1Format: 1.7
2Date: Thu, 27 Feb 2006 15:34:09 +0000
3Source: foocomm
4Binary: foocomm
5Architecture: source
6Version: 1.0-3
7Distribution: breezy
8Urgency: low
9Maintainer: Launchpad team <launchpad@lists.canonical.com>
10Changed-By: Foo Bar <foo.bar@canonical.com>
11Description:
12 foocomm - Stuff for testing
13Changes:
14 foocomm (1.0-1) breezy; urgency=low
15 .
16 * Initial version
17 .
18 foocomm (1.0-2) breezy; urgency=low
19 .
20 * Version 2 testing
21 .
22 foocomm (1.0-3) breezy; urgency=low
23 .
24 * Version 3 testing, orig.tar.gz reuse from partner archive.
25Files:
26 5885c292c1f4a3611a6506e4fa4e80a8 291 partner/devel optional foocomm_1.0-3.dsc
27 e03c530973064ebbbde9226e03868cb1 595 partner/devel optional foocomm_1.0-3.diff.gz
028
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2009-08-28 07:34:44 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2009-11-05 20:23:11 +0000
@@ -946,6 +946,7 @@
946 except NotFoundError:946 except NotFoundError:
947 self.fail('bar_1.0.orig.tar.gz is not yet published.')947 self.fail('bar_1.0.orig.tar.gz is not yet published.')
948948
949 # Please note: this upload goes to the Ubuntu main archive.
949 upload_dir = self.queueUpload("bar_1.0-10")950 upload_dir = self.queueUpload("bar_1.0-10")
950 self.processUpload(self.uploadprocessor, upload_dir)951 self.processUpload(self.uploadprocessor, upload_dir)
951 # Discard the announcement email and check the acceptance message952 # Discard the announcement email and check the acceptance message
@@ -961,6 +962,7 @@
961 # Make the official bar orig.tar.gz available in the system.962 # Make the official bar orig.tar.gz available in the system.
962 self.uploadNewBarToUbuntu()963 self.uploadNewBarToUbuntu()
963964
965 # Please note: the upload goes to the PPA.
964 # Upload a higher version of 'bar' to a PPA that relies on the966 # Upload a higher version of 'bar' to a PPA that relies on the
965 # availability of orig.tar.gz published in ubuntu.967 # availability of orig.tar.gz published in ubuntu.
966 upload_dir = self.queueUpload("bar_1.0-10", "~name16/ubuntu")968 upload_dir = self.queueUpload("bar_1.0-10", "~name16/ubuntu")
@@ -1032,6 +1034,7 @@
1032 # Make the official bar orig.tar.gz available in the system.1034 # Make the official bar orig.tar.gz available in the system.
1033 self.uploadNewBarToUbuntu()1035 self.uploadNewBarToUbuntu()
10341036
1037 # Please note: the upload goes to the PPA.
1035 # Upload a higher version of 'bar' to a PPA that relies on the1038 # Upload a higher version of 'bar' to a PPA that relies on the
1036 # availability of orig.tar.gz published in the PPA itself.1039 # availability of orig.tar.gz published in the PPA itself.
1037 upload_dir = self.queueUpload("bar_1.0-10-ppa-orig", "~name16/ubuntu")1040 upload_dir = self.queueUpload("bar_1.0-10-ppa-orig", "~name16/ubuntu")
10381041
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2009-09-04 08:35:20 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2009-11-05 20:23:11 +0000
@@ -742,6 +742,53 @@
742 "Expected email containing 'Cannot mix partner files with "742 "Expected email containing 'Cannot mix partner files with "
743 "non-partner.', got:\n%s" % raw_msg)743 "non-partner.', got:\n%s" % raw_msg)
744744
745 def testPartnerReusingOrigFromPartner(self):
746 """Partner uploads reuse 'orig.tar.gz' from the partner archive."""
747 # Make the official bar orig.tar.gz available in the system.
748 uploadprocessor = self.setupBreezyAndGetUploadProcessor(
749 policy='absolutely-anything')
750
751 upload_dir = self.queueUpload("foocomm_1.0-1")
752 self.processUpload(uploadprocessor, upload_dir)
753
754 self.assertEqual(
755 uploadprocessor.last_processed_upload.queue_root.status,
756 PackageUploadStatus.NEW)
757
758 [queue_item] = self.breezy.getQueueItems(
759 status=PackageUploadStatus.NEW, name="foocomm",
760 version="1.0-1", exact_match=True)
761 queue_item.setAccepted()
762 queue_item.realiseUpload()
763 self.layer.commit()
764
765 archive = getUtility(IArchiveSet).getByDistroPurpose(
766 distribution=self.ubuntu, purpose=ArchivePurpose.PARTNER)
767 try:
768 self.ubuntu.getFileByName(
769 'foocomm_1.0.orig.tar.gz', archive=archive, source=True,
770 binary=False)
771 except NotFoundError:
772 self.fail('foocomm_1.0.orig.tar.gz is not yet published.')
773
774 # Please note: this upload goes to the Ubuntu main archive.
775 upload_dir = self.queueUpload("foocomm_1.0-3")
776 self.processUpload(uploadprocessor, upload_dir)
777 # Discard the announcement email and check the acceptance message
778 # content.
779 from_addr, to_addrs, raw_msg = stub.test_emails.pop()
780 msg = message_from_string(raw_msg)
781 # This is now a MIMEMultipart message.
782 body = msg.get_payload(0)
783 body = body.get_payload(decode=True)
784
785 self.assertEqual(
786 '[ubuntu/breezy] foocomm 1.0-3 (Accepted)', msg['Subject'])
787 self.assertFalse(
788 'Unable to find foocomm_1.0.orig.tar.gz in upload or '
789 'distribution.' in body,
790 'Unable to find foocomm_1.0.orig.tar.gz')
791
745 def testPartnerUpload(self):792 def testPartnerUpload(self):
746 """Partner packages should be uploaded to the partner archive.793 """Partner packages should be uploaded to the partner archive.
747794

Subscribers

People subscribed via source and target branches

to status/vote changes: