[OE-core] [PATCH 2/2] image-buildinfo.bbclass: Introduce IMAGE_BUILDINFO_GITDESCRIBE
Andrei Gherzan
andrei at gherzan.ro
Wed Oct 9 17:05:43 UTC 2019
This knob can switch in between having full revisions and having git
describe references in the build info file. By default it is set to 0 to
maintain the old behaviour.
Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
---
meta/classes/image-buildinfo.bbclass | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/meta/classes/image-buildinfo.bbclass b/meta/classes/image-buildinfo.bbclass
index 94c585d4cd..fb8677fe69 100644
--- a/meta/classes/image-buildinfo.bbclass
+++ b/meta/classes/image-buildinfo.bbclass
@@ -15,6 +15,9 @@ IMAGE_BUILDINFO_VARS ?= "DISTRO DISTRO_VERSION"
# Desired location of the output file in the image.
IMAGE_BUILDINFO_FILE ??= "${sysconfdir}/build"
+# By default use HEAD revision. Set this to 1 for git human readable revisions.
+IMAGE_BUILDINFO_GITDESCRIBE ?= "0"
+
# From buildhistory.bbclass
def image_buildinfo_outputvars(vars, d):
vars = vars.split()
@@ -45,9 +48,16 @@ def get_layer_git_status(path):
# Returns layer revisions along with their respective status
def get_layer_revs(d):
layers = (d.getVar("BBLAYERS") or "").split()
- medadata_revs = ["%-17s = %s:%s %s" % (os.path.basename(i), \
+ gitdescribe = d.getVar("IMAGE_BUILDINFO_GITDESCRIBE") or "0"
+
+ if gitdescribe == "1":
+ revision_func = base_get_metadata_git_describe
+ else:
+ revision_func = base_get_metadata_git_revision
+
+ medadata_revs = ["%-27s = %s:%s %s" % (os.path.basename(i), \
base_get_metadata_git_branch(i, None).strip(), \
- base_get_metadata_git_revision(i, None), \
+ revision_func(i, None), \
get_layer_git_status(i)) \
for i in layers]
return '\n'.join(medadata_revs)
--
2.23.0
More information about the Openembedded-core
mailing list