diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-11-26 12:09:52 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-26 23:01:32 +0000 |
commit | 960e305d9abbbeed0ed2d5251ff94cf1719e5159 (patch) | |
tree | f87d43abb5a24f12b58d73e934ee2bb05456fa75 | |
parent | bbbd6fc1d1342936b583289c6dcaf7b4ea60eb5c (diff) | |
download | poky-960e305d9abbbeed0ed2d5251ff94cf1719e5159.tar.gz |
classes/image: write image manifest
Write a list of installed packages to a .manifest file next to the
image, so we can find out what went into the image after it has been
constructed without necessarily having to have buildhistory enabled
(although that will provide more detail.) We can make use of this for
example in the testimage class associated code that checks for installed
packages for determining whether or not to run specific tests.
Note: this replaces the previous ipk-specific manifest code with
something that works for ipk, rpm and deb, and instead of a pruned
status file, packages are listed one per line, in the following format:
<packagename> <packagearch> <version>
Tests for all three backends have shown that the performance impact of
this change is negligible (about 1.5s max).
Implements [YOCTO #5410]
(From OE-Core rev: 2978d1f2617a33e2e3a77e249d73e998d79b4ec9)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image.bbclass | 15 | ||||
-rw-r--r-- | meta/classes/populate_sdk_deb.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/populate_sdk_ipk.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/populate_sdk_rpm.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 14 | ||||
-rwxr-xr-x | scripts/opkg-query-helper.py | 9 |
6 files changed, 24 insertions, 20 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index bc60f0d6c0..8217fb3254 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -179,6 +179,9 @@ ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; " | |||
179 | ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}' | 179 | ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}' |
180 | # Enable postinst logging if debug-tweaks is enabled | 180 | # Enable postinst logging if debug-tweaks is enabled |
181 | ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}' | 181 | ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "postinst_enable_logging; ", "",d)}' |
182 | # Write manifest | ||
183 | IMAGE_MANIFEST = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest" | ||
184 | ROOTFS_POSTPROCESS_COMMAND =+ "write_image_manifest ; " | ||
182 | # Set default postinst log file | 185 | # Set default postinst log file |
183 | POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" | 186 | POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log" |
184 | 187 | ||
@@ -381,6 +384,11 @@ fakeroot do_rootfs () { | |||
381 | ${IMAGE_POSTPROCESS_COMMAND} | 384 | ${IMAGE_POSTPROCESS_COMMAND} |
382 | 385 | ||
383 | ${MACHINE_POSTPROCESS_COMMAND} | 386 | ${MACHINE_POSTPROCESS_COMMAND} |
387 | |||
388 | if [ -n "${IMAGE_LINK_NAME}" -a -f "${IMAGE_MANIFEST}" ]; then | ||
389 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | ||
390 | ln -s ${IMAGE_NAME}.rootfs.manifest ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | ||
391 | fi | ||
384 | } | 392 | } |
385 | 393 | ||
386 | insert_feed_uris () { | 394 | insert_feed_uris () { |
@@ -602,12 +610,7 @@ make_zimage_symlink_relative () { | |||
602 | } | 610 | } |
603 | 611 | ||
604 | write_image_manifest () { | 612 | write_image_manifest () { |
605 | rootfs_${IMAGE_PKGTYPE}_write_manifest | 613 | list_installed_packages ver | sort > ${IMAGE_MANIFEST} |
606 | |||
607 | if [ -n "${IMAGE_LINK_NAME}" ]; then | ||
608 | rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | ||
609 | ln -s ${IMAGE_NAME}.rootfs.manifest ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest | ||
610 | fi | ||
611 | } | 614 | } |
612 | 615 | ||
613 | # Make login manager(s) enable automatic login. | 616 | # Make login manager(s) enable automatic login. |
diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass index ebb842ba86..a63280d1ef 100644 --- a/meta/classes/populate_sdk_deb.bbclass +++ b/meta/classes/populate_sdk_deb.bbclass | |||
@@ -84,6 +84,8 @@ list_installed_packages() { | |||
84 | echo "$pkg $fullpath $pkgarch" | 84 | echo "$pkg $fullpath $pkgarch" |
85 | fi | 85 | fi |
86 | done | 86 | done |
87 | elif [ "$1" = "ver" ] ; then | ||
88 | ${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch} ${Version}\n' | ||
87 | else | 89 | else |
88 | ${DPKG_QUERY_COMMAND} -W -f='${Package}\n' | 90 | ${DPKG_QUERY_COMMAND} -W -f='${Package}\n' |
89 | fi | 91 | fi |
diff --git a/meta/classes/populate_sdk_ipk.bbclass b/meta/classes/populate_sdk_ipk.bbclass index 04c71af42e..fc6ed536a8 100644 --- a/meta/classes/populate_sdk_ipk.bbclass +++ b/meta/classes/populate_sdk_ipk.bbclass | |||
@@ -70,6 +70,8 @@ list_installed_packages() { | |||
70 | echo "$pkg $fullpath $pkgarch" | 70 | echo "$pkg $fullpath $pkgarch" |
71 | fi | 71 | fi |
72 | done | 72 | done |
73 | elif [ "$1" = "ver" ] ; then | ||
74 | opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -v | ||
73 | else | 75 | else |
74 | opkg-cl ${OPKG_ARGS} list_installed | awk '{ print $1 }' | 76 | opkg-cl ${OPKG_ARGS} list_installed | awk '{ print $1 }' |
75 | fi | 77 | fi |
diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass index b0105931a1..67cccafe4c 100644 --- a/meta/classes/populate_sdk_rpm.bbclass +++ b/meta/classes/populate_sdk_rpm.bbclass | |||
@@ -162,6 +162,8 @@ list_installed_packages() { | |||
162 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch | 162 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch |
163 | elif [ "$1" = "file" ]; then | 163 | elif [ "$1" = "file" ]; then |
164 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe file | 164 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe file |
165 | elif [ "$1" = "ver" ]; then | ||
166 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{VERSION}\n]" | translate_smart_to_oe arch | ||
165 | else | 167 | else |
166 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe | 168 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe |
167 | fi | 169 | fi |
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index 6ce3e5d908..dbe1c798a6 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass | |||
@@ -118,20 +118,6 @@ save_postinsts () { | |||
118 | done | 118 | done |
119 | } | 119 | } |
120 | 120 | ||
121 | rootfs_ipk_write_manifest() { | ||
122 | manifest=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.manifest | ||
123 | cp ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/status $manifest | ||
124 | |||
125 | sed '/Depends/d' -i $manifest | ||
126 | sed '/Status/d' -i $manifest | ||
127 | sed '/Architecture/d' -i $manifest | ||
128 | sed '/Installed-Time/d' -i $manifest | ||
129 | sed '/Auto-Installed/d' -i $manifest | ||
130 | sed '/Recommends/d' -i $manifest | ||
131 | sed '/Provides/d' -i $manifest | ||
132 | sed '/Conflicts/d' -i $manifest | ||
133 | } | ||
134 | |||
135 | remove_packaging_data_files() { | 121 | remove_packaging_data_files() { |
136 | rm -rf ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg | 122 | rm -rf ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg |
137 | # We need the directory for the package manager lock | 123 | # We need the directory for the package manager lock |
diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py index fa6c44fa8b..2fb1a78970 100755 --- a/scripts/opkg-query-helper.py +++ b/scripts/opkg-query-helper.py | |||
@@ -28,6 +28,7 @@ import re | |||
28 | 28 | ||
29 | archmode = False | 29 | archmode = False |
30 | filemode = False | 30 | filemode = False |
31 | vermode = False | ||
31 | 32 | ||
32 | args = [] | 33 | args = [] |
33 | for arg in sys.argv[1:]: | 34 | for arg in sys.argv[1:]: |
@@ -35,6 +36,8 @@ for arg in sys.argv[1:]: | |||
35 | archmode = True | 36 | archmode = True |
36 | elif arg == '-f': | 37 | elif arg == '-f': |
37 | filemode = True | 38 | filemode = True |
39 | elif arg == '-v': | ||
40 | vermode = True | ||
38 | else: | 41 | else: |
39 | args.append(arg) | 42 | args.append(arg) |
40 | 43 | ||
@@ -60,6 +63,12 @@ for line in fileinput.input(args): | |||
60 | elif line.startswith("Architecture:"): | 63 | elif line.startswith("Architecture:"): |
61 | arch = line.split(": ")[1] | 64 | arch = line.split(": ")[1] |
62 | print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch)) | 65 | print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch)) |
66 | elif vermode: | ||
67 | if line.startswith("Version:"): | ||
68 | ver = line.split(": ")[1] | ||
69 | elif line.startswith("Architecture:"): | ||
70 | arch = line.split(": ")[1] | ||
71 | print("%s %s %s" % (pkg,arch,ver)) | ||
63 | else: | 72 | else: |
64 | if line.startswith("Depends:"): | 73 | if line.startswith("Depends:"): |
65 | depval = line.split(": ")[1] | 74 | depval = line.split(": ")[1] |