From 63e109b75df30f42cc73079245436df01bb517a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:55:34 +0200 Subject: Adding debian version 2020.10.7-1. Signed-off-by: Daniel Baumann --- debian/copyright-check | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 debian/copyright-check (limited to 'debian/copyright-check') diff --git a/debian/copyright-check b/debian/copyright-check new file mode 100755 index 0000000..16c51b4 --- /dev/null +++ b/debian/copyright-check @@ -0,0 +1,66 @@ +#!/bin/sh +# Copyright 2020 Jonas Smedegaard +# Copyright 2020 Purism, SPC +# Description: helper script to update copyright_hints +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -eu + +# cleanup stray hint files from a previous run +find -type f -name '*:meta' -delete + +# omit files not copyright protected nor stating copyright or licensing +RE_omit='src/_locales/[a-zA-Z_]+/messages\.json' + +1>&2 echo 'extract metadata from binary files ...' +RE_meta='.*\.(png|ttf|woff2)' +exiftool '-textOut!' %d%f.%e:meta -short -short -recurse -ext png -ext ttf -ext woff2 . + +# TODO: automate more of this manual cleanup: +# * strip garbage copyright holders +# * optionally merge equally licensed Files sections +# * do "sort -k2 -k1,1 -u" on copyright holders +# * merge copyright years for each copyright holder +# TODO: strip files matching glob in current (only, no later) section +_licensecheck() { + GLOB=$1 + shift + case "$GLOB" in + '*') 1>&2 echo "check default section(s) ...";; + '') 1>&2 echo "check remaining upstream section(s) ...";; + *) 1>&2 echo "check section(s) $GLOB ...";; + esac + licensecheck --copyright --deb-machine --recursive --lines 0 "$@" -- * \ + | GLOB=$GLOB perl -0777 -p \ + -e 'BEGIN { our $GLOB = join "\n ", split(" ",$ENV{GLOB}) }' \ + -e 's/^.*?\n\nFiles: \K/$GLOB\n /s if $GLOB;' \ + -e 's/^.*?\n\nFiles: \K.*?(?=\n\w)/$GLOB/s if $GLOB and $GLOB =~ /^[*]\//;' \ + -e 's/^.*?\n\n//s unless $GLOB and $GLOB =~ /^[*]$/m;' \ + -e 's/^Files:\K /\n /mg;' \ + -e 's/^Copyright:\K /\n /mg;' \ + -e 's/(?:(?<=^ )|(?<=\d{4})),\K (?=\d{4})//mg;' \ + -e 's/:(?:meta|skip)$//mg;' \ + >> debian/copyright_hints +} + +rm -f debian/copyright_hints + +# check generally +# * omit non-copyright-protected Debian files +_licensecheck '*' --check '.*' --ignore "^($RE_omit|$RE_meta|debian/.*)$" +_licensecheck '*/debian' --check '^debian/' --ignore '^debian/(changelog|copyright(_hints)?|source/lintian-overrides)$' + +# cleanup hint files +find -type f -name '*:meta' -delete -- cgit v1.2.3