Merge lp:~smoser/maas-images/manifests into lp:maas-images

Proposed by Scott Moser
Status: Merged
Merged at revision: 247
Proposed branch: lp:~smoser/maas-images/manifests
Merge into: lp:maas-images
Diff against target: 140 lines (+30/-14)
3 files modified
bin/fake-maas-cloudimg2eph2 (+19/-11)
bin/maas-cloudimg2eph2 (+6/-1)
meph2/commands/cloudimg_sync.py (+5/-2)
To merge this branch: bzr merge lp:~smoser/maas-images/manifests
Reviewer Review Type Date Requested Status
maintainers of maas images Pending
Review via email: mp+276909@code.launchpad.net

Commit message

Add manifest files for root-image.gz

This adds manifest files similar to cloud image manifests.
These are nice to have, and also will help in testing things later
as we have some changes coming where we'll want to easily compare image contents.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/fake-maas-cloudimg2eph2'
2--- bin/fake-maas-cloudimg2eph2 2015-02-13 21:20:35 +0000
3+++ bin/fake-maas-cloudimg2eph2 2015-11-06 21:12:31 +0000
4@@ -4,7 +4,7 @@
5 error() { echo "$@" 1>&2; }
6
7 short_opts="a:k:p:v"
8-long_opts="arch:,kernel:,krd-pack:,verbose"
9+long_opts="arch:,kernel:,krd-pack:,manifest:,verbose"
10 getopt_out=$(getopt --name "${0##*/}" \
11 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
12 eval set -- "${getopt_out}" ||
13@@ -13,18 +13,20 @@
14 gzip=true
15 arch=""
16 kernel=""
17+manif=""
18 kpacks=( )
19 while [ $# -ne 0 ]; do
20- cur=$1
21- next=$2
22- case "$cur" in
23- -a|--arch) arch="$next"; shift;;
24- -k|--kernel) kernel=$next; shift;;
25- -p|--krd-pack) kpacks[${#kpacks[@]}]=$next; shift;;
26- --no-gzip) gzip=false;;
27- --) shift; break;;
28- esac
29- shift;
30+ cur=$1
31+ next=$2
32+ case "$cur" in
33+ -a|--arch) arch="$next"; shift;;
34+ -k|--kernel) kernel=$next; shift;;
35+ -p|--krd-pack) kpacks[${#kpacks[@]}]=$next; shift;;
36+ --manifest) manif="$next"; shift;;
37+ --no-gzip) gzip=false;;
38+ --) shift; break;;
39+ esac
40+ shift;
41 done
42
43 src=$1
44@@ -37,6 +39,12 @@
45
46 error "src=$src arch=$arch kernel=$kernel output=$root_gz"
47 dd if=/dev/zero bs=1024 count=1024 2>/dev/null | $gzip_prog > "$root_gz"
48+if [ -n "$manif" ]; then
49+ npkg=10
50+ for((i=0;i<$npkg;i++)); do
51+ printf "bogus-package-%02d\t0.$((($npkg-$i)%$npkg))\n" "$i"
52+ done > "$manif"
53+fi
54
55 OIFS="$IFS"
56 for kpack in "${kpacks[@]}"; do
57
58=== modified file 'bin/maas-cloudimg2eph2'
59--- bin/maas-cloudimg2eph2 2015-10-26 19:07:07 +0000
60+++ bin/maas-cloudimg2eph2 2015-11-06 21:12:31 +0000
61@@ -20,6 +20,7 @@
62 -k | --kernel K keep/install the kernel package 'k' inside image
63 -p | --krd-pack P create a kernel / ramdisk pack
64 P is ',' delimited: kernel-name,kernel,ramdisk[,flags]
65+ --manifest M write the dpkg manifest to M
66 -v | --verbose increase verbosity
67
68 Example:
69@@ -309,7 +310,7 @@
70
71 main() {
72 local short_opts="a:hk:p:v"
73- local long_opts="arch:,help,kernel:,krd-pack:,no-gzip,verbose"
74+ local long_opts="arch:,help,kernel:,krd-pack:,manifest:,no-gzip,verbose"
75 local getopt_out=""
76 getopt_out=$(getopt --name "${0##*/}" \
77 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
78@@ -319,6 +320,7 @@
79 local cur="" next="" output="" gzip=true kpkg=""
80 local kpacks="" src_in="" src="" arch="" vflags=""
81 local working_space="1024M" zero_img="true" fs_img_size="1400M"
82+ local manifest_out=""
83 kpacks=( )
84
85 while [ $# -ne 0 ]; do
86@@ -327,6 +329,7 @@
87 -h|--help) Usage ; exit 0;;
88 -a|--arch) arch="$next"; shift;;
89 -k|--kernel) kpkg=$next; shift;;
90+ --manifest) manifest_out="$next";;
91 -p|--krd-pack) kpacks[${#kpacks[@]}]="$next"; shift;;
92 --no-gzip) gzip=false;;
93 -v|--verbose) VERBOSITY=$((${VERBOSITY}+1)); vflags="${vflags}v";;
94@@ -404,6 +407,8 @@
95 ${arch:+"--arch=$arch"} "$imgfile" \
96 "$kpkg" "$pkout" "$piout" "$manif" ||
97 { error "failed to turn $imgfile to ephemeral"; return 1; }
98+ [ -z "$manifest_out" ] || cp "$manif" "$manifest_out" ||
99+ { error "failed copying manifest to $manifest_out"; return 1; }
100
101 local i="" oifs="$IFS"
102 ddebug 1 "starting kpacks: ${kpacks[*]}"
103
104=== modified file 'meph2/commands/cloudimg_sync.py'
105--- meph2/commands/cloudimg_sync.py 2015-09-11 14:15:58 +0000
106+++ meph2/commands/cloudimg_sync.py 2015-11-06 21:12:31 +0000
107@@ -46,6 +46,7 @@
108 DI_COMMON = PATH_COMMON + "di/%(di_version)s/%(krel)s/%(flavor)s"
109 PATH_FORMATS = {
110 'root-image.gz': PATH_COMMON + "%(version_name)s/root-image.gz",
111+ 'manifest': PATH_COMMON + "%(version_name)s/root-image.manifest",
112 'boot-dtb': BOOT_COMMON + "/boot-dtb%(suffix)s",
113 'boot-kernel': BOOT_COMMON + "/boot-kernel%(suffix)s",
114 'boot-initrd': BOOT_COMMON + "/boot-initrd%(suffix)s",
115@@ -259,13 +260,15 @@
116 'version_name': vername, 'version': version}
117
118 rootimg_path = PATH_FORMATS['root-image.gz'] % subs
119+ manifest_path = PATH_FORMATS['manifest'] % subs
120
121 mci2e = os.environ.get('MAAS_CLOUDIMG2EPH2', "maas-cloudimg2eph2")
122 gencmd = ([mci2e] + self.vflags +
123 ["--kernel=%s" % builtin_kernel, "--arch=%s" % arch,
124+ "--manifest=%s" % os.path.join(self.out_d, manifest_path),
125 contentsource.url, os.path.join(self.out_d, rootimg_path)])
126 krd_packs = []
127- newpaths = set((rootimg_path,))
128+ newpaths = set((rootimg_path, manifest_path,))
129
130 kdata_defaults = {'suffix': "", 'di-format': "default", 'dtb': ""}
131
132@@ -301,7 +304,7 @@
133 di_keys = ['di-kernel', 'di-initrd']
134 boot_keys = ['boot-kernel', 'boot-initrd']
135 ikeys = ['boot-kernel', 'boot-initrd', 'di-kernel',
136- 'di-initrd', 'root-image.gz']
137+ 'di-initrd', 'root-image.gz', 'manifest']
138
139 if kdata.get('dtb'):
140 ikeys.append('di-dtb')

Subscribers

People subscribed via source and target branches