blob: f9befa67cc94922e760be8b1cbafbe2e228894e4 [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)
12
Chris Austenacb70de2016-04-30 16:47:12 -050013 build_id = run_git(d, 'describe --abbrev=0')
Brad Bishopa1e856b2015-11-19 22:06:41 -060014 if build_id:
15 d.setVar('BUILD_ID', build_id)
16}
17
Brad Bishop7e3e11d2015-11-11 13:56:17 -050018OS_RELEASE_FIELDS_append = " BUILD_ID"
Brad Bishop81cecaf2015-12-18 15:36:47 -050019do_compile[nostamp] = "1"
Brad Bishopc0ad28f2016-06-29 09:31:17 -040020do_compile_remove[vardeps] = "BUILD_ID"