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
=== modified file 'debian/changelog'
--- debian/changelog 2016-08-08 10:02:43 +0000
+++ debian/changelog 2016-08-30 12:53:37 +0000
@@ -2,6 +2,7 @@
22
3 * buildsnap: Catch urllib2.URLError as well as urllib2.HTTPError when3 * buildsnap: Catch urllib2.URLError as well as urllib2.HTTPError when
4 trying to revoke the proxy token (LP: #1610916).4 trying to revoke the proxy token (LP: #1610916).
5 * lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).
56
6 -- Colin Watson <cjwatson@ubuntu.com> Thu, 07 Jul 2016 11:07:49 +01007 -- Colin Watson <cjwatson@ubuntu.com> Thu, 07 Jul 2016 11:07:49 +0100
78
89
=== modified file 'lpbuildd/snap.py'
--- lpbuildd/snap.py 2016-02-04 01:14:40 +0000
+++ lpbuildd/snap.py 2016-08-30 12:53:37 +0000
@@ -1,4 +1,4 @@
1# Copyright 2015 Canonical Ltd. This software is licensed under the1# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4__metaclass__ = type4__metaclass__ = type
@@ -101,5 +101,7 @@
101 return101 return
102 for entry in sorted(os.listdir(output_path)):102 for entry in sorted(os.listdir(output_path)):
103 path = os.path.join(output_path, entry)103 path = os.path.join(output_path, entry)
104 if entry.endswith(".snap") and not os.path.islink(path):104 if os.path.islink(path):
105 continue
106 if entry.endswith(".snap") or entry.endswith(".manifest"):
105 self._slave.addWaitingFile(path)107 self._slave.addWaitingFile(path)
106108
=== modified file 'lpbuildd/tests/test_snap.py'
--- lpbuildd/tests/test_snap.py 2015-10-05 23:28:22 +0000
+++ lpbuildd/tests/test_snap.py 2016-08-30 12:53:37 +0000
@@ -1,4 +1,4 @@
1# Copyright 2015 Canonical Ltd. This software is licensed under the1# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4__metaclass__ = type4__metaclass__ = type
@@ -119,3 +119,47 @@
119 self.assertEqual(119 self.assertEqual(
120 self.buildmanager.iterate, self.buildmanager.iterators[-1])120 self.buildmanager.iterate, self.buildmanager.iterators[-1])
121 self.assertFalse(self.slave.wasCalled("buildFail"))121 self.assertFalse(self.slave.wasCalled("buildFail"))
122
123 def test_iterate_with_manifest(self):
124 # The build manager iterates a build that uploads a manifest from
125 # start to finish.
126 self.startBuild()
127
128 log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
129 log = open(log_path, "w")
130 log.write("I am a build log.")
131 log.close()
132
133 output_dir = os.path.join(self.build_dir, "test-snap")
134 os.makedirs(output_dir)
135 snap_path = os.path.join(output_dir, "test-snap_0_all.snap")
136 with open(snap_path, "w") as snap:
137 snap.write("I am a snap package.")
138 manifest_path = os.path.join(output_dir, "test-snap_0_all.manifest")
139 with open(manifest_path, "w") as manifest:
140 manifest.write("I am a manifest.")
141
142 # After building the package, reap processes.
143 self.buildmanager.iterate(0)
144 expected_command = [
145 "sharepath/slavebin/scan-for-processes", "scan-for-processes",
146 self.buildid,
147 ]
148 self.assertEqual(SnapBuildState.BUILD_SNAP, self.getState())
149 self.assertEqual(expected_command, self.buildmanager.commands[-1])
150 self.assertNotEqual(
151 self.buildmanager.iterate, self.buildmanager.iterators[-1])
152 self.assertFalse(self.slave.wasCalled("buildFail"))
153 self.assertEqual(
154 [((manifest_path,), {}), ((snap_path,), {})],
155 self.slave.addWaitingFile.calls)
156
157 # Control returns to the DebianBuildManager in the UMOUNT state.
158 self.buildmanager.iterateReap(self.getState(), 0)
159 expected_command = [
160 "sharepath/slavebin/umount-chroot", "umount-chroot", self.buildid]
161 self.assertEqual(SnapBuildState.UMOUNT, self.getState())
162 self.assertEqual(expected_command, self.buildmanager.commands[-1])
163 self.assertEqual(
164 self.buildmanager.iterate, self.buildmanager.iterators[-1])
165 self.assertFalse(self.slave.wasCalled("buildFail"))

Subscribers

People subscribed via source and target branches

to all changes: