--- /dev/null
+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
+