Fix errors showing up with layers that aren't git repos
cover Fix errors showing up with layers that aren't git repos
This should really be applied to both master and jethro.
The following changes since commit e44ed8c18e395b9c055aefee113b90708e8a8a2f:
build-appliance-image: Update to jethro head revision (2015-11-03 14:02:57 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/metadata_scm
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/metadata_scm
Paul Eggleton (1):
classes/metadata_scm: fix git errors showing up on non-git
repositories
meta/classes/metadata_scm.bbclass | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/1 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].
--- meta/classes/metadata_scm.bbclass | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
meta/classes/metadata_scm.bbclass +10 -10
@@ -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()
Signature · 1 line
2.1.0