[oe-commits] Daniel Markus : socorro-syms: Correct the extraction of repository branch

git at git.openembedded.org git at git.openembedded.org
Mon Apr 13 11:11:13 UTC 2015


Module: meta-openembedded.git
Branch: fido-next
Commit: 4aed3580d0b1b7e46c754ecaf55644381a799690
URL:    http://git.openembedded.org/?p=meta-openembedded.git&a=commit;h=4aed3580d0b1b7e46c754ecaf55644381a799690

Author: Daniel Markus <daniel.markus at leica-geosystems.com>
Date:   Tue Mar 31 14:59:57 2015 +0200

socorro-syms: Correct the extraction of repository branch

When a recipe has git-cloned source code to compile, it may be checked out with
a detached HEAD. The current VCS information extraction in socorro-syms
incorrectly assumes a detached HEAD belongs to the master branch.

With the proper git command we find the branch the detached HEAD belongs to and
use that in the Socorro link.

Signed-off-by: Daniel Markus <daniel.markus at leica-geosystems.com>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>

---

 meta-oe/classes/socorro-syms.bbclass | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/meta-oe/classes/socorro-syms.bbclass b/meta-oe/classes/socorro-syms.bbclass
index 0312031..7a7b208 100644
--- a/meta-oe/classes/socorro-syms.bbclass
+++ b/meta-oe/classes/socorro-syms.bbclass
@@ -148,12 +148,10 @@ def git_repository_path(source_file_path):
     url_match = re.search(".*(://|@)([^:/]*).*", source_long_url)
     source_server = url_match.group(2)
 
-    # (2) Get the branch for this file. If it's detached and just shows HEAD
-    # then set it to master and hope we can get the correct revision from there.
-    source_branch = run_command(
-        "git rev-parse --abbrev-ref HEAD", source_file_dir)
-    if source_branch == "HEAD":
-        source_branch = "master"
+    # (2) Get the branch for this file.
+    source_branch_list = run_command("git show-branch --list", source_file_dir)
+    source_branch_match = re.search(".*?\[(.*?)\].*", source_branch_list)
+    source_branch = source_branch_match.group(1)
 
     # (3) Since the repo root directory name can be changed without affecting
     # git, we need to extract the name from something more reliable.



More information about the Openembedded-commits mailing list