From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D46C4363D for ; Tue, 6 Oct 2020 23:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB3DB208C7 for ; Tue, 6 Oct 2020 23:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbgJFXNI (ORCPT ); Tue, 6 Oct 2020 19:13:08 -0400 Received: from smtprelay0056.hostedemail.com ([216.40.44.56]:48658 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725970AbgJFXNH (ORCPT ); Tue, 6 Oct 2020 19:13:07 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id C0F1C18224D9C; Tue, 6 Oct 2020 23:13:06 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: wave94_1c0276c271ca X-Filterd-Recvd-Size: 2049 Received: from XPS-9350 (unknown [172.58.19.215]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Tue, 6 Oct 2020 23:13:05 +0000 (UTC) Message-ID: <307a7581abe24135ac243c3080d4ab9e7c044cbf.camel@perches.com> Subject: git grep/sed to standardize "/* SPDX-License-Identifier: " From: Joe Perches To: LKML Cc: Linus Torvalds , Jiri Kosina Date: Tue, 06 Oct 2020 16:13:03 -0700 Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Almost all source files in the kernel use a standardized SPDX header at line 1 with a comment /* initiator and terminator */: /* SPDX-License-Identifier: */ $ git grep -PHn '^/\* SPDX-License-Identifier:.*\*/\s*$' | \ wc -l 17847 $ git grep -PHn '^/\* SPDX-License-Identifier:.*\*/\s*$' | \ grep ":1:" | cut -f1 -d":" | grep -oP '\.\w+$' | \ sort | uniq -c | sort -rn 16769 .h 972 .S 87 .c 6 .lds 3 .l 2 .y 2 .py 2 .dtsi 1 .sh 1 .dts 1 .cpp 1 .bc But about 2% of the files do not use a use comment termination at line 1 and use either: /* SPDX-License-Identifier: * additional comment or blank or /* SPDX-License-Identifier: $ git grep -PHn '^/\* SPDX-License-Identifier:(?!.*\*/\s*$)' | \ wc -l 407 $ git grep -PHn '^/\* SPDX-License-Identifier:(?!.*\*/\s*$)' | \ grep '\:1:' | cut -f1 -d':' | grep -oP '\.\w+$' | \ sort | uniq -c | sort -rn 357 .h 34 .S 16 .c Here's a trivial script to convert and standardize the first and second lines of these 407 files to make it easier to categorize and sort. $ git grep -PHn '^/\* SPDX-License-Identifier:(?!.*\*/\s*$)' | \ grep ':1:' | cut -f1 -d":" | \ xargs sed -i -e '1s@[[:space:]]*$@ */@' -r -e '2s@^( \*|)@/*@'