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
1=== modified file 'lib/lp/archiveuploader/dscfile.py'
2--- lib/lp/archiveuploader/dscfile.py 2009-06-24 23:33:29 +0000
3+++ lib/lp/archiveuploader/dscfile.py 2009-11-05 20:23:11 +0000
4@@ -34,7 +34,7 @@
5 re_valid_pkg_name, re_valid_version, re_issource)
6 from canonical.encoding import guess as guess_encoding
7 from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale
8-from lp.soyuz.interfaces.archive import ArchivePurpose
9+from lp.soyuz.interfaces.archive import ArchivePurpose, IArchiveSet
10 from canonical.launchpad.interfaces import (
11 GPGVerificationError, IGPGHandler, IGPGKeySet,
12 ISourcePackageNameSet, NotFoundError)
13@@ -323,7 +323,17 @@
14
15 :raise: `NotFoundError` when the wanted file could not be found.
16 """
17- if (self.policy.archive.purpose == ArchivePurpose.PPA and
18+ # We cannot check the archive purpose for partner archives here,
19+ # because the archive override rules have not been applied yet.
20+ # Uploads destined for the Ubuntu main archive and the 'partner'
21+ # component will eventually end up in the partner archive though.
22+ if (self.policy.archive.purpose == ArchivePurpose.PRIMARY and
23+ self.component_name == 'partner'):
24+ archives = [
25+ getUtility(IArchiveSet).getByDistroPurpose(
26+ distribution=self.policy.distro,
27+ purpose=ArchivePurpose.PARTNER)]
28+ elif (self.policy.archive.purpose == ArchivePurpose.PPA and
29 filename.endswith('.orig.tar.gz')):
30 archives = [self.policy.archive, self.policy.distro.main_archive]
31 else:
32
33=== added directory 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3'
34=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.diff.gz'
35Binary 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
36=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc'
37--- lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc 1970-01-01 00:00:00 +0000
38+++ lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3.dsc 2009-11-05 20:23:11 +0000
39@@ -0,0 +1,10 @@
40+Format: 1.0
41+Source: foocomm
42+Version: 1.0-3
43+Binary: foocomm
44+Maintainer: Launchpad team <launchpad@lists.canonical.com>
45+Architecture: any
46+Standards-Version: 3.6.2
47+Files:
48+ ad436f97a58df5b233209857439f1e7c 171 foocomm_1.0.orig.tar.gz
49+ e03c530973064ebbbde9226e03868cb1 595 foocomm_1.0-3.diff.gz
50
51=== added file 'lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes'
52--- lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes 1970-01-01 00:00:00 +0000
53+++ lib/lp/archiveuploader/tests/data/suite/foocomm_1.0-3/foocomm_1.0-3_source.changes 2009-11-05 20:23:11 +0000
54@@ -0,0 +1,27 @@
55+Format: 1.7
56+Date: Thu, 27 Feb 2006 15:34:09 +0000
57+Source: foocomm
58+Binary: foocomm
59+Architecture: source
60+Version: 1.0-3
61+Distribution: breezy
62+Urgency: low
63+Maintainer: Launchpad team <launchpad@lists.canonical.com>
64+Changed-By: Foo Bar <foo.bar@canonical.com>
65+Description:
66+ foocomm - Stuff for testing
67+Changes:
68+ foocomm (1.0-1) breezy; urgency=low
69+ .
70+ * Initial version
71+ .
72+ foocomm (1.0-2) breezy; urgency=low
73+ .
74+ * Version 2 testing
75+ .
76+ foocomm (1.0-3) breezy; urgency=low
77+ .
78+ * Version 3 testing, orig.tar.gz reuse from partner archive.
79+Files:
80+ 5885c292c1f4a3611a6506e4fa4e80a8 291 partner/devel optional foocomm_1.0-3.dsc
81+ e03c530973064ebbbde9226e03868cb1 595 partner/devel optional foocomm_1.0-3.diff.gz
82
83=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
84--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2009-08-28 07:34:44 +0000
85+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2009-11-05 20:23:11 +0000
86@@ -946,6 +946,7 @@
87 except NotFoundError:
88 self.fail('bar_1.0.orig.tar.gz is not yet published.')
89
90+ # Please note: this upload goes to the Ubuntu main archive.
91 upload_dir = self.queueUpload("bar_1.0-10")
92 self.processUpload(self.uploadprocessor, upload_dir)
93 # Discard the announcement email and check the acceptance message
94@@ -961,6 +962,7 @@
95 # Make the official bar orig.tar.gz available in the system.
96 self.uploadNewBarToUbuntu()
97
98+ # Please note: the upload goes to the PPA.
99 # Upload a higher version of 'bar' to a PPA that relies on the
100 # availability of orig.tar.gz published in ubuntu.
101 upload_dir = self.queueUpload("bar_1.0-10", "~name16/ubuntu")
102@@ -1032,6 +1034,7 @@
103 # Make the official bar orig.tar.gz available in the system.
104 self.uploadNewBarToUbuntu()
105
106+ # Please note: the upload goes to the PPA.
107 # Upload a higher version of 'bar' to a PPA that relies on the
108 # availability of orig.tar.gz published in the PPA itself.
109 upload_dir = self.queueUpload("bar_1.0-10-ppa-orig", "~name16/ubuntu")
110
111=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
112--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2009-09-04 08:35:20 +0000
113+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2009-11-05 20:23:11 +0000
114@@ -742,6 +742,53 @@
115 "Expected email containing 'Cannot mix partner files with "
116 "non-partner.', got:\n%s" % raw_msg)
117
118+ def testPartnerReusingOrigFromPartner(self):
119+ """Partner uploads reuse 'orig.tar.gz' from the partner archive."""
120+ # Make the official bar orig.tar.gz available in the system.
121+ uploadprocessor = self.setupBreezyAndGetUploadProcessor(
122+ policy='absolutely-anything')
123+
124+ upload_dir = self.queueUpload("foocomm_1.0-1")
125+ self.processUpload(uploadprocessor, upload_dir)
126+
127+ self.assertEqual(
128+ uploadprocessor.last_processed_upload.queue_root.status,
129+ PackageUploadStatus.NEW)
130+
131+ [queue_item] = self.breezy.getQueueItems(
132+ status=PackageUploadStatus.NEW, name="foocomm",
133+ version="1.0-1", exact_match=True)
134+ queue_item.setAccepted()
135+ queue_item.realiseUpload()
136+ self.layer.commit()
137+
138+ archive = getUtility(IArchiveSet).getByDistroPurpose(
139+ distribution=self.ubuntu, purpose=ArchivePurpose.PARTNER)
140+ try:
141+ self.ubuntu.getFileByName(
142+ 'foocomm_1.0.orig.tar.gz', archive=archive, source=True,
143+ binary=False)
144+ except NotFoundError:
145+ self.fail('foocomm_1.0.orig.tar.gz is not yet published.')
146+
147+ # Please note: this upload goes to the Ubuntu main archive.
148+ upload_dir = self.queueUpload("foocomm_1.0-3")
149+ self.processUpload(uploadprocessor, upload_dir)
150+ # Discard the announcement email and check the acceptance message
151+ # content.
152+ from_addr, to_addrs, raw_msg = stub.test_emails.pop()
153+ msg = message_from_string(raw_msg)
154+ # This is now a MIMEMultipart message.
155+ body = msg.get_payload(0)
156+ body = body.get_payload(decode=True)
157+
158+ self.assertEqual(
159+ '[ubuntu/breezy] foocomm 1.0-3 (Accepted)', msg['Subject'])
160+ self.assertFalse(
161+ 'Unable to find foocomm_1.0.orig.tar.gz in upload or '
162+ 'distribution.' in body,
163+ 'Unable to find foocomm_1.0.orig.tar.gz')
164+
165 def testPartnerUpload(self):
166 """Partner packages should be uploaded to the partner archive.
167

Subscribers

People subscribed via source and target branches

to status/vote changes: