diff options
author | Thomas Haller <thaller@redhat.com> | 2020-04-16 10:29:44 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-04-16 10:54:48 (GMT) |
commit | 503aa5e026a60d217ce389b857ce136748bd55f1 (patch) | |
tree | be6257e2b62d29d863f4f73f8e09c25d2e58c8b0 /tests | |
parent | 4333aef8cbed802d099bbab02ff5cbca0d1f2eb4 (diff) | |
download | libnl-503aa5e026a60d217ce389b857ce136748bd55f1.zip libnl-503aa5e026a60d217ce389b857ce136748bd55f1.tar.gz libnl-503aa5e026a60d217ce389b857ce136748bd55f1.tar.bz2 |
license: fix and add SPDX license identifiers and drop license comments
This also fixes a few wrong SPDX license identifiers, where the original
license comment indicates GPL-2.0-only.
This is not done manually, but by running the following script:
---
#!/bin/bash
# Tool to drop license comments, adding SPDX license identifiers, while preserving
# copyright comments. The point is not to manually do this task, but perform some
# hacked up string replacement.
_cp() {
/bin/cp "$@"
}
_cat() {
/bin/cat "$@"
}
in_file() {
local T=$(mktemp)
_cp -f "$1" "$T"
_cat "$T"
rm -f "$T"
}
out_file() {
local T=$(mktemp)
_cat - > "$T"
_cp -f "$T" "$1"
rm -f "$T"
}
join() {
_cat "$@" | awk '{ printf("%s#x#", $0)}'
}
unjoin() {
_cat - | sed 's/#x#/\n/g'
}
files_all() {
git ls-files |
grep -v '\.png$' |
grep -v '^include/linux-private/'
}
adjust() {
NEWLINES='\(#x#\)\+'
COPYRIGHTS='\(\( \* Copyright (c) 20..\(-20..\|, 20..\)\? [^#]\+#x#\)\+\( \*#x# \* \(Stolen[^#]*\|Based on [^#]*\)#x#\)\?\)'
_cat - |
\
sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' |
\
sed '1s%^/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x##x#%' |
\
sed '1s%^\(\)/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' |
\
sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU General Public License as#x# \*[ ]\+published by the Free Software Foundation version 2 of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: GPL-2.0-only \*/#x#/*#x#\2 */#x##x#%'
}
FILES=( $(files_all) )
for f in "${FILES[@]}"; do
echo "processing \"$f\"..."
in_file "$f" | join | adjust | unjoin | out_file "$f"
done
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-addr.c | 8 | ||||
-rw-r--r-- | tests/check-all.c | 8 | ||||
-rw-r--r-- | tests/check-attr.c | 8 | ||||
-rw-r--r-- | tests/test-complex-HTB-with-hash-filters.c | 8 | ||||
-rw-r--r-- | tests/test-u32-filter-with-actions.c | 8 |
5 files changed, 5 insertions, 35 deletions
diff --git a/tests/check-addr.c b/tests/check-addr.c index 48a2d93..22dfd8b 100644 --- a/tests/check-addr.c +++ b/tests/check-addr.c @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * tests/check-addr.c nl_addr unit tests - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/tests/check-all.c b/tests/check-all.c index 7b738da..f9c75c4 100644 --- a/tests/check-all.c +++ b/tests/check-all.c @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * tests/check-all.c overall unit test program - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/tests/check-attr.c b/tests/check-attr.c index 0390997..1c85282 100644 --- a/tests/check-attr.c +++ b/tests/check-attr.c @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * tests/check-attr.c nla_attr unit tests - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Thomas Graf <tgraf@suug.ch> */ diff --git a/tests/test-complex-HTB-with-hash-filters.c b/tests/test-complex-HTB-with-hash-filters.c index b1bf36e..016d467 100644 --- a/tests/test-complex-HTB-with-hash-filters.c +++ b/tests/test-complex-HTB-with-hash-filters.c @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * test/test-complex-HTB-with-hash-filters.c Add HTB qdisc, HTB classes and creates some hash filters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2011 Adrian Ban <adrian.ban@mantech.ro> */ diff --git a/tests/test-u32-filter-with-actions.c b/tests/test-u32-filter-with-actions.c index 514533b..17e7bdc 100644 --- a/tests/test-u32-filter-with-actions.c +++ b/tests/test-u32-filter-with-actions.c @@ -1,11 +1,5 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ /* - * test/tests-u32-with-actions.c Add ingress qdisc, create some hash filters, and add redirect action - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com> * * Stolen from tests/test-complex-HTB-with-hash-filters.c |