summaryrefslogtreecommitdiff
path: root/multitech/classes
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2011-10-03 13:15:36 -0500
committerJesse Gilles <jgilles@multitech.com>2011-10-03 13:15:36 -0500
commit5384b9a4b2571d9e2cfd7a1597cbd826d360dd7f (patch)
tree73173f147d6d818a7d6662e6ca98a1e0aa189671 /multitech/classes
parent4fbb01d342509dfae734647b20504230ce5c8f01 (diff)
added corecdp_metadata_scm.bbclass which provides CORECDP_METADATA_SCM
Diffstat (limited to 'multitech/classes')
-rw-r--r--multitech/classes/corecdp_metadata_scm.bbclass34
1 files changed, 34 insertions, 0 deletions
diff --git a/multitech/classes/corecdp_metadata_scm.bbclass b/multitech/classes/corecdp_metadata_scm.bbclass
new file mode 100644
index 0000000..33e56e4
--- /dev/null
+++ b/multitech/classes/corecdp_metadata_scm.bbclass
@@ -0,0 +1,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>"
+