Merge lp:~robru/cupstream2distro/monkeypatch-lazr into lp:cupstream2distro

Proposed by Robert Bruce Park on 2015-09-02
Status: Merged
Approved by: Robert Bruce Park on 2015-09-02
Approved revision: 1078
Merged at revision: 1070
Proposed branch: lp:~robru/cupstream2distro/monkeypatch-lazr
Merge into: lp:cupstream2distro
Diff against target: 101 lines (+57/-8)
2 files modified
citrain/recipes/base.py (+32/-7)
tests/unit/test_recipe_base.py (+25/-1)
To merge this branch: bzr merge lp:~robru/cupstream2distro/monkeypatch-lazr
Reviewer Review Type Date Requested Status
Steve Langasek 2015-09-02 Approve on 2015-09-02
PS Jenkins bot continuous-integration Approve on 2015-09-02
Review via email: mp+269988@code.launchpad.net

Commit Message

Workaround heinous lazr+lplib horribleness.

To post a comment you must log in.
1078. By Robert Bruce Park on 2015-09-02

Add bug reference to comment.

PS Jenkins bot (ps-jenkins) wrote :

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

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

review: Approve (continuous-integration)
Steve Langasek (vorlon) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'citrain/recipes/base.py'
2--- citrain/recipes/base.py 2015-09-02 03:52:33 +0000
3+++ citrain/recipes/base.py 2015-09-02 21:34:27 +0000
4@@ -58,6 +58,22 @@
5 )
6
7
8+# FIXME: this needs to be fixed upstream. Workaround for this traceback:
9+# File "citrain/recipes/base.py", line 282, in checkupload_phase
10+# exact_match=True)[0]
11+# File "lazr/restfulclient/resource.py", line 853, in __getitem__
12+# found_slice = self._get_slice(slice(key, key + 1))
13+# File "lazr/restfulclient/resource.py", line 903, in _get_slice
14+# self._wadl_resource.url, 'ws.start', start)
15+# File "lazr/restfulclient/resource.py", line 976, in _with_url_query_...
16+# uri.query = urllib.urlencode(params, True)
17+# AttributeError: 'module' object has no attribute 'urlencode'
18+# https://bugs.launchpad.net/launchpad/+bug/821366
19+from urllib.parse import urlencode
20+from lazr.restfulclient import resource
21+resource.urllib.urlencode = urlencode
22+
23+
24 # This defines packages which must be uploaded together in pairs, or 'twins'.
25 TWINS = {
26 'qt3d-opensource-src': 'qt3d-opensource-src-gles',
27@@ -279,14 +295,23 @@
28 source_name=self.name,
29 status='Published',
30 pocket='Release',
31- exact_match=True)[0]
32+ exact_match=True)
33+ # In the event this source package is NEW, checkUpload fails horribly,
34+ # so we must substitute flashplugin-nonfree/universe as defaults in
35+ # order to confirm the publisher has legit upload rights for something.
36+ kwargs = dict(
37+ distroseries=self.series,
38+ sourcepackagename='flashplugin-nonfree',
39+ component='universe',
40+ pocket='Proposed',
41+ person=self.blame)
42+ if sourcepub:
43+ kwargs.update(
44+ component=sourcepub[0].component_name,
45+ sourcepackagename=self.name)
46+ log_value_of.kwargs('self.dest.checkUpload')
47 try:
48- self.dest.checkUpload(
49- component=sourcepub.component_name,
50- sourcepackagename=self.name,
51- distroseries=self.series,
52- pocket='Proposed',
53- person=self.blame)
54+ self.dest.checkUpload(**kwargs)
55 self.authorized = True
56 except ClientError:
57 self.authorized = False
58
59=== modified file 'tests/unit/test_recipe_base.py'
60--- tests/unit/test_recipe_base.py 2015-09-02 03:32:52 +0000
61+++ tests/unit/test_recipe_base.py 2015-09-02 21:34:27 +0000
62@@ -443,6 +443,30 @@
63 self.assertTrue(build.authorized)
64
65 @patch('citrain.recipes.base.lp')
66+ def test_buildbase_checkupload_phase_NEW(self, lp_mock):
67+ """Ensure that we call checkupload correctly for NEW packages."""
68+ robru = Mock()
69+ env.BUILD_USER_ID = 'robru'
70+ lp_mock.people = dict(robru=robru)
71+ build = BuildBase('qt', self.series, self.dest, self.ppa)
72+ build.blame = robru
73+ build.dest.getPublishedSources.return_value = None
74+ build.checkupload_phase()
75+ build.dest.getPublishedSources.assert_called_once_with(
76+ distro_series=self.series,
77+ status='Published',
78+ pocket='Release',
79+ exact_match=True,
80+ source_name='qt')
81+ build.dest.checkUpload.assert_called_once_with(
82+ component='universe',
83+ distroseries=self.series,
84+ sourcepackagename='flashplugin-nonfree',
85+ pocket='Proposed',
86+ person=robru)
87+ self.assertTrue(build.authorized)
88+
89+ @patch('citrain.recipes.base.lp')
90 def test_buildbase_checkupload_phase_failed(self, lp_mock):
91 """Ensure that we report invalid upload rights."""
92 src = Mock()
93@@ -474,7 +498,7 @@
94
95 @patch('citrain.recipes.base.exists', Mock(return_value=True))
96 def test_buildbase_ackaging_phase_authorized_unauthorized(self):
97- """Ensure that authorized people can ACK."""
98+ """Ensure that unauthorized people can't ACK."""
99 env.ACK_PACKAGING = 'true'
100 build = BuildBase('qt', self.series, self.dest, self.ppa)
101 build.authorized = False

Subscribers

People subscribed via source and target branches