blob: c55e896f2f17c5946993b7736b893b0bcdac8321 [file] [log] [blame]
Brad Bishopa1e856b2015-11-19 22:06:41 -06001def 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 Bishop7e3e11d2015-11-11 13:56:17 -05007
Brad Bishopa1e856b2015-11-19 22:06:41 -06008python() {
Chris Austenacb70de2016-04-30 16:47:12 -05009 version_id = run_git(d, 'describe --dirty')
Brad Bishopa1e856b2015-11-19 22:06:41 -060010 if version_id:
11 d.setVar('VERSION_ID', version_id)
Ratan Gupta25304082016-08-04 05:48:55 -050012 versionList = version_id.split('-')
13 version = versionList[0] + "-" + versionList[1]
14 d.setVar('VERSION', version)
Brad Bishopa1e856b2015-11-19 22:06:41 -060015
Chris Austenacb70de2016-04-30 16:47:12 -050016 build_id = run_git(d, 'describe --abbrev=0')
Brad Bishopa1e856b2015-11-19 22:06:41 -060017 if build_id:
18 d.setVar('BUILD_ID', build_id)
19}
20
Brad Bishop7e3e11d2015-11-11 13:56:17 -050021OS_RELEASE_FIELDS_append = " BUILD_ID"
Brad Bishop81cecaf2015-12-18 15:36:47 -050022do_compile[nostamp] = "1"
Patrick Williams08f39c52016-08-05 19:18:44 -050023do_compile_remove[vardeps] = "BUILD_ID VERSION VERSION_ID"