mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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
3aac11076e).
Fixes [YOCTO #8661].
(From OE-Core master rev: f533c1bf4c6edbecc67f9e2c62fd475d64668e86)
(From OE-Core rev: 8968ede9c8cdcd2cbf13bd5bba95883082189908)
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>
This commit is contained in:
committed by
Richard Purdie
parent
cb0ca7264d
commit
777451ca43
@@ -65,19 +65,19 @@ def base_get_metadata_svn_revision(path, d):
|
|||||||
return revision
|
return revision
|
||||||
|
|
||||||
def base_get_metadata_git_branch(path, d):
|
def base_get_metadata_git_branch(path, d):
|
||||||
import subprocess
|
import bb.process
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
|
||||||
cwd=path).strip()
|
except bb.process.ExecutionError:
|
||||||
except:
|
rev = '<unknown>'
|
||||||
return "<unknown>"
|
return rev.strip()
|
||||||
|
|
||||||
def base_get_metadata_git_revision(path, d):
|
def base_get_metadata_git_revision(path, d):
|
||||||
import subprocess
|
import bb.process
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output(["git", "rev-parse", "HEAD"],
|
rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
|
||||||
cwd=path).strip()
|
except bb.process.ExecutionError:
|
||||||
except:
|
rev = '<unknown>'
|
||||||
return "<unknown>"
|
return rev.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user