From patchwork Sat Dec 15 20:42:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 206642 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 509242C008E for ; Sun, 16 Dec 2012 07:43:37 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 50A064A10C; Sat, 15 Dec 2012 21:43:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VsneutVaPA1j; Sat, 15 Dec 2012 21:43:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DD3D4A132; Sat, 15 Dec 2012 21:42:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D344B4A0FC for ; Sat, 15 Dec 2012 21:42:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VATb7Wb6LcXX for ; Sat, 15 Dec 2012 21:42:50 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qc0-f202.google.com (mail-qc0-f202.google.com [209.85.216.202]) by theia.denx.de (Postfix) with ESMTPS id 15F974A103 for ; Sat, 15 Dec 2012 21:42:37 +0100 (CET) Received: by mail-qc0-f202.google.com with SMTP id s25so476319qcq.3 for ; Sat, 15 Dec 2012 12:42:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=rdWyBNa7D+JTX5gTj8f7Mbq24iHaD/FEJeHcMLumIH4=; b=YzMLtv3V3Kwl18frauGFYATDP9IaX96oGG5Y/jVqcXpB57nwr5ujZIeUoEd2CgK1OB Zvg3DqUS+06PZm6C4RmoNYzddVfluK71PnaPLOKYtij6GCISTXJvs4mv1oJvRbt8T9/b pvGkNb3q/qVdraTjQ18sUTA2DRAhiOc9OY68ecKMvLYxTtqAXhnLWo/Jvb6Xr2eUgz2K MDNxrgm3BfOOnMWRJn4qYKjcOBDgmK6j2dRqEg72T4Yim7RRGJsOrzSWXVx2sCK9KKv5 Hc+13Mb1oDwZEFK8kTp81FfR/zV8ev58Z/jeITvpHdsprLti9tASZUuDZojRlJGm/E2X L+/Q== Received: by 10.236.200.65 with SMTP id y41mr4771021yhn.36.1355604156704; Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id l20si759794yhi.2.2012.12.15.12.42.36 (version=TLSv1/SSLv3 cipher=AES128-SHA); Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 97BF4820050; Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 46D2A160C01; Sat, 15 Dec 2012 12:42:36 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Sat, 15 Dec 2012 12:42:05 -0800 Message-Id: <1355604128-12938-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1355604128-12938-1-git-send-email-sjg@chromium.org> References: <1355604128-12938-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkxjPrGtMw5QHHbxKV8h+Hjl2IgWqr9JK9BNEbHBL39r6a8tV2Oob8WPjEdUpc9NXHpt16VN1h91oUbvdPq0y+hoM9bjcu5wWz7jQMffYsLzfoaAcrUzoE8YWDBYXVkMNcEgIhSrBQAvxVP1lQwIBSflC5rG4S/HmKKEvek4/Dg23OZqRfZp4f203bsAIqkJm7HMqtq Cc: Tom Rini Subject: [U-Boot] [PATCH v2 5/8] patman: Allow commands to raise on error, or not X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Make raise_on_error a parameter so that we can control which commands raise and which do not. If we get an error reading the alias file, just continue. Signed-off-by: Simon Glass --- Changes in v2: None tools/patman/command.py | 17 +++++++++++------ tools/patman/gitutil.py | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/patman/command.py b/tools/patman/command.py index fc085f2..e6af6ed 100644 --- a/tools/patman/command.py +++ b/tools/patman/command.py @@ -42,7 +42,7 @@ class CommandResult: def RunPipe(pipe_list, infile=None, outfile=None, capture=False, capture_stderr=False, oneline=False, - cwd=None, **kwargs): + raise_on_error=True, cwd=None, **kwargs): """ Perform a command pipeline, with optional input/output filenames. @@ -63,6 +63,7 @@ def RunPipe(pipe_list, infile=None, outfile=None, result = CommandResult() last_pipe = None pipeline = list(pipe_list) + user_pipestr = '|'.join([' '.join(pipe) for pipe in pipe_list]) while pipeline: cmd = pipeline.pop(0) if last_pipe is not None: @@ -80,8 +81,10 @@ def RunPipe(pipe_list, infile=None, outfile=None, last_pipe = cros_subprocess.Popen(cmd, cwd=cwd, **kwargs) except Exception, err: result.exception = err - print 'exception', pipe_list, err - raise Exception("Error running '%s': %s" % (pipe_list, str)) + if raise_on_error: + raise Exception("Error running '%s': %s" % (user_pipestr, str)) + result.return_code = 255 + return result if capture: result.stdout, result.stderr, result.combined = ( @@ -91,15 +94,17 @@ def RunPipe(pipe_list, infile=None, outfile=None, result.return_code = last_pipe.wait() else: result.return_code = os.waitpid(last_pipe.pid, 0)[1] - if result.return_code: - raise Exception("Error running '%s'" % pipe_list) + if raise_on_error and result.return_code: + raise Exception("Error running '%s'" % user_pipestr) return result def Output(*cmd): - return RunPipe([cmd], capture=True).stdout + return RunPipe([cmd], capture=True, raise_on_error=False).stdout def OutputOneLine(*cmd, **kwargs): + raise_on_error = kwargs.pop('raise_on_error', True) return (RunPipe([cmd], capture=True, oneline=True, + raise_on_error=raise_on_error, **kwargs).stdout.strip()) def Run(*cmd, **kwargs): diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index e682e86..8bbf88f 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -352,7 +352,8 @@ def GetAliasFile(): Returns: Filename of git alias file, or None if none """ - fname = command.OutputOneLine('git', 'config', 'sendemail.aliasesfile') + fname = command.OutputOneLine('git', 'config', 'sendemail.aliasesfile', + raise_on_error=False) if fname: fname = os.path.join(GetTopLevel(), fname.strip()) return fname