packagegroup-agl-core-boot: add package distro-build-manifest 23/16723/18
authorStephane Desneux <stephane.desneux@iot.bzh>
Fri, 21 Sep 2018 11:24:25 +0000 (11:24 +0000)
committerStephane Desneux <stephane.desneux@iot.bzh>
Tue, 9 Oct 2018 15:45:36 +0000 (15:45 +0000)
The purpose of distro-build-manifest is to generate and distribute build
manifests for a given AGL build (generally, an image build).

The recipe generates the build manifest 'platform-build-info' at each build
(no caching) and this manifest is then stored in 3 locations with different set
of data:
 * image: in /etc/platform-build-info
 * deploy dir: image/$MACHINE/platform-build-info
 * sdk: generated but not packaged yet

Important Note: the 3 manifests contain at least the 'target manifest' but some
extra information are added depending on the target location:
* build host information are only available in the deploy dir manifest
* SDK specific data are only available in the SDK manifest

An example of generated build manifests (sorry for long lines):

in target (package distro-build-manifest):
------------------------------------------------------------------------------
DIST_MACHINE="h3ulcb"
DIST_FEATURES="agl-appfw-smack agl-audio-4a-framework agl-demo agl-devel agl-hmi-framework agl-netboot agl-profile-graphical agl-profile-graphical-qt5 agl-ptest agl-pulseaudio "
DIST_LAYERS="agl-manifest:4f3b4e1 meta-agl-demo:6.90.0-3-gfc32c5e meta-agl-devel:6.90.0-3-gf4b12f5 meta-agl-extra:6.90.0-0-ged8c0a7 meta-agl:6.90.0-20-g46941e2 meta-gplv2:f875c60 meta-intel:8.1-rocko-2.4.2-21-g718bb38 meta-intel-iot-security:v1.0.0-34-g20bbb97 meta-iot-bzh:4.99.3-45-g1de6fff meta-oic:70d5bec meta-openembedded:3525310 meta-qt5:5.2.1+origin/release-445-g682ad61 meta-raspberrypi:8e4c537 meta-rcar:a055159 meta-renesas-rcar-gen3:6.90.0-0-gb3625d6 meta-security:8f6969a meta-security-isafw:489abdc meta-updater:ff555e8 meta-updater-qemux86-64:697632d poky:rocko-18.0.3-0-g7e7ee66"
DIST_BUILD_HASH="Fd30d961c-L91230d88"
DIST_BUILD_ID="AGL-h3ulcb-Fd30d961c-L91230d88"
DIST_BB_MACHINE_ARCH="h3ulcb"
DIST_BB_MACHINEOVERRIDES="rcar-gen3:r8a7795:h3ulcb:aarch64:ulcb"
DIST_BB_MACHINE_FEATURES="biglittle agl-egvirt gsx multimedia rtc qemu-usermode"
DIST_BB_DISTRO_CODENAME="guppy"
DIST_BB_DISTRO_FEATURES="acl alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-crypt libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse libc-getlogin libc-idn libc-inet-anl libc-libm libc-locales libc-locale-code libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc libc-posix-wchar-io largefile systemd opengl wayland pam bluetooth bluez5 surroundview bluetooth netboot smack dbus-cynara xattr automount agl-audio-4a-framework agl-hmi-framework agl-devel pulseaudio sota pam use_eva_pkg h264dec_lib h264enc_lib aaclcdec_lib aaclcdec_mdw ptest gobject-introspection-data ldconfig"
DIST_BB_DISTRO_BRANCH_VERSION_TAG="guppy/6.90.0"
DIST_BB_AGLVERSION="6.90.0"
DIST_BB_AGL_BRANCH="master"
DIST_BB_AGLRELEASETYPE="agldevelopment"
------------------------------------------------------------------------------

in deploy dir:
------------------------------------------------------------------------------
[target manifest]
       +
DIST_FEATURES_MD5="d30d961c8981a7badc467aedafb0687b"
DIST_BUILD_HOST="devel@bsp-devkit-odin-0-sdx"
DIST_BUILD_OS="Debian GNU/Linux 8 (jessie)"
DIST_SETUP_TS="20181009_153656_UTC"
DIST_SETUP_MANIFEST="/xdt/build/h3ulcb/aglsetup.manifest"
DIST_BUILD_TS="20181009_153832_UTC"
DIST_LAYERS_MD5="91230d88544a1ac1845d80ad5f083651"
DIST_BB_DISTRO="poky-agl"
DIST_BB_DISTRO_VERSION="6.90.0+snapshot-20181009"
DIST_BB_DISTROOVERRIDES="poky-agl"
DIST_BB_TUNE_FEATURES="aarch64"
DIST_BB_TUNE_PKGARCH="aarch64"
DIST_BB_ALL_MULTILIB_PACKAGE_ARCHS="all any noarch aarch64 h3ulcb"
------------------------------------------------------------------------------

in SDK:
------------------------------------------------------------------------------
[target manifest]
       +
DIST_BB_DISTRO="poky-agl"
DIST_BB_DISTRO_VERSION="6.90.0+snapshot-20181009"
DIST_BB_DISTROOVERRIDES="poky-agl"
DIST_BB_TUNE_FEATURES="aarch64"
DIST_BB_TUNE_PKGARCH="aarch64"
DIST_BB_ALL_MULTILIB_PACKAGE_ARCHS="all any noarch aarch64 h3ulcb"
DIST_BB_HOST_SYS="aarch64-agl-linux"
DIST_BB_TARGET_SYS="aarch64-agl-linux"
DIST_BB_TARGET_VENDOR="-agl"
DIST_BB_SDK_ARCH="x86_64"
DIST_BB_SDK_VENDOR="-aglsdk"
DIST_BB_SDK_VERSION="6.90.0+snapshot"
DIST_BB_SDK_OS="linux"
------------------------------------------------------------------------------

Bug-AGL: SPEC-720, SPEC-1741

Change-Id: I934acc87e13d2f6ec867684af515b89a89a89338
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
meta-agl-profile-core/recipes-core/distro-build-manifest/distro-build-manifest.bb [new file with mode: 0644]
meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb

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 (file)
index 0000000..e421738
--- /dev/null
@@ -0,0 +1,120 @@
+SUMMARY = "Distribution build manifest"
+DESCRIPTION = "The /etc/platform-build-info file contains build manifest (SPEC-720)."
+LICENSE = "MIT"
+
+# information distributed by the package is machine specific
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+# dependencies of ${DISTRO_MANIFEST_GENERATOR}
+DEPENDS = "coreutils-native bash-native git-native gawk-native sed-native"
+
+# force a rebuild everytime a build is started
+do_compile[nostamp] = "1"
+
+do_compilestep1 () {
+    rc=99
+    outfile=${B}/platform-build-info
+    if [ -f "${DISTRO_MANIFEST_GENERATOR}" -a -f "${DISTRO_SETUP_MANIFEST}" ]; then
+        ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} deploy >${outfile}-deploy
+        rc1=$?
+        ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} target >${outfile}-target
+        rc2=$?
+        ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} sdk >${outfile}-sdk
+        rc=$?
+
+        if [ "$rc1" -ne 0 -o "$rc2" -ne 0 -o "$rc3" -ne 0 ]; then
+            rc=98
+        fi
+    fi
+
+    if [ "$rc" -ne  0 ]; then
+        echo "distro-build-manifest generation failed."
+    fi
+    return $rc
+}
+
+# borrowed to os-release.bb (output format is very close)
+python do_compilestep2 () {
+   import shutil
+   with open(d.expand('${B}/platform-build-info-deploy'),'a') as f:
+      for field in d.getVar('BUILD_MANIFEST_FIELDS_DEPLOY').split():
+         value=d.getVar(field)
+         if value:
+            f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
+
+   with open(d.expand('${B}/platform-build-info-target'),'a') as f:
+      for field in d.getVar('BUILD_MANIFEST_FIELDS_TARGET').split():
+         value=d.getVar(field)
+         if value:
+            f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
+
+   with open(d.expand('${B}/platform-build-info-sdk'),'a') as f:
+      for field in d.getVar('BUILD_MANIFEST_FIELDS_SDK').split():
+         value=d.getVar(field)
+         if value:
+            f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
+}
+do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_DEPLOY}"
+do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_TARGET}"
+do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_SDK}"
+
+# combine the two steps
+python do_compile() {
+   bb.build.exec_func("do_compilestep1",d)
+   bb.build.exec_func("do_compilestep2",d)
+}
+
+do_install () {
+    # install in target dir
+    install -d ${D}${sysconfdir}
+    install -m 0644 platform-build-info-target ${D}${sysconfdir}/platform-build-info
+
+    # also copy in deploy dir
+    install -d ${DEPLOY_DIR_IMAGE}
+    install -m 0644 platform-build-info-deploy ${DEPLOY_DIR_IMAGE}/platform-build-info
+
+    # and copy to nativesdk package
+    # TODO
+}
+
+# list of variables to add to the various manifests
+# smalles one is 'target', then 'deploy' and finally 'sdk'
+BUILD_MANIFEST_FIELDS_TARGET = "\
+    MACHINE_ARCH \
+    MACHINEOVERRIDES \
+    MACHINE_FEATURES \
+    DISTRO_CODENAME \
+    DISTRO_FEATURES \
+    DISTRO_BRANCH_VERSION_TAG \
+    AGLVERSION \
+    AGL_BRANCH \
+    AGLRELEASETYPE \
+"
+
+BUILD_MANIFEST_FIELDS_DEPLOY = "\
+    ${BUILD_MANIFEST_FIELDS_TARGET} \
+    DISTRO \
+    DISTRO_VERSION \
+    DISTROOVERRIDES \
+    TUNE_FEATURES \
+    TUNE_PKGARCH \
+    ALL_MULTILIB_PACKAGE_ARCHS \
+"
+
+BUILD_MANIFEST_FIELDS_SDK = "\
+    ${BUILD_MANIFEST_FIELDS_DEPLOY} \
+    HOST_SYS \
+    TARGET_SYS \
+    TARGET_VENDOR \
+    SDK_ARCH \
+    SDK_VENDOR \
+    SDK_VERSION \
+    SDK_OS \
+"
+
+# dont exec useless tasks
+do_fetch[noexec] = "1"
+do_unpack[noexec] = "1"
+do_patch[noexec] = "1"
+do_configure[noexec] = "1"
+
index 1633fed..690dc9e 100644 (file)
@@ -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)} \