packagegroup-agl-core-boot: add package distro-build-manifest
[AGL/meta-agl.git] / meta-agl-profile-core / recipes-core / distro-build-manifest / distro-build-manifest.bb
1 SUMMARY = "Distribution build manifest"
2 DESCRIPTION = "The /etc/platform-build-info file contains build manifest (SPEC-720)."
3 LICENSE = "MIT"
4
5 # information distributed by the package is machine specific
6 PACKAGE_ARCH = "${MACHINE_ARCH}"
7
8 # dependencies of ${DISTRO_MANIFEST_GENERATOR}
9 DEPENDS = "coreutils-native bash-native git-native gawk-native sed-native"
10
11 # force a rebuild everytime a build is started
12 do_compile[nostamp] = "1"
13
14 do_compilestep1 () {
15     rc=99
16     outfile=${B}/platform-build-info
17     if [ -f "${DISTRO_MANIFEST_GENERATOR}" -a -f "${DISTRO_SETUP_MANIFEST}" ]; then
18         ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} deploy >${outfile}-deploy
19         rc1=$?
20         ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} target >${outfile}-target
21         rc2=$?
22         ${DISTRO_MANIFEST_GENERATOR} ${DISTRO_SETUP_MANIFEST} sdk >${outfile}-sdk
23         rc=$?
24
25         if [ "$rc1" -ne 0 -o "$rc2" -ne 0 -o "$rc3" -ne 0 ]; then
26             rc=98
27         fi
28     fi
29
30     if [ "$rc" -ne  0 ]; then
31         echo "distro-build-manifest generation failed."
32     fi
33     return $rc
34 }
35
36 # borrowed to os-release.bb (output format is very close)
37 python do_compilestep2 () {
38    import shutil
39    with open(d.expand('${B}/platform-build-info-deploy'),'a') as f:
40       for field in d.getVar('BUILD_MANIFEST_FIELDS_DEPLOY').split():
41          value=d.getVar(field)
42          if value:
43             f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
44
45    with open(d.expand('${B}/platform-build-info-target'),'a') as f:
46       for field in d.getVar('BUILD_MANIFEST_FIELDS_TARGET').split():
47          value=d.getVar(field)
48          if value:
49             f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
50
51    with open(d.expand('${B}/platform-build-info-sdk'),'a') as f:
52       for field in d.getVar('BUILD_MANIFEST_FIELDS_SDK').split():
53          value=d.getVar(field)
54          if value:
55             f.write('DIST_BB_{0}="{1}"\n'.format(field,value))
56 }
57 do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_DEPLOY}"
58 do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_TARGET}"
59 do_compilestep2[vardeps] += " ${BUILD_MANIFEST_FIELDS_SDK}"
60
61 # combine the two steps
62 python do_compile() {
63    bb.build.exec_func("do_compilestep1",d)
64    bb.build.exec_func("do_compilestep2",d)
65 }
66
67 do_install () {
68     # install in target dir
69     install -d ${D}${sysconfdir}
70     install -m 0644 platform-build-info-target ${D}${sysconfdir}/platform-build-info
71
72     # also copy in deploy dir
73     install -d ${DEPLOY_DIR_IMAGE}
74     install -m 0644 platform-build-info-deploy ${DEPLOY_DIR_IMAGE}/platform-build-info
75
76     # and copy to nativesdk package
77     # TODO
78 }
79
80 # list of variables to add to the various manifests
81 # smalles one is 'target', then 'deploy' and finally 'sdk'
82 BUILD_MANIFEST_FIELDS_TARGET = "\
83     MACHINE_ARCH \
84     MACHINEOVERRIDES \
85     MACHINE_FEATURES \
86     DISTRO_CODENAME \
87     DISTRO_FEATURES \
88     DISTRO_BRANCH_VERSION_TAG \
89     AGLVERSION \
90     AGL_BRANCH \
91     AGLRELEASETYPE \
92 "
93
94 BUILD_MANIFEST_FIELDS_DEPLOY = "\
95     ${BUILD_MANIFEST_FIELDS_TARGET} \
96     DISTRO \
97     DISTRO_VERSION \
98     DISTROOVERRIDES \
99     TUNE_FEATURES \
100     TUNE_PKGARCH \
101     ALL_MULTILIB_PACKAGE_ARCHS \
102 "
103
104 BUILD_MANIFEST_FIELDS_SDK = "\
105     ${BUILD_MANIFEST_FIELDS_DEPLOY} \
106     HOST_SYS \
107     TARGET_SYS \
108     TARGET_VENDOR \
109     SDK_ARCH \
110     SDK_VENDOR \
111     SDK_VERSION \
112     SDK_OS \
113 "
114
115 # dont exec useless tasks
116 do_fetch[noexec] = "1"
117 do_unpack[noexec] = "1"
118 do_patch[noexec] = "1"
119 do_configure[noexec] = "1"
120