From: Paul Spooren Date: Fri, 20 Jul 2018 08:32:12 +0000 (+0900) Subject: imagebuilder: add function to show manifest X-Git-Tag: v19.07.0-rc1~2975 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=869b0d11db;p=oweals%2Fopenwrt.git imagebuilder: add function to show manifest Tested with 18.06.0-rc2/ar71xx/generic/tl-wdr4300-v1, image & list This PR is based on the work of @fewckert[1] with slight improvements. Add function `manifest` to show the manifest of the produced image, before actually building it. The manifest contains an orderd list of package name and version. This is usefull to check package dependencies but also determine a unique and reproducible image name before building the package. The sysupgrade server[2] builds images on request with individual package selection. To distignish between created images which contain differnt packages, the EXTRA_IMAGE_NAME is set to a shortend hash of the manifest's content. So far the image was renamed afterwards as the manifests content was unknown, however this corrupts the signed sha256sums. This patch allows a clean solution as to dtermine the manifest in advance and set the EXTRA_IMAGE_NAME accordingly. [1]: https://github.com/lede-project/source/pull/1591 [2]: https://github.com/aparcar/attendedsysupgrade-server Signed-off-by: Paul Spooren --- diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 95df8bf113..e0c0132b85 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -45,6 +45,14 @@ Building images: make image FILES="" # include extra files from make image BIN_DIR="" # alternative output directory for the images make image EXTRA_IMAGE_NAME="" # Add this to the output image filename (sanitized) + +Print manifest: + List "all" packages which get installed into the image. + You can use the following parameters: + + make manifest PROFILE="" # override the default target profile + make manifest PACKAGES=" [ [ ...]]" # include extra packages + endef $(eval $(call shexport,Helptext)) @@ -108,6 +116,13 @@ _call_image: staging_dir/host/.prereq-build $(MAKE) -s build_image $(MAKE) -s checksum +_call_manifest: FORCE + rm -rf $(TARGET_DIR) + mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR) + $(MAKE) package_reload >/dev/null 2>/dev/null + $(MAKE) package_install >/dev/null 2>/dev/null + $(OPKG) list-installed + package_index: FORCE @echo >&2 @echo Building package index... >&2 @@ -164,7 +179,7 @@ info: PROFILE_FILTER = $(filter DEVICE_$(PROFILE) $(PROFILE),$(PROFILE_NAMES)) -image: +_check_profile: FORCE ifneq ($(PROFILE),) ifeq ($(PROFILE_FILTER),) @echo 'Profile "$(PROFILE)" does not exist!' @@ -172,6 +187,9 @@ ifneq ($(PROFILE),) @exit 1 endif endif + +image: + $(MAKE) -s _check_profile (unset PROFILE FILES PACKAGES MAKEFLAGS; \ $(MAKE) -s _call_image \ $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ @@ -179,4 +197,11 @@ endif $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \ $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)")) -.SILENT: help info image +manifest: FORCE + $(MAKE) -s _check_profile + (unset PROFILE FILES PACKAGES MAKEFLAGS; \ + $(MAKE) -s _call_manifest \ + $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ + $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")) + +.SILENT: help info image manifest