poky/meta/classes/metadata_scm.bbclass
Richard Purdie f702509017 metadata_scm: Drop orphaned monotone functions
Its been 'a while' since we used monotone, drop these revision
function remnants.

(From OE-Core rev: f1c77ab87b3c16d14deff801f48292ed348da637)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-14 11:14:39 +00:00

43 lines
1.2 KiB
Plaintext

METADATA_BRANCH ?= "${@base_detect_branch(d)}"
METADATA_REVISION ?= "${@base_detect_revision(d)}"
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()