[PATCH openbmc] os-release bug fixes
OpenBMC Patches
openbmc-patches at stwcx.xyz
Fri Nov 20 15:10:19 AEDT 2015
From: Brad Bishop <bradleyb at us.ibm.com>
The existing version wasn't handling non-default build
directories or build from tarball (no git repository)
type setups.
---
.../recipes-core/os-release/os-release.bbappend | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/meta-phosphor/common/recipes-core/os-release/os-release.bbappend b/meta-phosphor/common/recipes-core/os-release/os-release.bbappend
index 1692af1..ba6a772 100644
--- a/meta-phosphor/common/recipes-core/os-release/os-release.bbappend
+++ b/meta-phosphor/common/recipes-core/os-release/os-release.bbappend
@@ -1,8 +1,18 @@
-def git_describe(d):
- return bb.process.run("git describe --dirty")[0]
-def git_tag(d):
- return bb.process.run("git tag")[0]
+def run_git(d, cmd):
+ try:
+ oeroot = d.getVar('COREBASE', True)
+ return bb.process.run("git --git-dir %s/.git %s" %(oeroot, cmd))[0].strip('\n')
+ except:
+ pass
+
+python() {
+ version_id = run_git(d, 'tag')
+ if version_id:
+ d.setVar('VERSION_ID', version_id)
+
+ build_id = run_git(d, 'describe --dirty')
+ if build_id:
+ d.setVar('BUILD_ID', build_id)
+}
-VERSION_ID = "${@git_tag(d)}"
-BUILD_ID = "${@git_describe(d)}"
OS_RELEASE_FIELDS_append = " BUILD_ID"
--
2.6.3
More information about the openbmc
mailing list