summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-11-09 14:40:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-11-24 15:49:16 +0000
commitf533c1bf4c6edbecc67f9e2c62fd475d64668e86 (patch)
tree545ea7dc5c0e338ef17dcbb57294ea33b22d814d /meta
parent6daf138822bbbc46960121d3b76b42eaf19e7c0e (diff)
downloadopenembedded-core-f533c1bf4c6edbecc67f9e2c62fd475d64668e86.tar.gz
openembedded-core-f533c1bf4c6edbecc67f9e2c62fd475d64668e86.tar.bz2
openembedded-core-f533c1bf4c6edbecc67f9e2c62fd475d64668e86.zip
classes/metadata_scm: fix git errors showing up on non-git repositories
Fixes the following error showing up for layers that aren't a git repo (or aren't parented by one): fatal: Not a git repository (or any of the parent directories): .git This was because we weren't intercepting stderr. We might as well just use bb.process.run() here which does that and returns stdout and stderr separately. (This was a regression that came in with OE-Core revision 3aac11076e22ac4fea48f5404110bb959547a9fe). Fixes [YOCTO #8661]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/metadata_scm.bbclass20
1 files changed, 10 insertions, 10 deletions
diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass
index 64465faa4c..0f7f4235a3 100644
--- a/meta/classes/metadata_scm.bbclass
+++ b/meta/classes/metadata_scm.bbclass
@@ -65,19 +65,19 @@ def base_get_metadata_svn_revision(path, d):
return revision
def base_get_metadata_git_branch(path, d):
- import subprocess
+ import bb.process
try:
- return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"],
- cwd=path).strip()
- except:
- return "<unknown>"
+ 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 subprocess
+ import bb.process
try:
- return subprocess.check_output(["git", "rev-parse", "HEAD"],
- cwd=path).strip()
- except:
- return "<unknown>"
+ rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
+ except bb.process.ExecutionError:
+ rev = '<unknown>'
+ return rev.strip()