diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-09 12:32:36 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-11 10:30:57 +0100 |
| commit | 99f14253403165dab6f4e57d2416692de8b348b3 (patch) | |
| tree | 18acbb44b045d9b841796208ef4b39d26624faf7 /meta | |
| parent | 38a9622ba35f674f66bc9e74512805f4834b606d (diff) | |
| download | poky-99f14253403165dab6f4e57d2416692de8b348b3.tar.gz | |
image-buildinfo: Improve and extend to SDK coverage too
Rename the default file from "build" to "buildinfo" since this is more
obvious to anyone looking in an image.
Add SDK_BUILDINFO_FILE and allow the same information to be written into
SDK images. This will be useful for buildtools-tarball and uninative-tarball.
(From OE-Core rev: 38b9525f1d5377288922e7cbac3f30afe6046242)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes/image-buildinfo.bbclass | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/meta/classes/image-buildinfo.bbclass b/meta/classes/image-buildinfo.bbclass index d4a12b5e10..ef790bb73b 100644 --- a/meta/classes/image-buildinfo.bbclass +++ b/meta/classes/image-buildinfo.bbclass | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # | 1 | # |
| 2 | # Writes build information to target filesystem on /etc/build | 2 | # Writes build information to target filesystem on /etc/buildinfo |
| 3 | # | 3 | # |
| 4 | # Copyright (C) 2014 Intel Corporation | 4 | # Copyright (C) 2014 Intel Corporation |
| 5 | # Author: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@intel.com> | 5 | # Author: Alejandro Enedino Hernandez Samaniego <alejandro.hernandez@intel.com> |
| @@ -13,7 +13,8 @@ | |||
| 13 | IMAGE_BUILDINFO_VARS ?= "DISTRO DISTRO_VERSION" | 13 | IMAGE_BUILDINFO_VARS ?= "DISTRO DISTRO_VERSION" |
| 14 | 14 | ||
| 15 | # Desired location of the output file in the image. | 15 | # Desired location of the output file in the image. |
| 16 | IMAGE_BUILDINFO_FILE ??= "${sysconfdir}/build" | 16 | IMAGE_BUILDINFO_FILE ??= "${sysconfdir}/buildinfo" |
| 17 | SDK_BUILDINFO_FILE ??= "/buildinfo" | ||
| 17 | 18 | ||
| 18 | # From buildhistory.bbclass | 19 | # From buildhistory.bbclass |
| 19 | def image_buildinfo_outputvars(vars, d): | 20 | def image_buildinfo_outputvars(vars, d): |
| @@ -40,11 +41,12 @@ def buildinfo_target(d): | |||
| 40 | vars = (d.getVar("IMAGE_BUILDINFO_VARS") or "") | 41 | vars = (d.getVar("IMAGE_BUILDINFO_VARS") or "") |
| 41 | return image_buildinfo_outputvars(vars, d) | 42 | return image_buildinfo_outputvars(vars, d) |
| 42 | 43 | ||
| 43 | # Write build information to target filesystem | 44 | python buildinfo() { |
| 44 | python buildinfo () { | ||
| 45 | if not d.getVar('IMAGE_BUILDINFO_FILE'): | 45 | if not d.getVar('IMAGE_BUILDINFO_FILE'): |
| 46 | return | 46 | return |
| 47 | with open(d.expand('${IMAGE_ROOTFS}${IMAGE_BUILDINFO_FILE}'), 'w') as build: | 47 | destfile = d.expand('${BUILDINFODEST}${IMAGE_BUILDINFO_FILE}') |
| 48 | bb.utils.mkdirhier(os.path.dirname(destfile)) | ||
| 49 | with open(destfile, 'w') as build: | ||
| 48 | build.writelines(( | 50 | build.writelines(( |
| 49 | '''----------------------- | 51 | '''----------------------- |
| 50 | Build Configuration: | | 52 | Build Configuration: | |
| @@ -62,4 +64,18 @@ Layer Revisions: | | |||
| 62 | )) | 64 | )) |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | IMAGE_PREPROCESS_COMMAND += "buildinfo;" | 67 | # Write build information to target filesystem |
| 68 | python buildinfo_image () { | ||
| 69 | d.setVar("BUILDINFODEST", "${IMAGE_ROOTFS}") | ||
| 70 | bb.build.exec_func("buildinfo", d) | ||
| 71 | } | ||
| 72 | |||
| 73 | python buildinfo_sdk () { | ||
| 74 | d.setVar("BUILDINFODEST", "${SDK_OUTPUT}/${SDKPATH}") | ||
| 75 | d.setVar("IMAGE_BUILDINFO_FILE", d.getVar("SDK_BUILDINFO_FILE")) | ||
| 76 | bb.build.exec_func("buildinfo", d) | ||
| 77 | } | ||
| 78 | |||
| 79 | IMAGE_PREPROCESS_COMMAND += "buildinfo_image;" | ||
| 80 | POPULATE_SDK_PRE_TARGET_COMMAND += "buildinfo_sdk;" | ||
| 81 | |||
