Merge lp:~robru/cupstream2distro/dont-publish-invalid-packagelist into lp:cupstream2distro

Proposed by Robert Bruce Park on 2015-03-04
Status: Merged
Approved by: Łukasz Zemczak on 2015-03-04
Approved revision: 933
Merged at revision: 932
Proposed branch: lp:~robru/cupstream2distro/dont-publish-invalid-packagelist
Merge into: lp:cupstream2distro
Diff against target: 54 lines (+22/-3)
2 files modified
citrain/publisher.py (+11/-3)
tests/unit/test_script_publisher.py (+11/-0)
To merge this branch: bzr merge lp:~robru/cupstream2distro/dont-publish-invalid-packagelist
Reviewer Review Type Date Requested Status
Łukasz Zemczak 2015-03-04 Approve on 2015-03-04
PS Jenkins bot continuous-integration Approve on 2015-03-04
Review via email: mp+251789@code.launchpad.net

Commit Message

Raise a PublishError in PackageList.publish_source().

Description of the Change

I've seen this problem a couple times now where the publish job succeeds but the dest package version field is missing, so copy2distro refuses to copy, but no indication is given to the user anywhere. In a later branch I'll fix this problem from happening, but at least for now we need the publish job to fail loudly if it's generating an invalid packagelist.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:933
http://jenkins.qa.ubuntu.com/job/cu2d-choo-choo-ci/577/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/cu2d-choo-choo-ci/577/rebuild

review: Approve (continuous-integration)
Łukasz Zemczak (sil2100) wrote :

Ok, I'm normally not +1 on hiding issues with quick-fixes, but sometimes when the bug is critical enough this makes sense. And I believe that you won't forget getting the root cause fixed ;) The workaround looks fine - and, come to think of it, it might help us with identifying any other possible issues with the rsync file! Besides, this makes sense as it's basically proper error-handling.

Anyway, thanks and +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'citrain/publisher.py'
2--- citrain/publisher.py 2015-03-03 09:45:08 +0000
3+++ citrain/publisher.py 2015-03-04 17:54:17 +0000
4@@ -108,9 +108,12 @@
5 self.silo = env.SILONAME.split('/')[-1]
6
7 def publish_source(self, source):
8- """Publish one source package."""
9+ """Publish one source package.
10+
11+ :param source: A launchpadlib source package object.
12+ :raises: PublishError if any necessary data is missing."""
13 name = source.source_package_name
14- self.lines.append(self.TEMPLATE.format(
15+ line = self.TEMPLATE.format(
16 src_ppa='ci-train-ppa-service/' + env.SILONAME,
17 src_pocket=source.pocket,
18 src_series=env.SERIES,
19@@ -121,7 +124,12 @@
20 version_in_dest=DotProject(name).dest_current_version,
21 publisher_nick=env.PUBLISHER,
22 target_distribution=env.DISTRO,
23- ))
24+ )
25+ if '\t\t' in line:
26+ raise PublishError(
27+ 'Critical data missing from packagelist. '
28+ 'Perhaps try a WATCH_ONLY build.')
29+ self.lines.append(line)
30
31 def write(self):
32 filename = self.FILENAME_FORMAT.format(self.silo, env.SERIES)
33
34=== modified file 'tests/unit/test_script_publisher.py'
35--- tests/unit/test_script_publisher.py 2015-03-03 09:45:08 +0000
36+++ tests/unit/test_script_publisher.py 2015-03-04 17:54:17 +0000
37@@ -121,6 +121,17 @@
38 'ci-train-ppa-service/ubuntu/landing-789\tRelease\tvivid'
39 '\tProposed\tvivid\tbar\t2.0-0ubuntu1\t0.9\trobru\tubuntu\n'])
40
41+ def test_packagelist_publish_source_validation(self):
42+ """Publishing is halted when packagelist is invalid."""
43+ self.script.DotProject.return_value.dest_current_version = ''
44+ env.PUBLISHER = 'robru'
45+ packagelist = self.script.PackageList()
46+ source = SourceFake(
47+ 'foo', '1.0-0ubuntu1',
48+ 'https://api.launchpad.net/devel/ubuntu/vivid')
49+ with self.assertRaisesRegexp(PublishError, 'data missing'):
50+ packagelist.publish_source(source)
51+
52 def test_packagelist_write(self):
53 """Ensure we can correctly write the packagelist to disk."""
54 packagelist = self.script.PackageList()

Subscribers

People subscribed via source and target branches