瀏覽代碼

scripts/combo-layer: avoid error when config file is outside repo

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).

(From OE-Core rev: 9d3e54057673348e85ba479705c4ffaad56973d6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Paul Eggleton 13 年之前
父節點
當前提交
f273c04175
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      scripts/combo-layer

+ 4 - 3
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)")
             logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)")
             sys.exit(1)
             sys.exit(1)
 
 
-def runcmd(cmd,destdir=None):
+def runcmd(cmd,destdir=None,printerr=True):
     """
     """
         execute command, raise CalledProcessError if fail
         execute command, raise CalledProcessError if fail
         return output if succeed
         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)
         subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True)
     except subprocess.CalledProcessError,e:
     except subprocess.CalledProcessError,e:
         out.seek(0)
         out.seek(0)
-        logger.error("%s" % out.read())
+        if printerr:
+            logger.error("%s" % out.read())
         raise e
         raise e
 
 
     out.seek(0)
     out.seek(0)
@@ -233,7 +234,7 @@ def action_update(conf, args):
     # Step 7: commit the updated config file if it's being tracked
     # Step 7: commit the updated config file if it's being tracked
     relpath = os.path.relpath(conf.conffile)
     relpath = os.path.relpath(conf.conffile)
     try:
     try:
-        output = runcmd("git status --porcelain %s" % relpath)
+        output = runcmd("git status --porcelain %s" % relpath, printerr=False)
     except:
     except:
         # Outside the repository
         # Outside the repository
         output = None
         output = None