From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753484AbdKIS1q (ORCPT ); Thu, 9 Nov 2017 13:27:46 -0500 Received: from smtprelay0121.hostedemail.com ([216.40.44.121]:33472 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751219AbdKIS1p (ORCPT ); Thu, 9 Nov 2017 13:27:45 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1605:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2828:2911:3138:3139:3140:3141:3142:3622:3653:3742:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4425:4605:5007:6117:6119:6691:7901:7903:8531:10004:10400:10848:11232:11658:11914:12555:12663:12740:12760:12895:13161:13229:13439:14181:14659:14721:21080:21433:21627:30054:30060:30070:30075:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: egg31_91d1c0eab905 X-Filterd-Recvd-Size: 3950 Message-ID: <1510252060.15768.66.camel@perches.com> Subject: Re: [PATCH] checkpatch.pl: Add SPDX license tag check From: Joe Perches To: Rob Herring Cc: Linux Kernel Mailing List , Andy Whitcroft , Greg Kroah-Hartman Date: Thu, 09 Nov 2017 10:27:40 -0800 In-Reply-To: References: <20171109011047.20040-1-robh@kernel.org> <1510193419.15768.37.camel@perches.com> <1510241963.15768.57.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-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-11-09 at 12:12 -0600, Rob Herring wrote: > On Thu, Nov 9, 2017 at 9:39 AM, Joe Perches wrote: > > On Thu, 2017-11-09 at 07:47 -0600, Rob Herring wrote: > > > On Wed, Nov 8, 2017 at 8:10 PM, Joe Perches wrote: > > > > On Wed, 2017-11-08 at 19:10 -0600, Rob Herring wrote: > > > > > Add a check warning if SPDX-License-Identifier tags are not used in > > > > > newly added files. > > > > > > > > If this is to be done, and I think it's not a great idea, > > > > > > Which part? SPDX tags or checking new files or just using checkpatch for this? > > > > SPDX tags in all files. Is having an SPDX tag in every file really desired? > > > > There's no real way to check a patch for this. > > > > You have to check the entire file. > > Changing existing files is a separate problem. There is a script for > that (though the data file is not public). I'm only worried with new > files here because that's what I review and have to tell folks to > replace their 2 pages of license text with SPDX tags. (It will be much > easier to just tell them to run checkpatch. ;) ). > > > checkpatch could, as you've done, scan for new files > > against /dev/null, but a single patch can add > > multiple files and each newly added file should have > > a missing SPDX indicator check. > > I was going with the easy route of just giving one warning per patch. > I'd hope that's enough info for folks to figure out what's needed from > there. However, it should be possible to make it per file. The main > complication is we need to look for either '^+++' or the end of the > patch which I didn't see an easy/clean way to do. EOF is easy. There already is a $realfile test for start of file. > > My concern is that there are ~50,000 files in the > > kernel source tree and, after that scripted patch > > adding the tags, only about a quarter of them have > > an SPDX tag. > > > > So which files actually _need_ a SPDX tag? > > > > files in -next with an SPDX tag: > > > > $ git grep --name-only -i -P "spdx-licen[cs]e-identifier" | \ > > while read file ; do basename $file ; done | \ > > sed -r -e 's/^.*(\..*)/\1/' | \ > > sort | uniq -c | sort -rn | head -10 > > 7514 .h > > 3435 .c > > 1193 Makefile > > 486 .S > > 221 .dts > > 186 Kconfig > > 185 .dtsi > > 97 .sh > > 34 .tc > > 24 .debug > > > > vs all files in -next (not Documentation/) > > > > $ git ls-files | grep -v "^Documentation/" | \ > > while read file ; do basename $file ; done | \ > > sed -r -e 's/^.*(\..*)/\1/' | \ > > sort | uniq -c | sort -rn | head -10 > > 25946 .c > > 20360 .h > > 2437 Makefile > > 1454 .S > > 1442 .dts > > 1380 Kconfig > > 1099 .dtsi > > 207 .json > > 204 .gitignore > > 194 .sh > >