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}" |
| 9 | |
Brad Bishop | 05ce9c5 | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 10 | def run_git(d, cmd): |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 11 | try: |
Patrick Williams | 460ca24 | 2021-09-10 22:32:22 -0500 | [diff] [blame] | 12 | oeroot = d.getVar('OS_RELEASE_ROOTPATH', True) |
Patrick Williams | bc442de | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 13 | return bb.process.run(("export PSEUDO_DISABLED=1; " + |
| 14 | "git --work-tree %s --git-dir %s/.git %s") |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 15 | % (oeroot, oeroot, cmd))[0].strip('\n') |
Patrick Williams | bc442de | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 16 | except Exception as e: |
| 17 | bb.warn("Unexpected exception from 'git' call: %s" % e) |
Brad Bishop | 7019fbe | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 18 | pass |
Brad Bishop | be86180 | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 19 | |
Patrick Williams | 24d05d0 | 2021-06-30 16:15:45 -0500 | [diff] [blame] | 20 | # 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. |
| 26 | PHOSPHOR_OS_RELEASE_DISTRO_VERSION := "${@run_git(d, 'describe --dirty')}" |
| 27 | DISTRO_VERSION ??= "${PHOSPHOR_OS_RELEASE_DISTRO_VERSION}" |
| 28 | |
Patrick Williams | 46d9de3 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 29 | VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}" |
Brad Bishop | 05ce9c5 | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 30 | |
Patrick Williams | 46d9de3 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 31 | OPENBMC_TARGET_MACHINE = "${MACHINE}" |
Brad Bishop | 05ce9c5 | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 32 | |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 33 | OS_RELEASE_FIELDS:append = " BUILD_ID OPENBMC_TARGET_MACHINE EXTENDED_VERSION" |
Brad Bishop | ba47094 | 2017-07-21 22:05:22 -0400 | [diff] [blame] | 34 | |
| 35 | # Ensure the git commands run every time bitbake is invoked. |
| 36 | BB_DONT_CACHE = "1" |
Brad Bishop | e384d0c | 2017-07-24 20:24:28 -0400 | [diff] [blame] | 37 | |
| 38 | # Make os-release available to other recipes. |
Patrick Williams | 12fc939 | 2021-08-06 09:16:53 -0500 | [diff] [blame] | 39 | SYSROOT_DIRS:append = " ${sysconfdir}" |