blob: 64f0feda03bc7ed899e5431009d037d567824785 [file] [log] [blame]
Brad Bishopa1e856b2015-11-19 22:06:41 -06001def run_git(d, cmd):
2 try:
3 oeroot = d.getVar('COREBASE', True)
Patrick Williams4da355f2017-02-28 15:25:39 -06004 return bb.process.run("git --work-tree %s --git-dir %s/.git %s"
5 % (oeroot, oeroot, cmd))[0].strip('\n')
Brad Bishopa1e856b2015-11-19 22:06:41 -06006 except:
7 pass
Brad Bishop7e3e11d2015-11-11 13:56:17 -05008
Brad Bishopa1e856b2015-11-19 22:06:41 -06009python() {
Leonel Gonzalez92823c62017-06-16 12:43:26 -050010 version_id = run_git(d, 'describe --dirty --long')
Brad Bishopa1e856b2015-11-19 22:06:41 -060011 if version_id:
12 d.setVar('VERSION_ID', version_id)
Ratan Gupta25304082016-08-04 05:48:55 -050013 versionList = version_id.split('-')
14 version = versionList[0] + "-" + versionList[1]
15 d.setVar('VERSION', version)
Brad Bishopa1e856b2015-11-19 22:06:41 -060016
Chris Austenacb70de2016-04-30 16:47:12 -050017 build_id = run_git(d, 'describe --abbrev=0')
Brad Bishopa1e856b2015-11-19 22:06:41 -060018 if build_id:
19 d.setVar('BUILD_ID', build_id)
20}
21
Brad Bishop7e3e11d2015-11-11 13:56:17 -050022OS_RELEASE_FIELDS_append = " BUILD_ID"
Brad Bishop81cecaf2015-12-18 15:36:47 -050023do_compile[nostamp] = "1"
Anton D. Kachalov7952ea72016-12-23 17:19:19 +030024do_compile[vardepsexclude] = "BUILD_ID VERSION VERSION_ID NAME PRETTY_NAME"