blob: c010146430b1366b28be929a8aed968e52598a73 [file] [log] [blame]
Brad Bishop02449152017-07-21 22:05:22 -04001# WARNING!
2#
3# These modifications to os-release disable the bitbake parse
4# cache (for the os-release recipe only). Before copying
5# and pasting into another recipe ensure it is understood
6# what that means!
7
Brad Bishopa1e856b2015-11-19 22:06:41 -06008def run_git(d, cmd):
Brad Bishop6425ad22017-07-21 21:47:44 -04009 try:
10 oeroot = d.getVar('COREBASE', True)
11 return bb.process.run("git --work-tree %s --git-dir %s/.git %s"
12 % (oeroot, oeroot, cmd))[0].strip('\n')
13 except:
14 pass
Brad Bishop7e3e11d2015-11-11 13:56:17 -050015
Andrew Geissleraae84922020-10-27 10:04:38 -050016python() {
Brad Bishop6425ad22017-07-21 21:47:44 -040017 version_id = run_git(d, 'describe --dirty --long')
18 if version_id:
19 d.setVar('VERSION_ID', version_id)
20 versionList = version_id.split('-')
21 version = versionList[0] + "-" + versionList[1]
22 d.setVar('VERSION', version)
Brad Bishopa1e856b2015-11-19 22:06:41 -060023
Brad Bishop6425ad22017-07-21 21:47:44 -040024 build_id = run_git(d, 'describe --abbrev=0')
25 if build_id:
26 d.setVar('BUILD_ID', build_id)
Joseph Reynoldse9319a82018-12-05 16:49:22 -060027
28 target_machine = d.getVar('MACHINE', True)
29 if target_machine:
30 d.setVar('OPENBMC_TARGET_MACHINE', target_machine)
Brad Bishopa1e856b2015-11-19 22:06:41 -060031}
32
Joseph Reynoldse9319a82018-12-05 16:49:22 -060033OS_RELEASE_FIELDS_append = " BUILD_ID OPENBMC_TARGET_MACHINE"
Brad Bishop02449152017-07-21 22:05:22 -040034
35# Ensure the git commands run every time bitbake is invoked.
36BB_DONT_CACHE = "1"
Brad Bishope23b09a2017-07-24 20:24:28 -040037
38# Make os-release available to other recipes.
39SYSROOT_DIRS_append = " ${sysconfdir}"