launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17119
[Merge] lp:~wgrant/launchpad/archiveuploader-archive-ref into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/archiveuploader-archive-ref into lp:launchpad.
Commit message:
Use archive references throughout Soyuz upload and build notifications.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/archiveuploader-archive-ref/+merge/226065
Use archive references throughout Soyuz upload and build notifications.
I also deprecated the X-Launchpad-PPA header, restricted it to Ubuntu PPAs, and introduced a new X-Launchpad-Archive header to all notifications about an archive.
--
https://code.launchpad.net/~wgrant/launchpad/archiveuploader-archive-ref/+merge/226065
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/archiveuploader-archive-ref into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt'
--- lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2012-10-24 09:43:58 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2014-07-09 06:38:12 +0000
@@ -28,8 +28,9 @@
third part application and also in our changeslist (gutsy-changes@).
See further information in bug #121752.
-PPA upload notifications also include a 'X-Launchpad-PPA' email header
-containing the target PPA owner name, see bug #172377.
+Notifications also include an 'X-Launchpad-Archive' header containing
+the target archive reference, and Ubuntu PPA notifications have an
+'X-Launchpad-PPA' email header containing the old-style PPA reference.
We need to be logged into the security model in order to get any further
@@ -162,6 +163,8 @@
Upload notifications from primary archive do not contain the
'X-Launchpad-PPA' header, since it doesn't apply to this context.
+ >>> notification['X-Launchpad-Archive']
+ 'ubuntu'
>>> 'X-Launchpad-PPA' in notification.keys()
False
@@ -285,6 +288,8 @@
On PPA upload notifications the 'X-Launchpad-PPA' is present and
contains the target PPA owner account name.
+ >>> notification['X-Launchpad-Archive']
+ '~name16/ubuntu/ppa'
>>> notification['X-Launchpad-PPA']
'name16'
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2014-07-07 13:32:18 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2014-07-09 06:38:12 +0000
@@ -2,7 +2,7 @@
# NOTE: The first line above must stay first; do not move the copyright
# notice to the top. See http://www.python.org/dev/peps/pep-0263/.
#
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Functional tests for uploadprocessor.py."""
@@ -254,7 +254,7 @@
# Subject and PPA emails header contain the owner name since
# it's the default PPA.
contents = [
- "Subject: [PPA name16] [ubuntu/breezy] bar 1.0-1 (Accepted)"]
+ "Subject: [~name16/ubuntu/ppa/breezy] bar 1.0-1 (Accepted)"]
self.assertEmail(contents, ppa_header='name16')
def testNamedPPAUploadNonDefault(self):
@@ -272,8 +272,7 @@
# Subject and PPA email-header are specific for this named-ppa.
contents = [
- "Subject: [PPA name16-testing] [ubuntu/breezy] bar 1.0-1 "
- "(Accepted)"]
+ "Subject: [~name16/ubuntu/testing/breezy] bar 1.0-1 (Accepted)"]
self.assertEmail(contents, ppa_header='name16-testing')
def testNamedPPAUploadWithSeries(self):
@@ -807,7 +806,7 @@
'previous error.'], rejection_message.splitlines())
contents = [
- "Subject: [PPA cprov] bar_1.0-1_source.changes rejected",
+ "Subject: [~cprov/ubuntu/ppa] bar_1.0-1_source.changes rejected",
"Could not find person or team named 'boing'",
"https://help.launchpad.net/Packaging/PPA#Uploading",
"If you don't understand why your files were rejected please "
@@ -1199,7 +1198,7 @@
# An email communicating the rejection and the reason why it was
# rejected is sent to the uploaders.
contents = [
- "Subject: [PPA name16] bar_1.0-1_source.changes rejected",
+ "Subject: [~name16/ubuntu/ppa] bar_1.0-1_source.changes rejected",
"Rejected:",
"PPA exceeded its size limit (2048.00 of 2048.00 MiB). "
"Ask a question in https://answers.launchpad.net/soyuz/ "
@@ -1211,7 +1210,7 @@
upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
self.processUpload(self.uploadprocessor, upload_dir)
contents = [
- "Subject: [PPA name16] [ubuntu/breezy] bar 1.0-1 (Accepted)"]
+ "Subject: [~name16/ubuntu/ppa/breezy] bar 1.0-1 (Accepted)"]
self.assertEmail(contents)
self.assertEqual(
self.uploadprocessor.last_processed_upload.queue_root.status,
@@ -1231,7 +1230,7 @@
upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
self.processUpload(self.uploadprocessor, upload_dir)
contents = [
- "Subject: [PPA name16] [ubuntu/breezy] bar 1.0-1 (Accepted)",
+ "Subject: [~name16/ubuntu/ppa/breezy] bar 1.0-1 (Accepted)",
"Upload Warnings:",
"PPA exceeded 95 % of its size limit (2000.00 of 2048.00 MiB). "
"Ask a question in https://answers.launchpad.net/soyuz/ "
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2014-06-26 07:17:13 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2014-07-09 06:38:12 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Functional tests for uploadprocessor.py."""
@@ -1008,7 +1008,7 @@
body = body.get_payload(decode=True)
self.assertEqual(
- '[ubuntu/breezy] foocomm 1.0-3 (Accepted)', msg['Subject'])
+ '[ubuntu/partner/breezy] foocomm 1.0-3 (Accepted)', msg['Subject'])
self.assertFalse(
'Unable to find foocomm_1.0.orig.tar.gz in upload or '
'distribution.' in body,
@@ -1069,7 +1069,7 @@
build_uploadprocessor, upload_dir, build=foocomm_build)
contents = [
- "Subject: foocomm_1.0-1_i386.changes rejected",
+ "Subject: [ubuntu/partner] foocomm_1.0-1_i386.changes rejected",
"Attempt to upload binaries specifying build 31, "
"where they don't fit."]
self.assertEmail(contents)
@@ -1709,7 +1709,7 @@
from_addr, to_addrs, raw_msg = stub.test_emails.pop()
msg = message_from_string(raw_msg)
self.assertEqual(
- msg['Subject'], 'bar_1.0-2_source.changes rejected')
+ msg['Subject'], '[ubuntu] bar_1.0-2_source.changes rejected')
# Grant the permissions in the proper series.
self.switchToAdmin()
@@ -1762,7 +1762,7 @@
rejection_message.splitlines())
contents = [
- "Subject: bar_1.0-1_source.changes rejected",
+ "Subject: [ubuntu] bar_1.0-1_source.changes rejected",
"Could not find distribution 'boing'",
"If you don't understand why your files were rejected",
"http://answers.launchpad.net/soyuz",
@@ -1930,7 +1930,7 @@
rejection_message)
contents = [
- "Subject: bar_1.0-1_source.changes rejected",
+ "Subject: [ubuntu] bar_1.0-1_source.changes rejected",
"Not permitted to upload to the RELEASE pocket in a series "
"in the 'CURRENT' state.",
"If you don't understand why your files were rejected",
=== modified file 'lib/lp/soyuz/adapters/notification.py'
--- lib/lp/soyuz/adapters/notification.py 2013-08-08 04:11:59 +0000
+++ lib/lp/soyuz/adapters/notification.py 2014-07-09 06:38:12 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Notification for uploads and copies."""
@@ -65,8 +65,8 @@
'USERS_ADDRESS': config.launchpad.users_address,
}
subject = '%s rejected' % filename
- if archive and archive.is_ppa:
- subject = '[PPA %s] %s' % (get_ppa_reference(archive), subject)
+ if archive:
+ subject = '[%s] %s' % (archive.reference, subject)
information['ARCHIVE_URL'] = '\n%s' % canonical_url(archive)
template = get_template(archive, 'rejected')
body = template % information
@@ -119,10 +119,8 @@
names.add(custom.libraryfilealias.filename)
name_str = ', '.join(names)
subject = '[%s/%s] %s %s (%s)' % (
- distroseries.distribution.name, suite, name_str, version,
+ archive.reference, suite, name_str, version,
ACTION_DESCRIPTIONS[action])
- if archive.is_ppa:
- subject = '[PPA %s] %s' % (get_ppa_reference(archive), subject)
return subject
@@ -343,11 +341,14 @@
:param attach_changes: A flag governing whether the original changesfile
content shall be attached to the email.
"""
- extra_headers = {'X-Katie': 'Launchpad actually'}
+ extra_headers = {
+ 'X-Katie': 'Launchpad actually',
+ 'X-Launchpad-Archive': archive.reference,
+ }
- # Include the 'X-Launchpad-PPA' header for PPA upload notfications
- # containing the PPA owner name.
- if archive.is_ppa:
+ # The deprecated PPA reference header is included for Ubuntu PPAs to
+ # avoid breaking existing consumers.
+ if archive.is_ppa and archive.distribution.name == u'ubuntu':
extra_headers['X-Launchpad-PPA'] = get_ppa_reference(archive)
# Include a 'X-Launchpad-Component' header with the component and
=== modified file 'lib/lp/soyuz/adapters/tests/test_notification.py'
--- lib/lp/soyuz/adapters/tests/test_notification.py 2013-05-28 01:24:33 +0000
+++ lib/lp/soyuz/adapters/tests/test_notification.py 2014-07-09 06:38:12 +0000
@@ -2,7 +2,7 @@
# NOTE: The first line above must stay first; do not move the copyright
# notice to the top. See http://www.python.org/dev/peps/pep-0263/.
#
-# Copyright 2011-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from email.utils import formataddr
@@ -12,7 +12,6 @@
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
-from lp.archivepublisher.utils import get_ppa_reference
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.log.logger import BufferLogger
from lp.services.mail.sendmail import format_address_for_person
@@ -81,9 +80,8 @@
archive = self.factory.makeArchive()
pocket = self.factory.getAnyPocket()
distroseries = self.factory.makeDistroSeries()
- expected_subject = '[PPA %s] [%s/%s] %s - (Accepted)' % (
- get_ppa_reference(archive), distroseries.distribution.name,
- distroseries.getSuite(pocket), lfa.filename)
+ expected_subject = '[%s/%s] %s - (Accepted)' % (
+ archive.reference, distroseries.getSuite(pocket), lfa.filename)
subject = calculate_subject(
None, [], [customfile], archive, distroseries, pocket,
'accepted')
@@ -293,9 +291,9 @@
archive = self.factory.makeArchive()
pocket = self.factory.getAnyPocket()
distroseries = self.factory.makeDistroSeries()
- expected_subject = '[PPA %s] [%s/%s] %s %s (Accepted)' % (
- get_ppa_reference(archive), distroseries.distribution.name,
- distroseries.getSuite(pocket), spr.name, spr.version)
+ expected_subject = '[%s/%s] %s %s (Accepted)' % (
+ archive.reference, distroseries.getSuite(pocket), spr.name,
+ spr.version)
subject = calculate_subject(
spr, [], [], archive, distroseries, pocket, 'accepted')
self.assertEqual(expected_subject, subject)
@@ -305,9 +303,8 @@
archive = self.factory.makeArchive()
pocket = self.factory.getAnyPocket()
distroseries = self.factory.makeDistroSeries()
- expected_subject = '[PPA %s] [%s/%s] %s %s (Accepted)' % (
- get_ppa_reference(archive), distroseries.distribution.name,
- distroseries.getSuite(pocket),
+ expected_subject = '[%s/%s] %s %s (Accepted)' % (
+ archive.reference, distroseries.getSuite(pocket),
bpr.build.source_package_release.name, bpr.version)
subject = calculate_subject(
None, [bpr], [], archive, distroseries, pocket, 'accepted')
=== modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt'
--- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2014-01-30 15:04:06 +0000
+++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2014-07-09 06:38:12 +0000
@@ -308,7 +308,7 @@
To:
Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>,
Foo Bar <foo.bar@xxxxxxxxxxxxx>
- Subject: bar_1.0-3_source.changes rejected
+ Subject: [ubuntutest] bar_1.0-3_source.changes rejected
...
Force weird behaviour with rfc2047 sentences containing '.' on
=== modified file 'lib/lp/soyuz/mail/livefsbuild.py'
--- lib/lp/soyuz/mail/livefsbuild.py 2014-05-08 14:40:02 +0000
+++ lib/lp/soyuz/mail/livefsbuild.py 2014-07-09 06:38:12 +0000
@@ -7,7 +7,6 @@
]
from lp.app.browser.tales import DurationFormatterAPI
-from lp.archivepublisher.utils import get_ppa_reference
from lp.services.config import config
from lp.services.mail.basemailer import (
BaseMailer,
@@ -52,6 +51,7 @@
params = super(LiveFSBuildMailer, self)._getTemplateParams(
email, recipient)
params.update({
+ "archive_tag": build.archive.reference,
"build_id": build.id,
"build_title": build.title,
"livefs_name": build.livefs.name,
@@ -66,12 +66,6 @@
"builder_url": "",
"build_url": canonical_url(self.build),
})
- if build.archive.is_ppa:
- archive_tag = "%s PPA" % get_ppa_reference(build.archive)
- else:
- archive_tag = "%s primary archive" % (
- build.archive.distribution.name)
- params["archive_tag"] = archive_tag
if build.duration is not None:
duration_formatter = DurationFormatterAPI(build.duration)
params["build_duration"] = duration_formatter.approximateduration()
=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py 2013-12-04 07:07:04 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py 2014-07-09 06:38:12 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -719,6 +719,7 @@
config.builddmaster.default_sender_address)
extra_headers = {
+ 'X-Launchpad-Archive': self.archive.reference,
'X-Launchpad-Build-State': self.status.name,
'X-Launchpad-Build-Component': self.current_component.name,
'X-Launchpad-Build-Arch':
@@ -766,12 +767,11 @@
# main archive candidates.
# For PPA build notifications we include the archive.owner
# contact_address.
+ subject = "[Build #%d] %s" % (self.id, self.title)
if not self.archive.is_ppa:
buildd_admins = getUtility(ILaunchpadCelebrities).buildd_admin
recipients = recipients.union(
get_contact_email_addresses(buildd_admins))
- archive_tag = '%s primary archive' % self.distribution.name
- subject = "[Build #%d] %s" % (self.id, self.title)
source_url = canonical_url(self.distributionsourcepackagerelease)
else:
recipients = recipients.union(
@@ -781,11 +781,13 @@
# not enabled it.
if len(recipients) == 0:
return
- archive_tag = '%s PPA' % get_ppa_reference(self.archive)
- subject = "[Build #%d] %s (%s)" % (
- self.id, self.title, archive_tag)
+ subject += ' [%s]' % self.archive.reference
source_url = 'not available'
- extra_headers['X-Launchpad-PPA'] = get_ppa_reference(self.archive)
+ # The deprecated PPA reference header is included for Ubuntu
+ # PPAs to avoid breaking existing consumers.
+ if self.archive.distribution.name == u'ubuntu':
+ extra_headers['X-Launchpad-PPA'] = get_ppa_reference(
+ self.archive)
# XXX cprov 2006-08-02: pending security recipients for SECURITY
# pocket build. We don't build SECURITY yet :(
@@ -837,7 +839,7 @@
'build_url': canonical_url(self),
'source_url': source_url,
'extra_info': extra_info,
- 'archive_tag': archive_tag,
+ 'archive_tag': self.archive.reference,
'component_tag': self.current_component.name,
}
message = template % replacements
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2013-09-11 08:17:34 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2014-07-09 06:38:12 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -20,7 +20,6 @@
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
-from lp.archivepublisher.utils import get_ppa_reference
from lp.bugs.interfaces.bug import (
CreateBugParams,
IBugSet,
@@ -1417,7 +1416,7 @@
send_email=True)
[notification] = pop_notifications()
self.assertEqual(
- get_ppa_reference(target_archive), notification['X-Launchpad-PPA'])
+ target_archive.reference, notification['X-Launchpad-Archive'])
body = notification.get_payload()[0].get_payload()
expected = (dedent("""\
Accepted:
@@ -1452,6 +1451,10 @@
person=source.sourcepackagerelease.creator,
check_permissions=False, send_email=True)
[notification, announcement] = pop_notifications()
+ self.assertEqual(
+ archive.reference, notification['X-Launchpad-Archive'])
+ self.assertEqual(
+ archive.reference, announcement['X-Launchpad-Archive'])
self.assertEqual('Foo Bar <foo.bar@xxxxxxxxxxxxx>', notification['To'])
self.assertEqual('nobby-changes@xxxxxxxxxxx', announcement['To'])
for mail in (notification, announcement):
=== modified file 'lib/lp/soyuz/tests/test_build_notify.py'
--- lib/lp/soyuz/tests/test_build_notify.py 2014-07-08 06:34:37 +0000
+++ lib/lp/soyuz/tests/test_build_notify.py 2014-07-09 06:38:12 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd. This software is licensed under the
+# Copyright 2011-2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -95,17 +95,16 @@
'main', notification['X-Launchpad-Build-Component'])
self.assertEquals(
build.status.name, notification['X-Launchpad-Build-State'])
- if ppa is True:
+ self.assertEquals(
+ build.archive.reference, notification['X-Launchpad-Archive'])
+ if ppa and build.archive.distribution.name == u'ubuntu':
self.assertEquals(
get_ppa_reference(self.ppa), notification['X-Launchpad-PPA'])
body = notification.get_payload(decode=True)
build_log = 'None'
- if ppa is True:
- archive = '%s PPA' % get_ppa_reference(build.archive)
+ if ppa:
source = 'not available'
else:
- archive = '%s primary archive' % (
- self.distroseries.distribution.name)
source = canonical_url(build.distributionsourcepackagerelease)
builder = canonical_url(build.builder)
if build.status == BuildStatus.BUILDING:
@@ -147,8 +146,8 @@
""" % (
build.source_package_release.sourcepackagename.name,
build.source_package_release.version, self.das.architecturetag,
- archive, build.status.title, duration, build_log, builder,
- source, build.title, canonical_url(build)))
+ build.archive.reference, build.status.title, duration, build_log,
+ builder, source, build.title, canonical_url(build)))
self.assertEquals(expected_body, body)
def test_notify_buildd_admins(self):
Follow ups