Hieu Vu | e072def | 2020-10-19 06:39:54 +0000 | [diff] [blame] | 1 | def run_git(d, cmd): |
| 2 | try: |
| 3 | oeroot = d.getVar('COREBASE', True) |
| 4 | return bb.process.run("git --work-tree %s --git-dir %s/.git %s" |
| 5 | % (oeroot, oeroot, cmd))[0].strip('\n') |
| 6 | except: |
| 7 | pass |
| 8 | |
| 9 | python() { |
| 10 | version_id = run_git(d, 'describe --dirty --long --tags') |
| 11 | if version_id: |
| 12 | versionList = version_id.split('-') |
| 13 | |
| 14 | # Override with tag name only, if built at tag. |
| 15 | if 'dirty' not in version_id and versionList[1] == 'ampere': |
| 16 | d.setVar('VERSION_ID', versionList[0].split('v')[-1]) |
| 17 | } |