Merge lp:~cjwatson/launchpad-buildd/snap-upload-manifest into lp:launchpad-buildd

Proposed by Colin Watson
Status: Merged
Merged at revision: 202
Proposed branch: lp:~cjwatson/launchpad-buildd/snap-upload-manifest
Merge into: lp:launchpad-buildd
Diff against target: 88 lines (+50/-3)
3 files modified
debian/changelog (+1/-0)
lpbuildd/snap.py (+4/-2)
lpbuildd/tests/test_snap.py (+45/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad-buildd/snap-upload-manifest
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+304373@code.launchpad.net

Commit message

lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).

Description of the change

lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-08-08 10:02:43 +0000
3+++ debian/changelog 2016-08-30 12:53:37 +0000
4@@ -2,6 +2,7 @@
5
6 * buildsnap: Catch urllib2.URLError as well as urllib2.HTTPError when
7 trying to revoke the proxy token (LP: #1610916).
8+ * lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).
9
10 -- Colin Watson <cjwatson@ubuntu.com> Thu, 07 Jul 2016 11:07:49 +0100
11
12
13=== modified file 'lpbuildd/snap.py'
14--- lpbuildd/snap.py 2016-02-04 01:14:40 +0000
15+++ lpbuildd/snap.py 2016-08-30 12:53:37 +0000
16@@ -1,4 +1,4 @@
17-# Copyright 2015 Canonical Ltd. This software is licensed under the
18+# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
19 # GNU Affero General Public License version 3 (see the file LICENSE).
20
21 __metaclass__ = type
22@@ -101,5 +101,7 @@
23 return
24 for entry in sorted(os.listdir(output_path)):
25 path = os.path.join(output_path, entry)
26- if entry.endswith(".snap") and not os.path.islink(path):
27+ if os.path.islink(path):
28+ continue
29+ if entry.endswith(".snap") or entry.endswith(".manifest"):
30 self._slave.addWaitingFile(path)
31
32=== modified file 'lpbuildd/tests/test_snap.py'
33--- lpbuildd/tests/test_snap.py 2015-10-05 23:28:22 +0000
34+++ lpbuildd/tests/test_snap.py 2016-08-30 12:53:37 +0000
35@@ -1,4 +1,4 @@
36-# Copyright 2015 Canonical Ltd. This software is licensed under the
37+# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
38 # GNU Affero General Public License version 3 (see the file LICENSE).
39
40 __metaclass__ = type
41@@ -119,3 +119,47 @@
42 self.assertEqual(
43 self.buildmanager.iterate, self.buildmanager.iterators[-1])
44 self.assertFalse(self.slave.wasCalled("buildFail"))
45+
46+ def test_iterate_with_manifest(self):
47+ # The build manager iterates a build that uploads a manifest from
48+ # start to finish.
49+ self.startBuild()
50+
51+ log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
52+ log = open(log_path, "w")
53+ log.write("I am a build log.")
54+ log.close()
55+
56+ output_dir = os.path.join(self.build_dir, "test-snap")
57+ os.makedirs(output_dir)
58+ snap_path = os.path.join(output_dir, "test-snap_0_all.snap")
59+ with open(snap_path, "w") as snap:
60+ snap.write("I am a snap package.")
61+ manifest_path = os.path.join(output_dir, "test-snap_0_all.manifest")
62+ with open(manifest_path, "w") as manifest:
63+ manifest.write("I am a manifest.")
64+
65+ # After building the package, reap processes.
66+ self.buildmanager.iterate(0)
67+ expected_command = [
68+ "sharepath/slavebin/scan-for-processes", "scan-for-processes",
69+ self.buildid,
70+ ]
71+ self.assertEqual(SnapBuildState.BUILD_SNAP, self.getState())
72+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
73+ self.assertNotEqual(
74+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
75+ self.assertFalse(self.slave.wasCalled("buildFail"))
76+ self.assertEqual(
77+ [((manifest_path,), {}), ((snap_path,), {})],
78+ self.slave.addWaitingFile.calls)
79+
80+ # Control returns to the DebianBuildManager in the UMOUNT state.
81+ self.buildmanager.iterateReap(self.getState(), 0)
82+ expected_command = [
83+ "sharepath/slavebin/umount-chroot", "umount-chroot", self.buildid]
84+ self.assertEqual(SnapBuildState.UMOUNT, self.getState())
85+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
86+ self.assertEqual(
87+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
88+ self.assertFalse(self.slave.wasCalled("buildFail"))

Subscribers

People subscribed via source and target branches

to all changes: