Marcel Telka
2023-11-09 57944575029c02b4b3c8475738295c3d2484ea03
tools/license-detector: case insensitive matching

21 files modified
101 ■■■■ changed files
tools/license-detector 3 ●●●● patch | view | raw | blame | history
tools/licenses/header.Apache-2.0.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/header.MPL-2.0.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.0BSD.filter 2 ●●● patch | view | raw | blame | history
tools/licenses/license.Apache-2.0.filter 2 ●●● patch | view | raw | blame | history
tools/licenses/license.BSD-2-Clause.filter 8 ●●●● patch | view | raw | blame | history
tools/licenses/license.BSD-3-Clause-Modification.filter 2 ●●● patch | view | raw | blame | history
tools/licenses/license.BSD-3-Clause.filter 10 ●●●● patch | view | raw | blame | history
tools/licenses/license.GPL-2.0-only.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.GPL-3.0-only.filter 2 ●●● patch | view | raw | blame | history
tools/licenses/license.HPND.filter 10 ●●●● patch | view | raw | blame | history
tools/licenses/license.ISC.filter 10 ●●●● patch | view | raw | blame | history
tools/licenses/license.LGPL-2.0-only.filter 6 ●●●● patch | view | raw | blame | history
tools/licenses/license.LGPL-2.1-only.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.LGPL-3.0-only.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.MIT-0.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.MIT.filter 10 ●●●● patch | view | raw | blame | history
tools/licenses/license.MPL-2.0.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.PSF-2.0.filter 4 ●●●● patch | view | raw | blame | history
tools/licenses/license.Unlicense.filter 2 ●●● patch | view | raw | blame | history
tools/licenses/license.ZPL-2.1.filter 2 ●●● patch | view | raw | blame | history
tools/license-detector
@@ -91,8 +91,9 @@
            | sed -E -e 's/[[:space:]]+/ /g' -e 's/^ //' -e 's/ \$//' -e '/^\$/d' \\
    EOF
    # Apply filter if any
    [[ -x "$l.filter" ]] && printf '\t| %s \\\n' "$l.filter" >> "$TMPFILE"
    [[ -x "$l.filter" ]] && printf '\t| LC_ALL=C %s \\\n' "$l.filter" >> "$TMPFILE"
    cat <<#EOF >> "$TMPFILE"
            | LC_ALL=C tr '[:upper:]' '[:lower:]' \\
            | tr ' ' '\\n' | fmt
    EOF
tools/licenses/header.Apache-2.0.filter
@@ -16,5 +16,5 @@
#
sed -n \
    -e 's/\(Copyright\) .*/\1 REPLACEABLE/' \
    -e '/^Copyright/,/^Unless required by applicable law or agreed to in writing,/p'
    -e 's/\(Copyright\) .*/\1 REPLACEABLE/I' \
    -e '/^Copyright/I,/^Unless required by applicable law or agreed to in writing,/Ip'
tools/licenses/header.MPL-2.0.filter
@@ -16,5 +16,5 @@
#
sed -n \
    -e 's/^.*\(This Source Code Form is subject\)/\1/' \
    -e '/Mozilla Public License, v\. 2\.0/p'
    -e 's/^.*\(This Source Code Form is subject\)/\1/I' \
    -e '/Mozilla Public License, v\. 2\.0/Ip'
tools/licenses/license.0BSD.filter
@@ -16,4 +16,4 @@
#
sed -n \
    -e '/^Permission to use, copy, modify,/,/^THE SOFTWARE IS PROVIDED/p'
    -e '/^Permission to use, copy, modify,/I,/^THE SOFTWARE IS PROVIDED/Ip'
tools/licenses/license.Apache-2.0.filter
@@ -16,4 +16,4 @@
#
sed -n \
    -e '/Definitions\./,/Accepting Warranty or Additional Liability\./p'
    -e '/Definitions\./I,/Accepting Warranty or Additional Liability\./Ip'
tools/licenses/license.BSD-2-Clause.filter
@@ -19,7 +19,7 @@
    -e 's/`\{1,2\}/"/g' -e "s/'\{1,2\}/\"/g" \
    -e 's/[12]\./*/g' \
    -e 's/\* *//g' \
    -e 's/\(THIS SOFTWARE IS PROVIDED BY\).*\("AS IS" AND ANY\).*\(OR IMPLIED WARRANTIES\)/\1 REPLACEABLE \2 REPLACEABLE \3/' \
    -e 's/\(IN NO EVENT SHALL\).*\(BE LIABLE\)/\1 REPLACEABLE \2/' \
    -e 's/^.*\(Redistribution and use\)/\1/' \
    -e '/^Redistribution and use/,/^THIS SOFTWARE/p'
    -e 's/\(THIS SOFTWARE IS PROVIDED BY\).*\("AS IS" AND ANY\).*\(OR IMPLIED WARRANTIES\)/\1 REPLACEABLE \2 REPLACEABLE \3/I' \
    -e 's/\(IN NO EVENT SHALL\).*\(BE LIABLE\)/\1 REPLACEABLE \2/I' \
    -e 's/^.*\(Redistribution and use\)/\1/I' \
    -e '/^Redistribution and use/I,/^THIS SOFTWARE/Ip'
tools/licenses/license.BSD-3-Clause-Modification.filter
@@ -18,4 +18,4 @@
sed -n \
    -e 's/``/"/g' -e "s/''/\"/g" \
    -e 's/[123]\.//g' \
    -e '/^Redistribution and use/,/^THIS SOFTWARE/p'
    -e '/^Redistribution and use/I,/^THIS SOFTWARE/Ip'
tools/licenses/license.BSD-3-Clause.filter
@@ -19,9 +19,9 @@
    -e 's/``/"/g' -e "s/''/\"/g" \
    -e 's/[123]\./*/g' \
    -e 's/- /* /g' \
    -e 's/^Neither/* &/' \
    -e 's/\*[^*]*\(be used to endorse or promote products\)/* REPLACEABLE \1/' \
    -e 's/^Neither/* &/I' \
    -e 's/\*[^*]*\(be used to endorse or promote products\)/* REPLACEABLE \1/I' \
    -e 's/\* *//g' \
    -e 's/\(THIS SOFTWARE IS PROVIDED BY\).*\("AS IS" AND ANY\).*\(OR IMPLIED WARRANTIES\)/\1 REPLACEABLE \2 REPLACEABLE \3/' \
    -e 's/\(IN NO EVENT SHALL\).*\(BE LIABLE\)/\1 REPLACEABLE \2/' \
    -e '/^Redistribution and use/,/^THIS SOFTWARE/p'
    -e 's/\(THIS SOFTWARE IS PROVIDED BY\).*\("AS IS" AND ANY\).*\(OR IMPLIED WARRANTIES\)/\1 REPLACEABLE \2 REPLACEABLE \3/I' \
    -e 's/\(IN NO EVENT SHALL\).*\(BE LIABLE\)/\1 REPLACEABLE \2/I' \
    -e '/^Redistribution and use/I,/^THIS SOFTWARE/Ip'
tools/licenses/license.GPL-2.0-only.filter
@@ -16,8 +16,8 @@
#
sed -n \
    -e 's/^GNU GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/' \
    -e '/^Copyright (C) 1989, 1991 Free Software Foundation, Inc\./,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/p'
    -e 's/^GNU GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/I' \
    -e '/^Copyright (C) 1989, 1991 Free Software Foundation, Inc\./I,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/Ip'
# We allow alternative GPL-2.0 wording
# see https://github.com/spdx/license-list-XML/issues/2204
tools/licenses/license.GPL-3.0-only.filter
@@ -16,4 +16,4 @@
#
sed -n \
    -e '/^Copyright (C) 2007 Free Software Foundation, Inc\./,/^If the disclaimer of warranty and limitation of liability/p'
    -e '/^Copyright (C) 2007 Free Software Foundation, Inc\./I,/^If the disclaimer of warranty and limitation of liability/Ip'
tools/licenses/license.HPND.filter
@@ -16,8 +16,8 @@
#
sed -n \
    -e 's/\(the above copyright notice\) .* \(in all copies\)/\1 REPLACEABLE \2/' \
    -e 's/\(all copies\), and \(that both\)/\1 \2/' \
    -e 's/\(that both\) \(that \)\{0,1\}\(the \)\{0,1\}\(copyright notice\)/\1 \4/' \
    -e 's/\(appear in supporting documentation\).*/\1/' \
    -e '/^Permission to use, copy, modify and distribute this software/p'
    -e 's/\(the above copyright notice\) .* \(in all copies\)/\1 REPLACEABLE \2/I' \
    -e 's/\(all copies\), and \(that both\)/\1 \2/I' \
    -e 's/\(that both\) \(that \)\{0,1\}\(the \)\{0,1\}\(copyright notice\)/\1 \4/I' \
    -e 's/\(appear in supporting documentation\).*/\1/I' \
    -e '/^Permission to use, copy, modify and distribute this software/Ip'
tools/licenses/license.ISC.filter
@@ -16,8 +16,8 @@
#
sed -n \
    -e 's/and \{0,1\}\/or distribute/and distribute/' \
    -e 's/\(AND\) .* \(DISCLAIMS ALL WARRANTIES\)/\1 REPLACEABLE \2/' \
    -e 's/\(IN NO EVENT SHALL\) .* \(BE LIABLE FOR ANY\)/\1 REPLACEABLE \2/' \
    -e '/^Permission to use, copy, modify/,/^THE SOFTWARE IS PROVIDED/p' \
    -e '/^THE SOFTWARE IS PROVIDED/q'
    -e 's/and \{0,1\}\/or distribute/and distribute/I' \
    -e 's/\(AND\) .* \(DISCLAIMS ALL WARRANTIES\)/\1 REPLACEABLE \2/I' \
    -e 's/\(IN NO EVENT SHALL\) .* \(BE LIABLE FOR ANY\)/\1 REPLACEABLE \2/I' \
    -e '/^Permission to use, copy, modify/I,/^THE SOFTWARE IS PROVIDED/Ip' \
    -e '/^THE SOFTWARE IS PROVIDED/Iq'
tools/licenses/license.LGPL-2.0-only.filter
@@ -16,9 +16,9 @@
#
sed -n \
    -e 's/.*\(Everyone is permitted\)/\1/' \
    -e 's/^GNU LIBRARY GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/' \
    -e '/^Everyone is permitted/,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/p'
    -e 's/.*\(Everyone is permitted\)/\1/I' \
    -e 's/^GNU LIBRARY GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/I' \
    -e '/^Everyone is permitted/I,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/Ip'
# We allow alternative LGPL-2.0 wording
# see https://github.com/spdx/license-list-XML/issues/2204
tools/licenses/license.LGPL-2.1-only.filter
@@ -16,8 +16,8 @@
#
sed -n \
    -e 's/^GNU LESSER GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/' \
    -e '/^Copyright (C) 1991, 1999 Free Software Foundation, Inc\./,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/p'
    -e 's/^GNU LESSER GENERAL PUBLIC LICENSE \(TERMS AND CONDITIONS\)/\1/I' \
    -e '/^Copyright (C) 1991, 1999 Free Software Foundation, Inc\./I,/IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW/Ip'
# We allow alternative LGPL-2.1 wording
# see https://github.com/spdx/license-list-XML/issues/2204
tools/licenses/license.LGPL-3.0-only.filter
@@ -16,5 +16,5 @@
#
gsed -u \
    -e '0,/^GNU LESSER GENERAL PUBLIC LICENSE/d' \
    -e '/^If the Library as you received it specifies that a proxy/q' ; cat > /dev/null
    -e '0,/^GNU LESSER GENERAL PUBLIC LICENSE/Id' \
    -e '/^If the Library as you received it specifies that a proxy/Iq' ; cat > /dev/null
tools/licenses/license.MIT-0.filter
@@ -17,5 +17,5 @@
sed -E -n \
    -e 's/“/"/g' -e 's/”/"/g' -e 's/``/"/g' -e 's/'\'\''/"/g' \
    -e '/^Permission is hereby granted/,/^THE SOFTWARE/p' \
    -e '/^THE SOFTWARE/q'
    -e '/^Permission is hereby granted/I,/^THE SOFTWARE/Ip' \
    -e '/^THE SOFTWARE/Iq'
tools/licenses/license.MIT.filter
@@ -17,8 +17,8 @@
sed -E -n \
    -e 's/“/"/g' -e 's/”/"/g' -e 's/``/"/g' -e 's/'\'\''/"/g' \
    -e 's/(obtaining a copy of).*(\(the "Software"\))/\1 REPLACEABLE \2/' \
    -e 's/(this permission notice).*(shall be included)/\1 \2/' \
    -e 's/(IN NO EVENT SHALL).*(BE LIABLE)/\1 REPLACEABLE \2/' \
    -e '/^Permission is hereby granted/,/^THE SOFTWARE/p' \
    -e '/^THE SOFTWARE/q'
    -e 's/(obtaining a copy of).*(\(the "Software"\))/\1 REPLACEABLE \2/I' \
    -e 's/(this permission notice).*(shall be included)/\1 \2/I' \
    -e 's/(IN NO EVENT SHALL).*(BE LIABLE)/\1 REPLACEABLE \2/I' \
    -e '/^Permission is hereby granted/I,/^THE SOFTWARE/Ip' \
    -e '/^THE SOFTWARE/Iq'
tools/licenses/license.MPL-2.0.filter
@@ -19,5 +19,5 @@
    -e 's/ \(\* \)\{1,\}/ /g' -e 's/^\* //' -e 's/ \*$//' \
    -e 's/ -\{3,\} / /g' -e 's/ -\{3,\}$//' \
    -e 's/ \*\{3,\} / /g' -e 's/^\*\{3,\} //' -e 's/ \*\{3,\}$//' -e '/^\*\{3,\}$/d' \
    -e 's/^\([abc]\)\. /(\1) /g' \
    -e '/Definitions$/,/Exhibit B of this License must be attached\.$/p'
    -e 's/^\([abc]\)\. /(\1) /Ig' \
    -e '/Definitions$/I,/Exhibit B of this License must be attached\.$/Ip'
tools/licenses/license.PSF-2.0.filter
@@ -17,5 +17,5 @@
sed -n \
    -e 's/^[1-8]\. \{1,\}//' \
    -e 's/\(Copyright (c)\) .* \(Python Software Foundation\)/\1 \2/' \
    -e '/^This LICENSE AGREEMENT is between the Python Software Foundation/,/By copying, installing or otherwise using Python/p'
    -e 's/\(Copyright (c)\) .* \(Python Software Foundation\)/\1 \2/I' \
    -e '/^This LICENSE AGREEMENT is between the Python Software Foundation/I,/By copying, installing or otherwise using Python/Ip'
tools/licenses/license.Unlicense.filter
@@ -16,4 +16,4 @@
#
sed -n \
    -e '/^This is free and unencumbered software/,/^THE SOFTWARE IS PROVIDED/p'
    -e '/^This is free and unencumbered software/I,/^THE SOFTWARE IS PROVIDED/Ip'
tools/licenses/license.ZPL-2.1.filter
@@ -16,4 +16,4 @@
#
sed -n \
    -e '/^Redistribution and use in source and binary forms,/,/^THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS/p'
    -e '/^Redistribution and use in source and binary forms,/I,/^THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS/Ip'