diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-11-09 14:40:08 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-11-24 15:50:26 +0000 |
commit | 43c8867b63462fc94b09d01cd8fe4252c003f787 (patch) | |
tree | 4b28a05330e13f0e2dc9660d735363169e4d9c28 /meta/classes/metadata_scm.bbclass | |
parent | 59b27d558febc42e5f127a7f27f6c0de73a61e30 (diff) | |
download | poky-43c8867b63462fc94b09d01cd8fe4252c003f787.tar.gz |
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].
(From OE-Core rev: f533c1bf4c6edbecc67f9e2c62fd475d64668e86)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/metadata_scm.bbclass')
-rw-r--r-- | meta/classes/metadata_scm.bbclass | 20 |
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): | |||
65 | return revision | 65 | return revision |
66 | 66 | ||
67 | def base_get_metadata_git_branch(path, d): | 67 | def base_get_metadata_git_branch(path, d): |
68 | import subprocess | 68 | import bb.process |
69 | 69 | ||
70 | try: | 70 | try: |
71 | return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], | 71 | rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path) |
72 | cwd=path).strip() | 72 | except bb.process.ExecutionError: |
73 | except: | 73 | rev = '<unknown>' |
74 | return "<unknown>" | 74 | return rev.strip() |
75 | 75 | ||
76 | def base_get_metadata_git_revision(path, d): | 76 | def base_get_metadata_git_revision(path, d): |
77 | import subprocess | 77 | import bb.process |
78 | 78 | ||
79 | try: | 79 | try: |
80 | return subprocess.check_output(["git", "rev-parse", "HEAD"], | 80 | rev, _ = bb.process.run('git rev-parse HEAD', cwd=path) |
81 | cwd=path).strip() | 81 | except bb.process.ExecutionError: |
82 | except: | 82 | rev = '<unknown>' |
83 | return "<unknown>" | 83 | return rev.strip() |