blob: 33e56e416fdc011979777e1c7ab5125b60000e08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
CORECDP_METADATA_SCM = "${@corecdp_get_scm(d)}"
CORECDP_METADATA_REVISION = "${@corecdp_get_scm_revision(d)}"
CORECDP_METADATA_BRANCH = "${@corecdp_get_scm_branch(d)}"
def corecdp_get_scm(d):
from bb import which
baserepo = os.path.dirname(os.path.dirname(os.path.dirname(which(d.getVar("BBPATH", 1), "classes/base.bbclass"))))
for (scm, scmpath) in {"svn": ".svn",
"git": ".git",
"monotone": "_MTN"}.iteritems():
if os.path.exists(os.path.join(baserepo, scmpath)):
return "%s %s" % (scm, baserepo)
return "<unknown> %s" % baserepo
def corecdp_get_scm_revision(d):
(scm, path) = d.getVar("CORECDP_METADATA_SCM", 1).split()
try:
if scm != "<unknown>":
return globals()["base_get_metadata_%s_revision" % scm](path, d)
else:
return scm
except KeyError:
return "<unknown>"
def corecdp_get_scm_branch(d):
(scm, path) = d.getVar("CORECDP_METADATA_SCM", 1).split()
try:
if scm != "<unknown>":
return globals()["base_get_metadata_%s_branch" % scm](path, d)
else:
return scm
except KeyError:
return "<unknown>"
|