Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Set DISTRO_VERSION and SDK_VERSION from git describe
- #
- DISTRO_VERSION = "${@get_custom_distro_version(d)}"
- def get_custom_distro_version(d):
- import os
- import bb
- datetime = d.getVar('DATETIME')
- persist = bb.persist_data.persist('custom', d)
- key = 'distro_version_git'
- # Check if we have a valid cached value
- if key in persist and ':' in persist[key]:
- cached_datetime, cached_ver = persist[key].split(':', maxsplit=1)
- if cached_datetime == datetime:
- return cached_ver
- srcdir = os.path.abspath(os.path.join(d.getVar('BBLAYERS_FETCH_DIR'), '..'))
- try:
- ver, _ = bb.process.run('git describe --tags --dirty --long 2>/dev/null', cwd=srcdir)
- ver = ver.strip()
- except bb.process.ExecutionError:
- bb.warn("Unable to set DISTRO_VERSION from git describe. Using '0.0'.")
- ver = '0.0'
- bb.warn(f"Caching DISTRO_VERSION='{ver}' for build date {datetime}")
- persist[key] = f"{datetime}:{ver}"
- return ver
- # Do not include date/time in hash, since this is only used to detect different bitbake runs
- get_custom_distro_version[vardepsexclude] = "DATETIME"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement