Brad Bishop | 0244915 | 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 | |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 8 | def run_git(d, cmd): |
Brad Bishop | 6425ad2 | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 9 | try: |
| 10 | oeroot = d.getVar('COREBASE', True) |
Patrick Williams | 64cdbcf | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 11 | return bb.process.run(("export PSEUDO_DISABLED=1; " + |
| 12 | "git --work-tree %s --git-dir %s/.git %s") |
Brad Bishop | 6425ad2 | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 13 | % (oeroot, oeroot, cmd))[0].strip('\n') |
Patrick Williams | 64cdbcf | 2020-11-18 12:29:25 -0600 | [diff] [blame] | 14 | except Exception as e: |
| 15 | bb.warn("Unexpected exception from 'git' call: %s" % e) |
Brad Bishop | 6425ad2 | 2017-07-21 21:47:44 -0400 | [diff] [blame] | 16 | pass |
Brad Bishop | 7e3e11d | 2015-11-11 13:56:17 -0500 | [diff] [blame] | 17 | |
Patrick Williams | 5266d02 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 18 | VERSION_ID := "${@run_git(d, 'describe --dirty --long')}" |
| 19 | VERSION = "${@'-'.join(d.getVar('VERSION_ID').split('-')[0:2])}" |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 20 | |
Patrick Williams | 5266d02 | 2020-11-17 15:42:09 -0600 | [diff] [blame] | 21 | BUILD_ID := "${@run_git(d, 'describe --abbrev=0')}" |
| 22 | OPENBMC_TARGET_MACHINE = "${MACHINE}" |
Brad Bishop | a1e856b | 2015-11-19 22:06:41 -0600 | [diff] [blame] | 23 | |
Joseph Reynolds | e9319a8 | 2018-12-05 16:49:22 -0600 | [diff] [blame] | 24 | OS_RELEASE_FIELDS_append = " BUILD_ID OPENBMC_TARGET_MACHINE" |
Brad Bishop | 0244915 | 2017-07-21 22:05:22 -0400 | [diff] [blame] | 25 | |
| 26 | # Ensure the git commands run every time bitbake is invoked. |
| 27 | BB_DONT_CACHE = "1" |
Brad Bishop | e23b09a | 2017-07-24 20:24:28 -0400 | [diff] [blame] | 28 | |
| 29 | # Make os-release available to other recipes. |
| 30 | SYSROOT_DIRS_append = " ${sysconfdir}" |