Merge lp:~codyshepherd/livecd-rootfs/ubuntu-core-dev-snaps-manifest into lp:~ubuntu-core-dev/livecd-rootfs/cosmic-proposed

Proposed by Cody Shepherd
Status: Merged
Merged at revision: 1708
Proposed branch: lp:~codyshepherd/livecd-rootfs/ubuntu-core-dev-snaps-manifest
Merge into: lp:~ubuntu-core-dev/livecd-rootfs/cosmic-proposed
Diff against target: 116 lines (+39/-20)
4 files modified
debian/changelog (+7/-0)
live-build/auto/build (+1/-1)
live-build/functions (+1/-1)
live-build/snap-seed-parse.py (+30/-18)
To merge this branch: bzr merge lp:~codyshepherd/livecd-rootfs/ubuntu-core-dev-snaps-manifest
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+358726@code.launchpad.net

Commit message

Changes to include snaps in manifest.

Description of the change

Changes to include snaps in manifest.

To post a comment you must log in.
1709. By Cody Shepherd

Fixing version number in changelog.

Revision history for this message
Steve Langasek (vorlon) wrote :

How are you creating debian/changelog? You should be using the 'dch' command, and you should set 'DEBCHANGE_RELEASE_HEURISTIC=changelog' in ~/.devscripts.

Also in this case this is an incremental change to the feature which has not yet landed in the archive, so I think an additional changelog entry is not needed at all.

Fixing up as part of the merge.

review: Approve

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 2018-10-29 17:52:49 +0000
3+++ debian/changelog 2018-11-13 18:55:57 +0000
4@@ -1,3 +1,10 @@
5+livecd-rootfs (2.542.2) UNRELEASED; urgency=medium
6+
7+ * Fix snap-seed-parse to take filename argument instead of printing to
8+ stdout
9+
10+ -- Cody Shepherd <cody.shepherd@canonical.com> Tue, 13 Nov 2018 10:44:19 -0700
11+
12 livecd-rootfs (2.542.1) UNRELEASED; urgency=medium
13
14 * Ensure pre-seeded snaps are now published in the image manifests.
15
16=== modified file 'live-build/auto/build'
17--- live-build/auto/build 2018-10-23 17:32:52 +0000
18+++ live-build/auto/build 2018-11-13 18:55:57 +0000
19@@ -551,7 +551,7 @@
20
21 # '--initramfs none' produces different manifest names.
22 if [ -e "binary/$INITFS/filesystem.packages" ]; then
23- ./config/snap-seed-parse "chroot/" >> "binary/${INITFS}/filesystem.packages"
24+ ./config/snap-seed-parse "chroot/" "binary/${INITFS}/filesystem.packages"
25 ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest"
26 chmod 644 "$PREFIX.manifest"
27 fi
28
29=== modified file 'live-build/functions'
30--- live-build/functions 2018-10-23 17:32:52 +0000
31+++ live-build/functions 2018-11-13 18:55:57 +0000
32@@ -49,7 +49,7 @@
33 echo "create_manifest chroot_root: ${chroot_root}"
34 dpkg-query --show --admindir="${chroot_root}/var/lib/dpkg" > ${target_file}
35 echo "create_manifest call to dpkg-query finished."
36- ./config/snap-seed-parse "${chroot_root}" >> ${target_file}
37+ ./config/snap-seed-parse "${chroot_root}" "${target_file}"
38 echo "create_manifest call to snap_seed_parse finished."
39 echo "create_manifest finished"
40 }
41
42=== modified file 'live-build/snap-seed-parse.py'
43--- live-build/snap-seed-parse.py 2018-10-22 17:21:50 +0000
44+++ live-build/snap-seed-parse.py 2018-11-13 18:55:57 +0000
45@@ -1,26 +1,35 @@
46 #!/usr/bin/python3
47
48 """
49-Usage: snap-seed-parse ${chroot_dir} > somefile.manifest
50+Usage: snap-seed-parse [${chroot_dir}] <output file>
51
52 This script looks for a seed.yaml path in the given root directory, parsing
53-it and printing generated manifest lines to stdout for easy redirection.
54+it and appending the parsed lines to the given output file.
55+
56+The $chroot_dir argument is optional and will default to the empty string.
57 """
58
59+import argparse
60+import os.path
61 import re
62-import sys
63 import yaml
64-import os.path
65
66
67 def log(msg):
68- sys.stderr.write("snap-seed-parse: {}\n".format(msg))
69+ print("snap-seed-parse: {}".format(msg))
70
71
72 log("Parsing seed.yaml")
73
74-CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 and len(sys.argv[1]) > 0 \
75- else ''
76+parser = argparse.ArgumentParser()
77+parser.add_argument('chroot', nargs='?', default='',
78+ help='root dir for the chroot from which to generate the '
79+ 'manifest')
80+parser.add_argument('file', help='Output manifest to this file')
81+
82+ARGS = parser.parse_args()
83+CHROOT_ROOT = ARGS.chroot
84+FNAME = ARGS.file
85
86 # Trim any trailing slashes for correct appending
87 log("CHROOT_ROOT: {}".format(CHROOT_ROOT))
88@@ -43,14 +52,17 @@
89 with open(YAML_PATH, 'r') as fh:
90 yaml_lines = yaml.safe_load(fh)['snaps']
91
92-# Loop over dict items, outputting one manifest line from each triplet
93-for item in yaml_lines:
94- filestring = item['file']
95- # Pull the revision number off the file name
96- revision = filestring[filestring.rindex('_')+1:]
97- revision = re.sub(r'[^0-9]', '', revision)
98- print("{}{}\t{}\t{}".format(LINE_PREFIX,
99- item['name'],
100- item['channel'],
101- revision,
102- ))
103+log('Writing manifest to {}'.format(FNAME))
104+
105+with open(FNAME, 'a+') as fh:
106+ for item in yaml_lines:
107+ filestring = item['file']
108+ # Pull the revision number off the file name
109+ revision = filestring[filestring.rindex('_')+1:]
110+ revision = re.sub(r'[^0-9]', '', revision)
111+ fh.write("{}{}\t{}\t{}\n".format(LINE_PREFIX,
112+ item['name'],
113+ item['channel'],
114+ revision,
115+ ))
116+log('Manifest output finished.')

Subscribers

People subscribed via source and target branches