launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20930
[Merge] lp:~cjwatson/launchpad-buildd/snap-upload-manifest into lp:launchpad-buildd
Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/snap-upload-manifest into lp:launchpad-buildd.
Commit message:
lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1608432 in launchpad-buildd: "snaps with type: os should allow publishing of .manifest files"
https://bugs.launchpad.net/launchpad-buildd/+bug/1608432
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/snap-upload-manifest/+merge/304373
lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/snap-upload-manifest into lp:launchpad-buildd.
=== 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 @@
* buildsnap: Catch urllib2.URLError as well as urllib2.HTTPError when
trying to revoke the proxy token (LP: #1610916).
+ * lpbuildd.snap: Upload *.manifest files as well as *.snap (LP: #1608432).
-- Colin Watson <cjwatson@xxxxxxxxxx> Thu, 07 Jul 2016 11:07:49 +0100
=== 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 @@
-# Copyright 2015 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -101,5 +101,7 @@
return
for entry in sorted(os.listdir(output_path)):
path = os.path.join(output_path, entry)
- if entry.endswith(".snap") and not os.path.islink(path):
+ if os.path.islink(path):
+ continue
+ if entry.endswith(".snap") or entry.endswith(".manifest"):
self._slave.addWaitingFile(path)
=== 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 @@
-# Copyright 2015 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -119,3 +119,47 @@
self.assertEqual(
self.buildmanager.iterate, self.buildmanager.iterators[-1])
self.assertFalse(self.slave.wasCalled("buildFail"))
+
+ def test_iterate_with_manifest(self):
+ # The build manager iterates a build that uploads a manifest from
+ # start to finish.
+ self.startBuild()
+
+ log_path = os.path.join(self.buildmanager._cachepath, "buildlog")
+ log = open(log_path, "w")
+ log.write("I am a build log.")
+ log.close()
+
+ output_dir = os.path.join(self.build_dir, "test-snap")
+ os.makedirs(output_dir)
+ snap_path = os.path.join(output_dir, "test-snap_0_all.snap")
+ with open(snap_path, "w") as snap:
+ snap.write("I am a snap package.")
+ manifest_path = os.path.join(output_dir, "test-snap_0_all.manifest")
+ with open(manifest_path, "w") as manifest:
+ manifest.write("I am a manifest.")
+
+ # After building the package, reap processes.
+ self.buildmanager.iterate(0)
+ expected_command = [
+ "sharepath/slavebin/scan-for-processes", "scan-for-processes",
+ self.buildid,
+ ]
+ self.assertEqual(SnapBuildState.BUILD_SNAP, self.getState())
+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
+ self.assertNotEqual(
+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
+ self.assertFalse(self.slave.wasCalled("buildFail"))
+ self.assertEqual(
+ [((manifest_path,), {}), ((snap_path,), {})],
+ self.slave.addWaitingFile.calls)
+
+ # Control returns to the DebianBuildManager in the UMOUNT state.
+ self.buildmanager.iterateReap(self.getState(), 0)
+ expected_command = [
+ "sharepath/slavebin/umount-chroot", "umount-chroot", self.buildid]
+ self.assertEqual(SnapBuildState.UMOUNT, self.getState())
+ self.assertEqual(expected_command, self.buildmanager.commands[-1])
+ self.assertEqual(
+ self.buildmanager.iterate, self.buildmanager.iterators[-1])
+ self.assertFalse(self.slave.wasCalled("buildFail"))