Re: [patch 0/4] genirq: Clean up license information

From: Joe Perches
Date: Thu Mar 15 2018 - 13:35:19 EST


On Thu, 2018-03-15 at 18:23 +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 15, 2018 at 08:00:18AM -0700, Joe Perches wrote:
> > On Wed, 2018-03-14 at 22:15 +0100, Thomas Gleixner wrote:
> > > The following patch series cleans up the licensing information in the
> > > generic irq subsystem.
> > >
> > > * Replace boiler plate language and sloppy references with SPDX
> > >
> > > * Add missing SPDX identifiers to files with no license reference
> > >
> > > * Use the proper tag format
> > >
> > > While at it clean up the top of file comments by removing pointless
> > > references to the filename itself and condense the information where
> > > appropriate.
> >
> > Hello.
> >
> > What do you think of the proposal to convert all the tags
> > to the "-or-later" and "-only" variants that the
> > https://spdx.org/licenses/ uses today?
>
> Ick ick ick ick. Let's stick with what we have today, if we do decide
> to do this type of foolishness,

Why would it be foolish to have the kernel
match the spdx license text?

> we can do it all in one simple script to
> email to Linus to run on his tree.

I sent that script Feb 8.

Here it is again:
---
#!/bin/bash

license_script=$(mktemp -t convert-SPDX-licenses.XXXXXXXXX.pl)
cat <<'EOF' >> $license_script

our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;

sub deparenthesize {
my ($string) = @_;

return "" if (!defined($string));

while ($string =~ /^\s*\(.*\)\s*$/) {
$string =~ s@^\s*\(\s*@@;
$string =~ s@\s*\)\s*$@@;
}

return $string;
}

for my $filename (@ARGV) {
my $FILE;

if ($filename eq '-') {
open($FILE, '<&STDIN');
} else {
open($FILE, '<', "$filename") ||
die "$P: $filename: open failed - $!\n";
}
undef $/;
my $file = <$FILE>;
close $FILE;

my $spdx = "SPDX-License-Identifier:";

$file =~ s/\b$spdx[ \t]*((?:\([ \t]*)*)GPL(\d\.\d)/$spdx \1GPL-\2/g;
$file =~ s/\b$spdx[ \t]*((?:\([ \t]*)*)(L?GPL-\d\.\d)\+/$spdx \1\2-or-later/g;
$file =~ s/\b$spdx[ \t]*((?:\([ \t]*)*)(L?GPL-\d\.\d)(?!-or-later|-only)/$spdx \1\2-only/g;

while ($file =~ s/\b$spdx[ \t]($balanced_parens)(?![ \t]*AND|[ \t]*OR)/$spdx . ' ' . deparenthesize($1)/ex) {
;
}

if ($filename eq '-') {
open($FILE, '>&STDOUT');
} else {
open($FILE, '>', "$filename") ||
die "$P: $filename: open failed - $!\n";
}
print $FILE $file;
close $FILE;
}
EOF

git grep --name-only "$spdx" | \
grep -vP "^(?:LICENSES/|Documentation/process/license-rules\.rst)" | \
xargs perl $license_script

rm -f $license_script