[oe] [PATCH] metadata_scm.bbclass: get the metadata revision for current HEAD

Khem Raj raj.khem at gmail.com
Wed Nov 3 22:40:35 UTC 2010


Currently we report wrong revision when we build from branches not based
on master because we only fetch the HEAD value which is remote master
This patch makes it to report the HEAD of whatever branch one has
checked out.

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 classes/metadata_scm.bbclass |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/classes/metadata_scm.bbclass b/classes/metadata_scm.bbclass
index ffc6a8a..37024b7 100644
--- a/classes/metadata_scm.bbclass
+++ b/classes/metadata_scm.bbclass
@@ -70,7 +70,8 @@ def base_get_metadata_git_branch(path, d):
 	return "<unknown>"
 
 def base_get_metadata_git_revision(path, d):
-	rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip()
+	branch = os.path.basename(base_get_metadata_git_branch(path, d))
+	rev = os.popen("cd %s; PATH=%s git show-ref HEAD %s 2>/dev/null" % (path, d.getVar("PATH", 1), branch)).read().split(" ")[0].rstrip()
 	if len(rev) != 0:
 		return rev
 	return "<unknown>"
-- 
1.7.1





More information about the Openembedded-devel mailing list