Brad Bishop | ba47094 | 2017-07-21 22:05:22 -0400 | [diff] [blame] | 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 | |
Patrick Williams | 460ca24 | 2021-09-10 22:32:22 -0500 | [diff] [blame] | 8 | OS_RELEASE_ROOTPATH ?= "${COREBASE}" |
Brad Bishop | 05ce9c5 | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 9 | def run_git(d, cmd): |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 10 | try: |
Patrick Williams | 460ca24 | 2021-09-10 22:32:22 -0500 | [diff] [blame] | 11 | oeroot = d.getVar('OS_RELEASE_ROOTPATH', True) |
Patrick Williams | bc442de | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 12 | return bb.process.run(("export PSEUDO_DISABLED=1; " + |
| 13 | "git --work-tree %s --git-dir %s/.git %s") |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 14 | % (oeroot, oeroot, cmd))[0].strip('\n') |
Patrick Williams | bc442de | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 15 | except Exception as e: |
| 16 | bb.warn("Unexpected exception from 'git' call: %s" % e) |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 17 | pass |
Patrick Williams | 24d05d0 | 2021-06-30 16:15:45 -0500 | [diff] [blame] | 18 | # DISTRO_VERSION can be overridden by a bbappend or config, so it must be a |
| 19 | # weak override. But, when a variable is weakly overridden the definition |
| 20 | # and not the contents are used in the task-hash (for sstate reuse). We need |
| 21 | # a strong variable in the vardeps chain for do_compile so that we get the |
| 22 | # contents of the 'git describe --dirty' call. Create a strong/immediate |
| 23 | # indirection via PHOSPHOR_OS_RELEASE_DISTRO_VERSION. |
| 24 | PHOSPHOR_OS_RELEASE_DISTRO_VERSION := "${@run_git(d, 'describe --dirty')}" |
| 25 | DISTRO_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}" |
Adriana Kobylak | bde7dbe | 2022-08-04 09:13:26 -0500 | [diff] [blame] | 26 | EXTENDED_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}" |
Patrick Williams | 46d9de3 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 27 | VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}" |
Patrick Williams | 46d9de3 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 28 | OPENBMC_TARGET_MACHINE = "${MACHINE}" |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 29 | OS_RELEASE_FIELDS:append = " BUILD_ID OPENBMC_TARGET_MACHINE EXTENDED_VERSION" |
Brad Bishop | ba47094 | 2017-07-21 22:05:22 -0400 | [diff] [blame] | 30 | # Ensure the git commands run every time bitbake is invoked. |
| 31 | BB_DONT_CACHE = "1" |
Brad Bishop | e384d0c | 2017-07-24 20:24:28 -0400 | [diff] [blame] | 32 | # Make os-release available to other recipes. |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 33 | SYSROOT_DIRS:append = " ${sysconfdir}" |