Merge lp:~brian-murray/ubuntu-archive-tools/phased-updater-more-emails into lp:ubuntu-archive-tools

Proposed by Brian Murray on 2017-09-12
Status: Merged
Merged at revision: 1119
Proposed branch: lp:~brian-murray/ubuntu-archive-tools/phased-updater-more-emails
Merge into: lp:ubuntu-archive-tools
Diff against target: 115 lines (+39/-23)
1 file modified
phased-updater (+39/-23)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-archive-tools/phased-updater-more-emails
Reviewer Review Type Date Requested Status
Steve Langasek 2017-09-12 Pending
Review via email: mp+330628@code.launchpad.net

Description of the Change

The halted phased-update of plasma-workspace in zesty only sent an email notification to Rik Mills, who sponsored the patch, and not Jose Manuel Santamaria Lema whose work was sponsored. Digging into this I discovered that Jose has a hidden email address and we were not doing a great job of falling back to using the email address that appears in the changes file. This upload fixes that, while testing the upload I discovered that only 3 or 4 SRUs ended up in this situation (where only one person was emailed instead of two).

While I was looking at the code I also fixed a lack of error handling trying to grab the changes file, and dropped some end of life releases.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phased-updater'
2--- phased-updater 2017-06-02 21:57:06 +0000
3+++ phased-updater 2017-09-12 23:25:28 +0000
4@@ -257,26 +257,32 @@
5 logging.info('%s not mailed as they are not a valid LP user' %
6 signer)
7 continue
8- pkg = spph.source_package_name
9- version = spph.source_package_version
10 signer_email = get_primary_email(signer)
11- if not signer_email:
12- signer_name = ''
13- # if we can't determine their email use the changes file
14- changes_file_url = spph.changesFileUrl()
15- # need to handle a 404 here
16+ signer_name = signer.name
17+ # use the changes file as a backup method for determining email addresses
18+ changes_file_url = spph.changesFileUrl()
19+ try:
20 changes_file = urlopen(changes_file_url)
21 for line in changes_file.readlines():
22 line = line.strip()
23 if line.startswith('Changed-By:'):
24 changer = line.lstrip('Changed-By: ').decode('utf-8')
25- signer_name, signer_email = utils.parseaddr(changer.strip())
26+ changer_name, changer_email = utils.parseaddr(changer.strip())
27 break
28- logging.info("Used changes file to find email for %s %s %s" %
29+ except IOError:
30+ pass
31+ creator = spph.package_creator
32+ creator_email = ''
33+ pkg = spph.source_package_name
34+ version = spph.source_package_version
35+ if not signer_email and signer_name == creator.name:
36+ if not changer_email:
37+ logging.info("No contact email found for %s %s %s" %
38+ (rname, pkg, version))
39+ continue
40+ signer_email = changer_email
41+ logging.info("Used changes file to find contact email for %s %s %s" %
42 (rname, pkg, version))
43- else:
44- signer_name = signer.name
45- changer = spph.package_creator
46 if 'buckets' in spph_buckets[rname][spph]:
47 # see if they've been emailed about the bucket before
48 notices = []
49@@ -306,11 +312,13 @@
50 msg['Reply-To'] = bdmurray_mail
51 receivers.append(signer_email)
52 msg['To'] = signer_email
53- if changer != signer and changer.is_valid:
54- changer_email = get_primary_email(changer)
55- if changer_email:
56- receivers.append(changer_email)
57- msg['Cc'] = '%s' % changer_email
58+ if creator != signer and creator.is_valid:
59+ creator_email = get_primary_email(creator)
60+ # fall back to the email found in the changes file
61+ if not creator_email:
62+ creator_email = changer_email
63+ receivers.append(creator_email)
64+ msg['Cc'] = '%s' % changer_email
65 smtp = smtplib.SMTP('localhost')
66 smtp.sendmail(EMAIL_SENDER, receivers,
67 msg.as_string())
68@@ -322,6 +330,10 @@
69 notify_file.write('%s, %s, %s, %s\n' % \
70 (signer_name, bucket,
71 pkg, version))
72+ if changer_email:
73+ notify_file.write('%s, %s, %s, %s\n' % \
74+ (creator.name, bucket,
75+ pkg, version))
76 if 'rate' in spph_buckets[rname][spph]:
77 # see if they have been emailed about the increased rate
78 # for this package version before
79@@ -340,11 +352,12 @@
80 msg['Reply-To'] = bdmurray_mail
81 receivers.append(signer_email)
82 msg['To'] = signer_email
83- if changer != signer and changer.is_valid:
84- changer_email = get_primary_email(changer)
85- if changer_email:
86- receivers.append(changer_email)
87- msg['Cc'] = '%s' % changer_email
88+ if creator != signer and creator.is_valid:
89+ # fall back to the email found in the changes file
90+ if not creator_email:
91+ creator_email = changer_email
92+ receivers.append(creator_email)
93+ msg['Cc'] = '%s' % creator_email
94 smtp = smtplib.SMTP('localhost')
95 smtp.sendmail(EMAIL_SENDER, receivers,
96 msg.as_string())
97@@ -355,6 +368,9 @@
98 with codecs.open(NOTIFICATIONS, 'a', encoding='utf-8') as notify_file:
99 notify_file.write('%s, increased-rate, %s, %s\n' %
100 (signer_name, pkg, version))
101+ if creator_email:
102+ notify_file.write('%s, increased-rate, %s, %s\n' %
103+ (creator.name, pkg, version))
104
105
106 def new_buckets(archive, release, src_pkg, version):
107@@ -579,7 +595,7 @@
108 rvers = release.version
109 issues[rname] = OrderedDict()
110 # XXX - starting with raring
111- if rname in ['lucid', 'precise', 'vivid', 'wily']:
112+ if rname in ['precise', 'vivid']:
113 continue
114 pub_sources = archive.getPublishedSources(
115 created_since_date=cdate,

Subscribers

People subscribed via source and target branches