From: Stephane Desneux Date: Fri, 21 Sep 2018 11:24:25 +0000 (+0000) Subject: packagegroup-agl-core-boot: add package distro-build-manifest X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=5648a93062b27ba22080270ed7e5bc7d4ce57c02;p=AGL%2Fmeta-agl.git packagegroup-agl-core-boot: add package distro-build-manifest the purpose of distro-build-manifest is to generate and distribute a unique build manifest for a given AGL image. The recipe will generate the build manifest 'platform-build-info' at each build (no caching) and this manifest is then stored in 2 locations: * image: in /etc/platform-build-info * deploy dir Bug-AGL: SPEC-720, SPEC-1741 Change-Id: I934acc87e13d2f6ec867684af515b89a89a89338 Signed-off-by: Stephane Desneux --- diff --git a/meta-agl-profile-core/recipes-core/distro-build-manifest/distro-build-manifest.bb b/meta-agl-profile-core/recipes-core/distro-build-manifest/distro-build-manifest.bb new file mode 100644 index 000000000..c048f470b --- /dev/null +++ b/meta-agl-profile-core/recipes-core/distro-build-manifest/distro-build-manifest.bb @@ -0,0 +1,81 @@ +SUMMARY = "Distribution build manifest" +DESCRIPTION = "The /etc/platform-build-info file contains build manifest (SPEC-720)." +LICENSE = "MIT" + +# dependencies of ${DISTRO_MANIFEST_GENERATOR} +DEPENDS = "coreutils-native bash-native git-native gawk-native sed-native" + +inherit allarch + +# force a rebuild everytime a build is started +do_compile[nostamp] = "1" + +do_compilestep1 () { + outfile=${B}/platform-build-info + if [ -f "${DISTRO_MANIFEST_GENERATOR}" -a -f "${DISTRO_SETUP_MANIFEST}" ]; then + ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} >$outfile + else + echo "# unable to generate build manifest - please check recipe distro-build-manifest" >$outfile + fi +} + +# borrowed to os-release.bb (output format is very close) +python do_compilestep2 () { + import shutil + with open(d.expand('${B}/platform-build-info'),'a') as f: + for field in d.getVar('BUILD_MANIFEST_FIELDS').split(): + value=d.getVar(field) + if value: + f.write('DIST_BB_{0}="{1}"\n'.format(field,value)) +} +do_compilestep2[vardeps] += "${BUILD_MANIFEST_FIELDS}" + +# combine the two steps +python do_compile() { + bb.build.exec_func("do_compilestep1",d) + bb.build.exec_func("do_compilestep2",d) +} + +do_install () { + install -d ${D}${sysconfdir} + install -m 0644 platform-build-info ${D}${sysconfdir}/ + + # also copy in deploy dir + install -d ${DEPLOY_DIR_IMAGE} + install -m 0644 platform-build-info ${DEPLOY_DIR_IMAGE}/ +} + + +# list of variables to add to the manifest +BUILD_MANIFEST_FIELDS = "\ + MACHINE_ARCH \ + MACHINEOVERRIDES \ + MACHINE_FEATURES \ + DISTRO \ + DISTRO_NAME \ + DISTRO_CODENAME \ + DISTRO_VERSION \ + DISTRO_FEATURES \ + DISTROOVERRIDES \ + DISTRO_BRANCH_VERSION_TAG \ + AGLVERSION \ + AGL_BRANCH \ + AGLRELEASETYPE \ + HOST_SYS \ + TARGET_SYS \ + TARGET_VENDOR \ + TUNE_FEATURES \ + TUNE_PKGARCH \ + ALL_MULTILIB_PACKAGE_ARCHS \ + SDK_ARCH \ + SDK_VENDOR \ + SDK_VERSION \ + SDK_OS \ +" + +# remove useless tasks +deltask do_fetch +deltask do_unpack +deltask do_patch +deltask do_configure + diff --git a/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb b/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb index 1633feddc..690dc9e15 100644 --- a/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb +++ b/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb @@ -34,6 +34,7 @@ RDEPENDS_${PN} = "\ base-files \ base-passwd \ busybox \ + distro-build-manifest \ rng-tools \ run-agl-postinsts \ ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \