diff options
author | Hieu Vu <hvu@amperecomputing.com> | 2020-10-19 09:39:54 +0300 |
---|---|---|
committer | Chau Ly <chaul@amperecomputing.com> | 2023-02-21 06:20:42 +0300 |
commit | e072defa81f4af79a316a85ff0339a9b133c0555 (patch) | |
tree | d551240bcd562359fc88d3e12cbc5a050bd2de2e | |
parent | 00a462d0a1309146543553250f5181b2e719b0ec (diff) | |
download | openbmc-e072defa81f4af79a316a85ff0339a9b133c0555.tar.xz |
meta-ampere: support software revision using Ampere format
OpenBMC uses os-release.bbappend to control the FW version, which is
the output of 'git describe --dirty --long'. The format of this command's
output is: {annotated-tag-name}-{num-commits-to-tag}-{current-commit-hash}.
'-dirty' will be appended to the output if the working space is not clean.
In addition, git describe --dirty --long only find an annotated tag, not
lightweight tag which will miss internal release.
This commit updates the rule to extract the right revision from Ampere
build and release tag.
Tested: tag with v1.02.100-ampere and check WebUI display revision
1.02.100.
Signed-off-by: Thu Cao <thcao@os.amperecomputing.com>
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I6d5e6d2dcdb4988809f71d48a5b0e2710e7810d2
-rw-r--r-- | meta-ampere/meta-common/recipes-core/os-release/os-release.bbappend | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/meta-ampere/meta-common/recipes-core/os-release/os-release.bbappend b/meta-ampere/meta-common/recipes-core/os-release/os-release.bbappend new file mode 100644 index 0000000000..1e9e253019 --- /dev/null +++ b/meta-ampere/meta-common/recipes-core/os-release/os-release.bbappend @@ -0,0 +1,17 @@ +def run_git(d, cmd): + try: + oeroot = d.getVar('COREBASE', True) + return bb.process.run("git --work-tree %s --git-dir %s/.git %s" + % (oeroot, oeroot, cmd))[0].strip('\n') + except: + pass + +python() { + version_id = run_git(d, 'describe --dirty --long --tags') + if version_id: + versionList = version_id.split('-') + + # Override with tag name only, if built at tag. + if 'dirty' not in version_id and versionList[1] == 'ampere': + d.setVar('VERSION_ID', versionList[0].split('v')[-1]) +} |