blob: 50c3787e4ad00be016f417166fc0151823816f26 [file] [log] [blame]
Brad Bishopba470942017-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
Patrick Williams460ca242021-09-10 22:32:22 -05008OS_RELEASE_ROOTPATH ?= "${COREBASE}"
9
Brad Bishop05ce9c52015-11-19 22:06:41 -060010def run_git(d, cmd):
Brad Bishop7019fbe2017-07-21 21:47:44 -040011 try:
Patrick Williams460ca242021-09-10 22:32:22 -050012 oeroot = d.getVar('OS_RELEASE_ROOTPATH', True)
Patrick Williamsbc442de2020-11-18 12:29:25 -060013 return bb.process.run(("export PSEUDO_DISABLED=1; " +
14 "git --work-tree %s --git-dir %s/.git %s")
Brad Bishop7019fbe2017-07-21 21:47:44 -040015 % (oeroot, oeroot, cmd))[0].strip('\n')
Patrick Williamsbc442de2020-11-18 12:29:25 -060016 except Exception as e:
17 bb.warn("Unexpected exception from 'git' call: %s" % e)
Brad Bishop7019fbe2017-07-21 21:47:44 -040018 pass
Brad Bishopbe861802015-11-11 13:56:17 -050019
Patrick Williams24d05d02021-06-30 16:15:45 -050020# DISTRO_VERSION can be overridden by a bbappend or config, so it must be a
21# weak override. But, when a variable is weakly overridden the definition
22# and not the contents are used in the task-hash (for sstate reuse). We need
23# a strong variable in the vardeps chain for do_compile so that we get the
24# contents of the 'git describe --dirty' call. Create a strong/immediate
25# indirection via PHOSPHOR_OS_RELEASE_DISTRO_VERSION.
26PHOSPHOR_OS_RELEASE_DISTRO_VERSION := "${@run_git(d, 'describe --dirty')}"
27DISTRO_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}"
Adriana Kobylakbde7dbe2022-08-04 09:13:26 -050028EXTENDED_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}"
Patrick Williams24d05d02021-06-30 16:15:45 -050029
Patrick Williams46d9de32020-11-17 15:42:09 -060030VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}"
Brad Bishop05ce9c52015-11-19 22:06:41 -060031
Patrick Williams46d9de32020-11-17 15:42:09 -060032OPENBMC_TARGET_MACHINE = "${MACHINE}"
Brad Bishop05ce9c52015-11-19 22:06:41 -060033
Patrick Williams12fc9392021-08-06 09:16:53 -050034OS_RELEASE_FIELDS:append = " BUILD_ID OPENBMC_TARGET_MACHINE EXTENDED_VERSION"
Brad Bishopba470942017-07-21 22:05:22 -040035
36# Ensure the git commands run every time bitbake is invoked.
37BB_DONT_CACHE = "1"
Brad Bishope384d0c2017-07-24 20:24:28 -040038
39# Make os-release available to other recipes.
Patrick Williams12fc9392021-08-06 09:16:53 -050040SYSROOT_DIRS:append = " ${sysconfdir}"