blob: 9c599eeca7498f2802e48b5c5fc01ac869b0aa79 [file] [log] [blame]
Brad Bishopa1e856b2015-11-19 22:06:41 -06001def run_git(d, cmd):
Brad Bishop6425ad22017-07-21 21:47:44 -04002 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
Brad Bishop7e3e11d2015-11-11 13:56:17 -05008
Brad Bishopa1e856b2015-11-19 22:06:41 -06009python() {
Brad Bishop6425ad22017-07-21 21:47:44 -040010 version_id = run_git(d, 'describe --dirty --long')
11 if version_id:
12 d.setVar('VERSION_ID', version_id)
13 versionList = version_id.split('-')
14 version = versionList[0] + "-" + versionList[1]
15 d.setVar('VERSION', version)
Brad Bishopa1e856b2015-11-19 22:06:41 -060016
Brad Bishop6425ad22017-07-21 21:47:44 -040017 build_id = run_git(d, 'describe --abbrev=0')
18 if build_id:
19 d.setVar('BUILD_ID', build_id)
Brad Bishopa1e856b2015-11-19 22:06:41 -060020}
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"