Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/debian/cdbs/1/rules/copyright-check.mk
diff options
context:
space:
mode:
Diffstat (limited to 'debian/cdbs/1/rules/copyright-check.mk')
-rw-r--r--debian/cdbs/1/rules/copyright-check.mk26
1 files changed, 22 insertions, 4 deletions
diff --git a/debian/cdbs/1/rules/copyright-check.mk b/debian/cdbs/1/rules/copyright-check.mk
index 645363b..d96681a 100644
--- a/debian/cdbs/1/rules/copyright-check.mk
+++ b/debian/cdbs/1/rules/copyright-check.mk
@@ -28,6 +28,9 @@ include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), devscripts (>= 2.10.7)
+# Set to yes to fail on changed/new hints are found
+#DEB_COPYRIGHT_CHECK_STRICT := yes
+
# Single regular expression for files to include or ignore
DEB_COPYRIGHT_CHECK_REGEX = .*
DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^(debian/.*|(.*/)?config\.(guess|sub|rpath)(\..*)?)$
@@ -35,13 +38,17 @@ DEB_COPYRIGHT_CHECK_IGNORE_REGEX = ^(debian/.*|(.*/)?config\.(guess|sub|rpath)(\
pre-build:: debian/stamp-copyright-check
debian/stamp-copyright-check:
- @echo 'Scanning upstream source for new/changed copyright notices (except debian subdir!)...'
+ @echo 'Scanning upstream source for new/changed copyright notices...'
+ @echo licensecheck -c '$(DEB_COPYRIGHT_CHECK_REGEX)' -r --copyright -i '$(DEB_COPYRIGHT_CHECK_IGNORE_REGEX)' * \
+ "| some-output-filtering..."
# Perl in shell in make requires extra care:
# * Single-quoting ('...') protects against shell expansion
# * Double-dollar ($$) expands to plain dollar ($) in make
- licensecheck -c '$(DEB_COPYRIGHT_CHECK_REGEX)' -r --copyright -i '$(DEB_COPYRIGHT_CHECK_IGNORE_REGEX)' * \
+ @licensecheck -c '$(DEB_COPYRIGHT_CHECK_REGEX)' -r --copyright -i '$(DEB_COPYRIGHT_CHECK_IGNORE_REGEX)' * \
| LC_ALL=C perl -e \
+ 'print "Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=XXX\n";'\
+ 'print "Upstream-Name: Untrusted draft - double-check copyrights yourself!\n\n";'\
'$$n=0; while (<>) {'\
' s/[^[:print:]]//g;'\
' if (/^([^:\s][^:]+):[\s]+(\S.*?)\s*$$/) {'\
@@ -56,8 +63,15 @@ debian/stamp-copyright-check:
'foreach $$file (@files) {'\
' $$file->{license} =~ s/\s*\(with incorrect FSF address\)//;'\
' $$file->{license} =~ s/\s+\(v([^)]+) or later\)/-$$1+/;'\
+ ' $$file->{license} =~ s/\s*(\*No copyright\*)\s*// and $$file->{copyright} = $$1;'\
+ ' $$file->{license} =~ s/^\s*(GENERATED FILE)/UNKNOWN ($$1)/;'\
+ ' $$file->{license} =~ s/\s+(GENERATED FILE)/ ($$1)/;'\
' $$file->{copyright} =~ s/(?<=(\b\d{4}))(?{$$y=$$^N})\s*[,-]\s*((??{$$y+1}))\b/-$$2/g;'\
' $$file->{copyright} =~ s/(?<=\b\d{4})\s*-\s*\d{4}(?=\s*-\s*(\d{4})\b)//g;'\
+ ' $$file->{copyright} =~ s/\b(\d{4})\s+([\S^\d])/$$1, $$2/g;'\
+ ' $$file->{copyright} =~ s/^\W*\s+\/\s+//g;'\
+ ' $$file->{copyright} =~ s/\s+\/\s+\W*$$//;'\
+ ' $$file->{copyright} =~ s/\s+\/\s+/\n\t/g;'\
' $$pattern = "$$file->{license} [$$file->{copyright}]";'\
' push @{ $$patternfiles{"$$pattern"} }, $$file->{name};'\
'};'\
@@ -66,7 +80,10 @@ debian/stamp-copyright-check:
' ||'\
' $$a cmp $$b'\
' } keys %patternfiles ) {'\
- ' print "$$pattern: ", join("\n\t", sort @{ $$patternfiles{$$pattern} }), "\n";'\
+ ' ($$license, $$copyright) = $$pattern =~ /(.*) \[(.*)\]/s;'\
+ ' print "Files: ", join("\n\t", sort @{ $$patternfiles{$$pattern} }), "\n";'\
+ ' print "Copyright: $$copyright\n";'\
+ ' print "License: $$license\n\n";'\
'};'\
> debian/copyright_newhints
@patterncount="`cat debian/copyright_newhints | sed 's/^[^:]*://' | LANG=C sort -u | grep . -c -`"; \
@@ -74,13 +91,14 @@ debian/stamp-copyright-check:
@if [ ! -f debian/copyright_hints ]; then touch debian/copyright_hints; fi
@newstrings=`diff -u debian/copyright_hints debian/copyright_newhints | sed '1,2d' | egrep '^\+' - | sed 's/^\+//'`; \
if [ -n "$$newstrings" ]; then \
- echo "WARNING: The following new or changed copyright notices discovered:"; \
+ echo "$(if $(DEB_COPYRIGHT_CHECK_STRICT),ERROR,WARNING): The following new or changed copyright notices discovered:"; \
echo; \
echo "$$newstrings"; \
echo; \
echo "To fix the situation please do the following:"; \
echo " 1) Investigate the above changes and update debian/copyright as needed"; \
echo " 2) Replace debian/copyright_hints with debian/copyright_newhints"; \
+ $(if $(DEB_COPYRIGHT_CHECK_STRICT),exit 1,:); \
else \
echo 'No new copyright notices found - assuming no news is good news...'; \
rm -f debian/copyright_newhints; \