From patchwork Fri Jul 14 10:57:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 788331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x88pH6Hs3z9s78 for ; Fri, 14 Jul 2017 20:59:35 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7AE57B8E; Fri, 14 Jul 2017 10:57:47 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9DB19B68 for ; Fri, 14 Jul 2017 10:57:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1F53DCE for ; Fri, 14 Jul 2017 10:57:46 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OT200DH9UG8VK10@mailout1.w1.samsung.com> for ovs-dev@openvswitch.org; Fri, 14 Jul 2017 11:57:44 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170714105743eucas1p274247aebd0ddec8923598016b51a62d8~RLTa1U7KO2526225262eucas1p25; Fri, 14 Jul 2017 10:57:43 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 27.EF.04729.7A3A8695; Fri, 14 Jul 2017 11:57:43 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170714105743eucas1p199372e8b188cbd56a8f379dafafcb569~RLTaKq8Xf0472704727eucas1p1I; Fri, 14 Jul 2017 10:57:43 +0000 (GMT) X-AuditID: cbfec7f4-f79806d000001279-8f-5968a3a749f7 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E5.98.17452.7A3A8695; Fri, 14 Jul 2017 11:57:43 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OT2002XQUFQ3220@eusync2.samsung.com>; Fri, 14 Jul 2017 11:57:43 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org, Ben Pfaff Date: Fri, 14 Jul 2017 13:57:23 +0300 Message-id: <1500029844-846-4-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1500029844-846-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsWy7djPc7rLF2dEGqzbq2bxanIDo8W0z7fZ La60/2S3mPvpOaMDi8ezm/8ZPZ5f62Hx6NuyijGAOYrLJiU1J7MstUjfLoEr48fNKUwFV3kq Lk3+w9zAuJSzi5GTQ0LARGLP5ZuMELaYxIV769lAbCGBpYwSR1ZIdzFyAdmfGSXuLd/E3sXI Adbw/oAkRHwZo8TBWVcZIZxmJolph2exg3SzCehInFp9BGyqCFDDsqnfwKYyCwRL7Fh/DMwW FnCWuH5sPhOIzSKgKrH87Dowm1fAReLZl5/MEBfJSdw81wlmcwq4ShyaNJsFZJmEwBk2iZa2 NlaIi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C6YklqdmpqQWpRTB9 TBycUg2Mtrx5n1J/bTm8Vjxwsd+3qV++bzScs7H7+PSpjUd3z93ANGW1lo5xcbNEzKSJzGw/ tl++ULq+637Anat2Ga8vPOINdKsPFin4o7d6wcWah4xnOGM8zm1me/Mqt1NCnfvg/t3iCydv 2pCh7xEpbZqiufVwR8zx89MPvuufYjVZW96x33y+ZOGcIiWW4oxEQy3mouJEALZ6WydjAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170714105743eucas1p199372e8b188cbd56a8f379dafafcb569 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G+yCvOyEseyghOyekBtMZWFkaW5nIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbTGVhZGluZyBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170714105743eucas1p199372e8b188cbd56a8f379dafafcb569 X-RootMTR: 20170714105743eucas1p199372e8b188cbd56a8f379dafafcb569 References: <1500029844-846-1-git-send-email-i.maximets@samsung.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Heetae Ahn Subject: [ovs-dev] [PATCH 3/4] checkpatch: Allow checking more than one file. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Currently to check more than one patch or file it's required to invoke script for each file separately. Fix that by iterating over all the passed filenames. Note: If '-f' option passed, all the files treated as usual files. Without '-f' all the files treated as patch files. Signed-off-by: Ilya Maximets Acked-by: Aaron Conole --- utilities/checkpatch.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 4a92890..7ccec51 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -408,7 +408,7 @@ def usage(): Open vSwitch checkpatch.py Checks a patch for trivial mistakes. usage: -%s [options] [PATCH | -f SOURCE | -1 | -2 | ...] +%s [options] [PATCH1 [PATCH2 ...] | -f SOURCE1 [SOURCE2 ...] | -1 | -2 | ...] Input options: -f|--check-file Arguments are source files, not patches. @@ -513,13 +513,18 @@ if __name__ == '__main__': status = -1 sys.exit(status) - try: - filename = args[0] - except: + if not args: if sys.stdin.isatty(): usage() sys.exit(-1) result = ovs_checkpatch_parse(sys.stdin.read(), '-') ovs_checkpatch_print_result(result) sys.exit(result) - sys.exit(ovs_checkpatch_file(filename)) + + status = 0 + for filename in args: + print('== Checking "%s" ==' % filename) + result = ovs_checkpatch_file(filename) + if result: + status = -1 + sys.exit(status)