Re: [PATCH] xfs: convert to SPDX license tags

Dave Chinner
2018-05-31T05:04:29Z

> ---

This was mostly scripted. The awk script below did the majority
of the work, but I manually modified fs/xfs/Makefile (different
comment format) and fs/xfs/libxfs/xfs_fs.h (LGPL 2.1 license,
not GPL 2.0).

Awk script:

$ cat hdr.awk
BEGIN {
print "// SPDX-License-Identifier: GPL-2.0"
hdr = 1.0;
}

/^ \* This program is free software/ {
hdr = 2.0;
next
}

/^ \*\// {
print $0
hdr = 0.0
next
}

/^ \* / {
if (hdr > 1.0)
next
print $0
next
}

/^ \*/ {
if (hdr > 0.0)
next
print $0
next
}

// {
print $0
}

END { }
$

Script was run like so:

for f in `git grep -l "GNU General" fs/xfs/` ; do \
echo $f ; \
cat $f | awk -f hdr.awk > $f.new; \
mv -f $f.new $f; \
done

And then I fixed up the remaining files.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com