From patchwork Thu Jan 10 02:00:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Bendebury X-Patchwork-Id: 210920 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 0DFDB2C0172 for ; Thu, 10 Jan 2013 13:25:33 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24DFA4A114; Thu, 10 Jan 2013 03:25:30 +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 IzNp2maFY+dO; Thu, 10 Jan 2013 03:25:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B20624A0C7; Thu, 10 Jan 2013 03:25:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 308AA4A0C7 for ; Thu, 10 Jan 2013 03:25:27 +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 wOTxXVxNdkSC for ; Thu, 10 Jan 2013 03:25:26 +0100 (CET) X-Greylist: delayed 1509 seconds by postgrey-1.27 at theia; Thu, 10 Jan 2013 03:25:24 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-wi0-f201.google.com (mail-wi0-f201.google.com [209.85.212.201]) by theia.denx.de (Postfix) with ESMTPS id 4E9864A0C5 for ; Thu, 10 Jan 2013 03:25:24 +0100 (CET) Received: by mail-wi0-f201.google.com with SMTP id hm2so2175wib.0 for ; Wed, 09 Jan 2013 18:25:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=pWpDSMHJUt06NrNDI/j8ULL6GBobcw3vTs7aWxF9qbY=; b=Z22jzy19uQC3owYhyq1QsBos036LVc7a2c7Shq91VOc8RVWRCH6ngasLN7aDmtis9B 09N4gCGVjLl388KOcVpEMYM9VLMLzr+TQk94u1Q0UhKOyZi86T/X8ULIi0zNopFWPsCV PhY2N1sNXRL4iY896mw51r7cUtcajCoR2KA70cNE0NpGAkRHIbfGQUsqmzbuLxFrOM88 3uduBolyiz1iPcXV0KZuG5QTBmSUZo5iUL8oiPCfbirIdv86yqjlIVbCvkTZavHmf2bl bq3RnfShnSTBAr3rs8z0i4Y5upuBtoCXkRsJk+tbTZUui2TAyUjVhuuUb0DiDVEzCGVs zKYQ== X-Received: by 10.14.0.196 with SMTP id 44mr88003467eeb.6.1357783214067; Wed, 09 Jan 2013 18:00:14 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z44si61620een.0.2013.01.09.18.00.13 (version=TLSv1 cipher=AES128-SHA bits=128/128); Wed, 09 Jan 2013 18:00:14 -0800 (PST) Received: from eskimo.mtv.corp.google.com (eskimo.mtv.corp.google.com [172.22.73.100]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 551D3200057; Wed, 9 Jan 2013 18:00:13 -0800 (PST) Received: by eskimo.mtv.corp.google.com (Postfix, from userid 41370) id 9CBF52210AC; Wed, 9 Jan 2013 18:00:12 -0800 (PST) From: Vadim Bendebury To: u-boot@lists.denx.de Date: Wed, 9 Jan 2013 18:00:10 -0800 Message-Id: <1357783210-2108-1-git-send-email-vbendeb@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQnrUBDuiXMdHayJcg2J5bBotAT/9AbUvYWbc/Wwvkp3TxnUsKnBuvEAIp+GtfFRAK5SqU5kp4X5fxyK3FsVp6jlv9aBFWgJZhwNt1w/4d+xLHIxCjZHaoJ7J3EY7z7wreao1E5cPqGCkb12Q+E+E34JHLab0fEs8wf+bUyWYqFHE3e3XyziQ1t8c0wdzZlmDVR8tXOH Cc: Vadim Bendebury Subject: [U-Boot] [PATCH v4] patman: Allow use outside of u-boot tree 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 To make it usable in git trees not providing a patch checker implementation, add a command line option, allowing to suppress patch check. While we are at it, sort debug options alphabetically. Also, do not raise an exception if checkpatch.pl is not found - just print an error message suggesting to use the new option, and return nonzero status. . unit test passes: $ ./patman -t . successfully used patman in the autotest tree to generate a patch email (with --no-check option) . successfully used patman in the u-boot tree to generate a patch email . `patman --help' now shows command line options ordered alphabetically Signed-off-by: Vadim Bendebury Acked-by: Doug Anderson Acked-by: Simon Glass --- Changes in v4: . now properly corrected typo in the error message Changes in v3: . corrected typo in the error message Changes in v2: . addressed comments WRT use of double negative . added code to gracefully handle absence of checkpatch.cl tools/patman/checkpatch.py | 10 +++++----- tools/patman/patman.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index f72f8ee..d3a0477 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -23,6 +23,7 @@ import command import gitutil import os import re +import sys import terminal def FindCheckPatch(): @@ -47,8 +48,10 @@ def FindCheckPatch(): if os.path.isfile(fname): return fname path = os.path.dirname(path) - print 'Could not find checkpatch.pl' - return None + + print >> sys.stderr, ('Cannot find checkpatch.pl - please put it in your ' + + '~/bin directory or use --no-check') + sys.exit(1) def CheckPatch(fname, verbose=False): """Run checkpatch.pl on a file. @@ -67,9 +70,6 @@ def CheckPatch(fname, verbose=False): error_count, warning_count, lines = 0, 0, 0 problems = [] chk = FindCheckPatch() - if not chk: - raise OSError, ('Cannot find checkpatch.pl - please put it in your ' + - '~/bin directory') item = {} stdout = command.Output(chk, '--no-tree', fname) #pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) diff --git a/tools/patman/patman.py b/tools/patman/patman.py index e56dd01..e049081 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -50,6 +50,9 @@ parser.add_option('-i', '--ignore-errors', action='store_true', help='Send patches email even if patch errors are found') parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run', default=False, help="Do a try run (create but don't email patches)") +parser.add_option('-p', '--project', default=project.DetectProject(), + help="Project name; affects default option values and " + "aliases [default: %default]") parser.add_option('-s', '--start', dest='start', type='int', default=0, help='Commit to start creating patches from (0 = HEAD)') parser.add_option('-t', '--test', action='store_true', dest='test', @@ -58,11 +61,11 @@ parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False, help='Verbose output of errors and warnings') parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store', default=None, help='Output cc list for patch file (used by git)') +parser.add_option('--no-check', action='store_false', dest='check_patch', + default=True, + help="Don't check for patch compliance") parser.add_option('--no-tags', action='store_false', dest='process_tags', default=True, help="Don't process subject tags as aliaes") -parser.add_option('-p', '--project', default=project.DetectProject(), - help="Project name; affects default option values and " - "aliases [default: %default]") parser.usage = """patman [options] @@ -146,7 +149,10 @@ else: series.DoChecks() # Check the patches, and run them through 'git am' just to be sure - ok = checkpatch.CheckPatches(options.verbose, args) + if options.check_patch: + ok = checkpatch.CheckPatches(options.verbose, args) + else: + ok = True if not gitutil.ApplyPatches(options.verbose, args, options.count + options.start): ok = False