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) |
Patrick Williams | 4da355f | 2017-02-28 15:25:39 -0600 | [diff] [blame] | 4 | return bb.process.run("git --work-tree %s --git-dir %s/.git %s" |
| 5 | % (oeroot, oeroot, cmd))[0].strip('\n') |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 6 | except: |
| 7 | pass |
Brad Bishop | 7e3e11d | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 8 | |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 9 | python() { |
Leonel Gonzalez | 92823c6 | 2017-06-16 12:43:26 -0500 | [diff] [blame] | 10 | version_id = run_git(d, 'describe --dirty --long') |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 11 | if version_id: |
| 12 | d.setVar('VERSION_ID', version_id) |
Ratan Gupta | 2530408 | 2016-08-04 05:48:55 -0500 | [diff] [blame] | 13 | versionList = version_id.split('-') |
| 14 | version = versionList[0] + "-" + versionList[1] |
| 15 | d.setVar('VERSION', version) |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 16 | |
Chris Austen | acb70de | 2016-04-30 16:47:12 -0500 | [diff] [blame] | 17 | build_id = run_git(d, 'describe --abbrev=0') |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 18 | if build_id: |
| 19 | d.setVar('BUILD_ID', build_id) |
| 20 | } |
| 21 | |
Brad Bishop | 7e3e11d | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 22 | OS_RELEASE_FIELDS_append = " BUILD_ID" |
Brad Bishop | 81cecaf | 2015-12-18 15:36:47 -0500 | [diff] [blame] | 23 | do_compile[nostamp] = "1" |
Anton D. Kachalov | 7952ea7 | 2016-12-23 17:19:19 +0300 | [diff] [blame] | 24 | do_compile[vardepsexclude] = "BUILD_ID VERSION VERSION_ID NAME PRETTY_NAME" |