Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351AbdLURXE (ORCPT ); Thu, 21 Dec 2017 12:23:04 -0500 Received: from smtprelay0125.hostedemail.com ([216.40.44.125]:50631 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751838AbdLURXA (ORCPT ); Thu, 21 Dec 2017 12:23:00 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3653:3867:3868:3870:3871:3872:4321:5007:6119:7550:7901:10004:10400:10848:11026:11232:11473:11658:11914:12043:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21080:21627:30054:30070: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:2,LUA_SUMMARY:none X-HE-Tag: beast05_8e62284d0d019 X-Filterd-Recvd-Size: 2088 Message-ID: <1513876977.4599.14.camel@perches.com> Subject: Re: [PATCH v4] checkpatch.pl: Add SPDX license tag check From: Joe Perches To: Rob Herring Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Andy Whitcroft , Greg Kroah-Hartman , Philippe Ombredanne Date: Thu, 21 Dec 2017 09:22:57 -0800 In-Reply-To: <20171221170413.qca3vnif5f62rqsk@rob-hp-laptop> References: <20171220234625.16521-1-robh@kernel.org> <1513837728.1234.146.camel@perches.com> <20171221170413.qca3vnif5f62rqsk@rob-hp-laptop> 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 Content-Length: 1089 Lines: 35 On Thu, 2017-12-21 at 11:04 -0600, Rob Herring wrote: > Okay, here's what I've ended up with: > > if ($realline == $checklicenseline) { > if ($realfile =~ /\.(?:sh|pl|py)/ && $rawline =~ /\[ \+]\s*\!\#/) { > $checklicenseline = 2; > } elsif ($rawline =~ /^\+/) { > my $comment = ""; > if ($realfile =~ /\.(h|s|S)$/) { > $comment = '/\*'; > } elsif ($realfile =~ /\.(c|dts|dtsi)$/) { > $comment = '//'; > } elsif ($realfile =~ /\.(sh|pl|py)$/) { > $comment = '#'; > } elsif ($realfile =~ /\.rst$/) { > $comment = '\.\.'; > } > > if ($comment !~ /^$/ && > $rawline !~ m@^\+$comment SPDX-License-Identifier: @) { > WARN("SPDX_LICENSE_TAG", > "Missing or malformed SPDX-License-Identifier tag in 1st (or 2nd for scripts) line\n" . > $herecurr); > } > } > } Seems sensible enough. Maybe it's better to use \Q$comment\E and a consistent style on comment and rawline Any checkpatch patch for license style requirements should not be applied until after Documentation/license-rules.rst is in -next.