Files
poky/meta/classes/metadata_scm.bbclass
Richard Purdie d2f1390c9c metadata_scm: Fix signature handling of METADATA_REVISION and METADATA_BRANCH
We're not interested in the dependencies of these functions and what
those functions look like, we're interested in the value the variable has.

Force the hashed value to be the actual value from the function. This
means using METADATA_REVISION in DISTRO_VERSION for example now
correctly rebuilds when it changes value.

(From OE-Core rev: 005651dc782859c01f170fb974811b2a13cb2cef)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-12-09 17:32:51 +00:00

45 lines
1.3 KiB
Plaintext

METADATA_BRANCH ?= "${@base_detect_branch(d)}"
METADATA_BRANCH[vardepvalue] = "${METADATA_BRANCH}"
METADATA_REVISION ?= "${@base_detect_revision(d)}"
METADATA_REVISION[vardepvalue] = "${METADATA_REVISION}"
def base_detect_revision(d):
path = base_get_scmbasepath(d)
return base_get_metadata_git_revision(path, d)
def base_detect_branch(d):
path = base_get_scmbasepath(d)
return base_get_metadata_git_branch(path, d)
def base_get_scmbasepath(d):
return os.path.join(d.getVar('COREBASE'), 'meta')
def base_get_metadata_svn_revision(path, d):
# This only works with older subversion. For newer versions
# this function will need to be fixed by someone interested
revision = "<unknown>"
try:
with open("%s/.svn/entries" % path) as f:
revision = f.readlines()[3].strip()
except (IOError, IndexError):
pass
return revision
def base_get_metadata_git_branch(path, d):
import bb.process
try:
rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
except bb.process.ExecutionError:
rev = '<unknown>'
return rev.strip()
def base_get_metadata_git_revision(path, d):
import bb.process
try:
rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
except bb.process.ExecutionError:
rev = '<unknown>'
return rev.strip()