Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 1 | def run_git(d, cmd): |
| 2 | try: |
| 3 | oeroot = d.getVar('COREBASE', True) |
| 4 | return bb.process.run("git --git-dir %s/.git %s" %(oeroot, cmd))[0].strip('\n') |
| 5 | except: |
| 6 | pass |
Brad Bishop | 7e3e11d | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 7 | |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 8 | python() { |
Chris Austen | acb70de | 2016-04-30 16:47:12 -0500 | [diff] [blame] | 9 | version_id = run_git(d, 'describe --dirty') |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 10 | if version_id: |
| 11 | d.setVar('VERSION_ID', version_id) |
Ratan Gupta | 2530408 | 2016-08-04 05:48:55 -0500 | [diff] [blame] | 12 | versionList = version_id.split('-') |
| 13 | version = versionList[0] + "-" + versionList[1] |
| 14 | d.setVar('VERSION', version) |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 15 | |
Chris Austen | acb70de | 2016-04-30 16:47:12 -0500 | [diff] [blame] | 16 | build_id = run_git(d, 'describe --abbrev=0') |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 17 | if build_id: |
| 18 | d.setVar('BUILD_ID', build_id) |
| 19 | } |
| 20 | |
Brad Bishop | 7e3e11d | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 21 | OS_RELEASE_FIELDS_append = " BUILD_ID" |
Brad Bishop | 81cecaf | 2015-12-18 15:36:47 -0500 | [diff] [blame] | 22 | do_compile[nostamp] = "1" |
Anton D. Kachalov | 7952ea7 | 2016-12-23 17:19:19 +0300 | [diff] [blame] | 23 | do_compile[vardepsexclude] = "BUILD_ID VERSION VERSION_ID NAME PRETTY_NAME" |