Thread (6 messages) 6 messages, 2 authors, 2012-02-21
STALE5238d
Revisions (2)
  1. v1 current
  2. v1 [diff vs current]

[PATCH 2/4] scripts/combo-layer: avoid error when config file is outside repo

From: Paul Eggleton <hidden>
Date: 2012-02-14 13:52:27
Subsystem: the rest · Maintainer: Linus Torvalds

Avoid displaying the error from the "git status" command we use to check
the status of the config file if the config file is outside of the
repository (a situation that is already handled).

Signed-off-by: Paul Eggleton <redacted>
---
 scripts/combo-layer |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 2fac1c9..8fb27f6 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -79,7 +79,7 @@ class Configuration(object):
             logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)")
             sys.exit(1)
 
-def runcmd(cmd,destdir=None):
+def runcmd(cmd,destdir=None,printerr=True):
     """
         execute command, raise CalledProcessError if fail
         return output if succeed
@@ -90,7 +90,8 @@ def runcmd(cmd,destdir=None):
         subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True)
     except subprocess.CalledProcessError,e:
         out.seek(0)
-        logger.error("%s" % out.read())
+        if printerr:
+            logger.error("%s" % out.read())
         raise e
 
     out.seek(0)
@@ -248,7 +249,7 @@ def action_update(conf, args):
     # Step 7: commit the updated config file if it's being tracked
     relpath = os.path.relpath(conf.conffile)
     try:
-        output = runcmd("git status --porcelain %s" % relpath)
+        output = runcmd("git status --porcelain %s" % relpath, printerr=False)
     except:
         # Outside the repository
         output = None
-- 
1.7.5.4


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help