Skip to contentSkip to conversation

metadata_scm.bbclass: restore capture of stderr

PATCH In review Christopher Larson 2 participants 2 messages Nov 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 metadata_scm.bbclass: restore capture of stderr

From: Christopher Larson <[email protected]>

We don't want the user to see errors from the git commands run by metadata_scm on their console, so we need to capture or suppress stderr as well as stdout. This was the case prior to the rewrite of the git hash logic, but the 2>&1 was lost when it was reworked. Bring it back to avoid messages like this in builds with non-git layers:

fatal: Not a git repository (or any of the parent directories): .git

---
 meta/classes/metadata_scm.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/metadata_scm.bbclass +2 -2
index 64465fa..a8152f7 100644
@@ -69,7 +69,7 @@ def base_get_metadata_git_branch(path, d):
 
     try:
         return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"],
-                                       cwd=path).strip()
+                                       cwd=path, stderr=subprocess.STDOUT).strip()
     except:
         return "<unknown>"
 
@@ -78,6 +78,6 @@ def base_get_metadata_git_revision(path, d):
 
     try:
         return subprocess.check_output(["git", "rev-parse", "HEAD"],
-                                       cwd=path).strip()
+                                       cwd=path, stderr=subprocess.STDOUT).strip()
     except:
         return "<unknown>"
Signature · 1 line
2.2.1
#1 lore raw

Ignore this, Paul has a pending patch for it.

Quoted 49 lines · Christopher Larson

From: Christopher Larson <[email protected]>

We don't want the user to see errors from the git commands run by metadata_scm
on their console, so we need to capture or suppress stderr as well as stdout.
This was the case prior to the rewrite of the git hash logic, but the 2>&1 was
lost when it was reworked. Bring it back to avoid messages like this in builds
with non-git layers:

fatal: Not a git repository (or any of the parent directories): .git

---
 meta/classes/metadata_scm.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/metadata_scm.bbclass +1 -1
index 64465fa..a8152f7 100644
@@ -69,7 +69,7 @@ def base_get_metadata_git_branch(path, d):
 
     try:
         return subprocess.check_output(["git", "rev-parse",
 "--abbrev-ref", "HEAD"],
-                                       cwd=path).strip()
+                                       cwd=path,
 stderr=subprocess.STDOUT).strip()
     except:

return "<unknown>"

meta/classes/metadata_scm.bbclass +1 -1
@@ -78,6 +78,6 @@ def base_get_metadata_git_revision(path, d):
 
     try:
         return subprocess.check_output(["git", "rev-parse", "HEAD"],
-                                       cwd=path).strip()
+                                       cwd=path,
 stderr=subprocess.STDOUT).strip()
     except:

return "<unknown>"
--
2.2.1