1# 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
8def run_git(d, cmd):
9    try:
10        oeroot = d.getVar('COREBASE', True)
11        return bb.process.run(("export PSEUDO_DISABLED=1; " +
12                               "git --work-tree %s --git-dir %s/.git %s")
13            % (oeroot, oeroot, cmd))[0].strip('\n')
14    except Exception as e:
15        bb.warn("Unexpected exception from 'git' call: %s" % e)
16        pass
17
18DISTRO_VERSION ??= "${@run_git(d, 'describe --dirty')}"
19VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}"
20
21BUILD_ID := "${@run_git(d, 'describe --abbrev=0')}"
22OPENBMC_TARGET_MACHINE = "${MACHINE}"
23
24OS_RELEASE_FIELDS_append = " BUILD_ID OPENBMC_TARGET_MACHINE EXTENDED_VERSION"
25
26# Ensure the git commands run every time bitbake is invoked.
27BB_DONT_CACHE = "1"
28
29# Make os-release available to other recipes.
30SYSROOT_DIRS_append = " ${sysconfdir}"
31