Merge lp:~sinzui/juju-release-tools/better-binaries into lp:juju-release-tools

Proposed by Curtis Hovey
Status: Merged
Approved by: Martin Packman
Approved revision: 198
Merged at revision: 198
Proposed branch: lp:~sinzui/juju-release-tools/better-binaries
Merge into: lp:juju-release-tools
Diff against target: 33 lines (+2/-6)
2 files modified
build_package.py (+1/-3)
tests/test_build_package.py (+1/-3)
To merge this branch: bzr merge lp:~sinzui/juju-release-tools/better-binaries
Reviewer Review Type Date Requested Status
Martin Packman (community) Approve
Review via email: mp+265704@code.launchpad.net

Description of the change

Wait for package building output.

Aaron noticed that the subprocess call to make the binary packages never called wait(), which explains much of the async out put we see in successful builds. Since we don't care about pipes to the proc, we only want the return code, I switched to subprocess.call() to do what we want.

I had tried to also switch to use the ubuntu-cloud lxc template because precise supports it and machines on our private networks can access cloud-images (unlike the download lxc images). I abandoned the effort because I saw unmet deps in when setting of the build in the container. I think the cloud-images are too unstable for our needs.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Using communicate will always wait, but it doesn't do anything else useful if no pipes are being used. So, this change is good but isn't fixing a glaring error.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build_package.py'
2--- build_package.py 2015-06-24 01:07:32 +0000
3+++ build_package.py 2015-07-23 17:28:06 +0000
4@@ -133,9 +133,7 @@
5 subprocess.check_call(['sudo', 'lxc-start', '-d', '-n', container])
6 try:
7 build_script = BUILD_DEB_TEMPLATE.format(container=container, ppa=ppa)
8- proc = subprocess.Popen([build_script], shell=True)
9- proc.communicate()
10- returncode = proc.returncode
11+ returncode = subprocess.call([build_script], shell=True)
12 finally:
13 subprocess.check_call(['sudo', 'lxc-stop', '-n', container])
14 user = os.environ.get('USER', 'jenkins')
15
16=== modified file 'tests/test_build_package.py'
17--- tests/test_build_package.py 2015-05-22 18:26:55 +0000
18+++ tests/test_build_package.py 2015-07-23 17:28:06 +0000
19@@ -171,13 +171,11 @@
20 source_files = make_source_files(workspace, 'my.dsc')
21 build_dir = setup_local(
22 workspace, 'trusty', 'i386', source_files, verbose=False)
23- proc = Mock(returncode=0)
24- with patch('subprocess.Popen', return_value=proc) as p_mock:
25+ with patch('subprocess.call', return_value=0) as p_mock:
26 code = build_in_lxc('trusty-i386', build_dir,
27 ppa=None, verbose=False)
28 self.assertEqual(0, code)
29 oc_mock.assert_any_call(build_dir, 0o777)
30- proc.communicate.assert_called_with()
31 cc_mock.assert_any_call(
32 ['sudo', 'lxc-start', '-d', '-n', 'trusty-i386'])
33 build_script = BUILD_DEB_TEMPLATE.format(

Subscribers

People subscribed via source and target branches