inherit mirrors
inherit utils
inherit utility-tasks
-inherit metadata_scm
inherit logging
OE_EXTRA_IMPORTS ?= ""
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust ${OE_EXTRA_IMPORTS}"
+OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}"
OE_IMPORTS[type] = "list"
PACKAGECONFIG_CONFARGS ??= ""
# We need the oe module name space early (before INHERITs get added)
OE_IMPORTED := "${@oe_import(d)}"
+inherit metadata_scm
+
def lsb_distro_identifier(d):
adjust = d.getVar('LSB_DISTRO_ADJUST')
adjust_func = None
def get_layers_branch_rev(d):
layers = (d.getVar("BBLAYERS") or "").split()
layers_branch_rev = ["%-20s = \"%s:%s\"" % (os.path.basename(i), \
- base_get_metadata_git_branch(i, None).strip(), \
- base_get_metadata_git_revision(i, None)) \
+ oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
+ oe.buildcfg.get_metadata_git_revision(i, None)) \
for i in layers]
i = len(layers_branch_rev)-1
p1 = layers_branch_rev[i].find("=")
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
layers = (d.getVar("BBLAYERS") or "").split()
medadata_revs = ["%-17s = %s:%s%s" % (os.path.basename(i), \
- base_get_metadata_git_branch(i, None).strip(), \
- base_get_metadata_git_revision(i, None), \
+ oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
+ oe.buildcfg.get_metadata_git_revision(i, None), \
buildhistory_get_modified(i)) \
for i in layers]
return '\n'.join(medadata_revs)
def get_layer_revs(d):
layers = (d.getVar("BBLAYERS") or "").split()
medadata_revs = ["%-17s = %s:%s %s" % (os.path.basename(i), \
- base_get_metadata_git_branch(i, None).strip(), \
- base_get_metadata_git_revision(i, None), \
+ oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
+ oe.buildcfg.get_metadata_git_revision(i, None), \
get_layer_git_status(i)) \
for i in layers]
return '\n'.join(medadata_revs)
-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()
-
-METADATA_BRANCH := "${@base_detect_branch(d)}"
+METADATA_BRANCH := "${@oe.buildcfg.detect_branch(d)}"
METADATA_BRANCH[vardepvalue] = "${METADATA_BRANCH}"
-METADATA_REVISION := "${@base_detect_revision(d)}"
+METADATA_REVISION := "${@oe.buildcfg.detect_revision(d)}"
METADATA_REVISION[vardepvalue] = "${METADATA_REVISION}"
data['target_sys'] = e.data.getVar("TARGET_SYS")
data['failures'] = []
data['component'] = " ".join(e.getPkgs())
- data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data))
+ data['branch_commit'] = str(oe.buildcfg.detect_branch(e.data)) + ": " + str(oe.buildcfg.detect_revision(e.data))
data['bitbake_version'] = e.data.getVar("BB_VERSION")
data['layer_version'] = get_layers_branch_rev(e.data)
data['local_conf'] = get_conf_data(e, 'local.conf')
--- /dev/null
+
+import subprocess
+import bb.process
+
+def detect_revision(d):
+ path = get_scmbasepath(d)
+ return get_metadata_git_revision(path, d)
+
+def detect_branch(d):
+ path = get_scmbasepath(d)
+ return get_metadata_git_branch(path, d)
+
+def get_scmbasepath(d):
+ return os.path.join(d.getVar('COREBASE'), 'meta')
+
+def 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 get_metadata_git_branch(path, d):
+ try:
+ rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
+ except bb.process.ExecutionError:
+ rev = '<unknown>'
+ return rev.strip()
+
+def get_metadata_git_revision(path, d):
+ try:
+ rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
+ except bb.process.ExecutionError:
+ rev = '<unknown>'
+ return rev.strip()
+