From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751448AbdBWTLF (ORCPT ); Thu, 23 Feb 2017 14:11:05 -0500 Received: from smtprelay0213.hostedemail.com ([216.40.44.213]:36326 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751099AbdBWTLE (ORCPT ); Thu, 23 Feb 2017 14:11:04 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3653:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4385:4605:5007:6117:6120:7901:7903:8700:10004:10400:10848:11026:11232:11658:11914:12438:12555:12663:12740:12760:12895:13439:14096:14097:14180:14181:14659:14721:21060:21063:21080:21324:21433:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:5,LUA_SUMMARY:none X-HE-Tag: mind08_7d77cd628533 X-Filterd-Recvd-Size: 3049 Message-ID: <1487877052.14159.45.camel@perches.com> Subject: Re: [PATCH] checkpatch.pl: Add SPDX license tag check for dts files and headers From: Joe Perches To: Rob Herring Cc: "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andy Whitcroft Date: Thu, 23 Feb 2017 11:10:52 -0800 In-Reply-To: References: <20170223155644.24213-1-robh@kernel.org> <1487872274.14159.36.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-02-23 at 12:45 -0600, Rob Herring wrote: > On Thu, Feb 23, 2017 at 11:51 AM, Joe Perches wrote: > > On Thu, 2017-02-23 at 09:56 -0600, Rob Herring wrote: > > > Add a check for using SPDX-License-Identifier tags to define the license of > > > .dts{i} and DT header files rather than using free form license text. This > > > check looks for GPL, BSD, or X11(really incorrectly labeled MIT license) > > > license text which are the commonly used DT licenses. > > > > Hi Rob. > > > > > Signed-off-by: Rob Herring > > > Cc: Andy Whitcroft > > > Cc: Joe Perches > > > --- > > > scripts/checkpatch.pl | 13 +++++++++++++ > > > 1 file changed, 13 insertions(+) > > > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > > index 982c52ca6473..ce802b3146e3 100755 > > > --- a/scripts/checkpatch.pl > > > +++ b/scripts/checkpatch.pl > > > @@ -2139,6 +2139,7 @@ sub process { > > > my $commit_log_has_diff = 0; > > > my $reported_maintainer_file = 0; > > > my $non_utf8_charset = 0; > > > + my $licensefile = ''; > > > > Maybe this should be $spdx_license_file > > but what's the actual reason to check if > > multiple license bits are in a single file? > > Yes, just to get a single warning per file since the license matching > can get multiple hits. > > Really what I'd like to do is warn if an SPDX tag is not present in > any added file. Having a check for something missing doesn't really > work well with checkpatch at least in a scalable way that I saw. That isn't really possible with checkpatch as I'm sure you know that it looks at patch contexts and it isn't really meant to scan entire files. You might be better off with a separate script like the checkincludes.pl one. You might possibly integrate that script into checkpatch by looking at the "new file mode" block, remember those and see if in the patch each appropriate file has one of the spdx tags.