-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP]: Add copyright acknowledgements to distributed files
This doesn't detect the dual FTL _OR_ GPL2+ licencing of freetype since its per file HEADERs only refer to "the FreeType project license, LICENSE.TXT", which details the dual licensing. Also some exclude rules were added for files not actually included in the binaries, but having additional licenses or borking licensecheck's copyright detection
- Loading branch information
Showing
7 changed files
with
992 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Tab seperated list of default license | ||
# and if given copyrightholder per project | ||
subtitlesoctopus Expat 2017 JavascriptSubtitlesOctopus contributors | ||
|
||
brotli Expat 2009, 2010, 2013-2016 by the Brotli Authors | ||
expat Expat 2000-2017 Expat development team / 1997-2000 Thai Open Source Software Center Ltd | ||
libass ISC 2006-2016 libass contributors | ||
fontconfig NTP~disclaimer 2000-2007 Keith Packard / 2005 Patrick Lam / 2009 Roozbeh Pournader / 2008,2009 Red Hat, Inc. / 2008 Danilo Šegan / 2012 Google, Inc. | ||
|
||
fribidi LGPL-2.1+ | ||
harfbuzz MIT~old | ||
freetype FTL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/sh | ||
|
||
# Copyright 2021 Oneric | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Postprocesses the output of licensecheck to automatically | ||
# generate our distribution notice. | ||
# licensecheck is packaged in Debian and its derivatives | ||
# and can be obtained from CPAN everywhere. | ||
|
||
usage() { | ||
echo "$0 <map file> <project name> <dir>" >&2 | ||
exit 1 | ||
} | ||
|
||
set -eu | ||
|
||
FINDOPTS="${FINDOPTS:-}" | ||
tabulator="$(printf '\t')" | ||
|
||
if [ "$#" -ne 3 ] || [ ! -e "$3" ] \ | ||
|| [ ! -e "$1" ] || [ -d "$1" ] ; then | ||
usage | ||
fi | ||
|
||
def_license="$(awk 'BEGIN{FS="\t+"} /^'"$2"'/ {print $2" | "$3}' "$1")" | ||
def_copy="${def_license#* | }" | ||
def_license="${def_license%% | *}" | ||
base_dir="$3" | ||
|
||
if [ -z "$def_license" ] || [ "$def_license" = "$def_copy" ] ; then | ||
echo "The map file appears to be borked or entry is missing!" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -z "$def_copy" ] ; then | ||
echo "Files: ${base_dir}/*" | ||
echo "Copyright: $def_copy" | ||
echo "License: $def_license" | ||
echo "" | ||
fi | ||
|
||
find "$base_dir" $FINDOPTS -type f -regextype egrep -regex '.*\.(c|h|cpp|hpp|js)$' -exec \ | ||
licensecheck --machine --copyright --deb-fmt '{}' \; \ | ||
| awk -F"$tabulator" -v base_dir="$base_dir" -v def_license="$def_license" -v def_copy="$def_copy" ' | ||
# If requiring GNU Awk we could use proper multi arrays (and have delete before Issue 8) | ||
BEGIN { | ||
split("", lcfiles) # Clear array with only pre-Issue 8 POSIX | ||
SUBSEP = sprintf("\n") # Seperator for pseudo-multidim arrays | ||
} | ||
1 { | ||
if ($2 == "UNKNOWN") | ||
if (def_license) { | ||
$2 = def_license | ||
}else { | ||
print "ERROR: Unlicensed file "$1" matched!" | "cat>&2" | ||
print " If there is no default license, then" | "cat>&2" | ||
print " reporting this upstream might be a good idea." | "cat>&2" | ||
exit 1 | ||
} | ||
if ($3 == "*No copyright*") { | ||
if (def_copy) { | ||
$3 = def_copy | ||
} else if (def_license != $2) { # temp override this for def license because freetype | ||
print "ERROR: Orphaned file "$1" and no default attribution!" | "cat>&2" | ||
#exit 1 | ||
} | ||
} | ||
if ($2 == def_license && $3 == def_copy) | ||
next | ||
if (lcfiles[$2, $3]) | ||
lcfiles[$2, $3] = lcfiles[$2, $3]" "$1 # RFC: maybe another delimiter, eg newline? | ||
else | ||
lcfiles[$2, $3] = $1 | ||
} | ||
END { | ||
for(lc in lcfiles) { | ||
split(lc, lico, SUBSEP) | ||
printf "Files: %s\n", lcfiles[lc] | ||
printf "Copyright: %s\n", lico[2] | ||
printf "License: %s\n", lico[1] | ||
printf "\n" | ||
} | ||
} | ||
' |
Oops, something went wrong.