[lintian] 01/01: Detect if license-short-name are unique in source copyright
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch unique
in repository lintian.
commit 642508bccd1029e399be302e30145982a98ce10e
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Sun Nov 16 19:50:44 2014 +0100
Detect if license-short-name are unique in source copyright
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/source-copyright.desc | 9 ++++++++
checks/source-copyright.pm | 17 +++++++++++++-
debian/changelog | 3 ++-
t/tests/source-copyright-unique/debian/NEWS | 1 +
t/tests/source-copyright-unique/debian/README | 1 +
.../debian/debian/copyright | 27 ++++++++++++++++++++++
t/tests/source-copyright-unique/desc | 6 +++++
t/tests/source-copyright-unique/tags | 5 ++++
8 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index 59c4459..914ff34 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -252,6 +252,15 @@ Info: One of the file paragraph reference in the
or short names followed by license exceptions making up
the first line must be described in stand-alone License paragraphs.
+Tag: dep5-copyright-license-name-not-unique
+Severity: normal
+Certainty: possible
+Ref: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Info: This paragraph define an already defined license.
+ .
+ According to specification the short license name are guaranteed
+ to be unique within a single copyright file.
+
Tag: invalid-escape-sequence-in-dep5-copyright
Severity: normal
Certainty: possible
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index 5e60197..2eda3b4 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -231,6 +231,7 @@ sub _parse_dep5 {
my %standalone_licenses;
my %required_standalone_licenses;
my %short_licenses_seen;
+ my %full_licenses_seen;
for my $field (keys %{$first_para}) {
my $renamed_to = $dep5_renamed_fields{$field};
@@ -255,6 +256,7 @@ sub _parse_dep5 {
if(defined($full_license_header)) {
for (@short_licenses_header) {
$standalone_licenses{$_} = 1;
+ $full_licenses_seen{$_} = 1;
}
}
@@ -296,7 +298,13 @@ sub _parse_dep5 {
"(paragraph at line $current_line)";
}else {
for (@short_licenses) {
- $standalone_licenses{$_} = $i;
+ if(defined($full_licenses_seen{$_})) {
+ tag 'dep5-copyright-license-name-not-unique',
+ "(paragraph at line $current_line)";
+ } else {
+ $standalone_licenses{$_} = $i;
+ $full_licenses_seen{$_} = $current_line;
+ }
$short_licenses_seen{$_} = $i;
}
}
@@ -382,6 +390,13 @@ sub _parse_dep5 {
$short_licenses_seen{$_} = $i;
if (not defined($full_license)) {
$required_standalone_licenses{$_} = $i;
+ } else {
+ if(defined($full_licenses_seen{$_})) {
+ tag 'dep5-copyright-license-name-not-unique',
+ "(paragraph at line $current_line)";
+ } else {
+ $full_licenses_seen{$_} = $current_line;
+ }
}
}
}else {
diff --git a/debian/changelog b/debian/changelog
index f5b3067..9b4e28b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,12 +3,13 @@ lintian (2.5.31) UNRELEASED; urgency=medium
* checks/fields.desc:
+ [BR] Add reference to build-depends-on-metapackage
(Closes: #767107).
- * checks/source-copyright.pm:
+ * checks/source-copyright.{desc,pm}:
+ [BR] Fix a false positive for
missing-license-paragraph-in-dep5-copyright tag.
Do not allow to reference header paragraph,
emit a specific tag.
(Closes: #766118).
+ + [BR] Detect if license short name are unique.
* collection/strings:
+ [NT] Pass "-a" to strings to avoid possible security
diff --git a/t/tests/source-copyright-unique/debian/NEWS b/t/tests/source-copyright-unique/debian/NEWS
new file mode 100644
index 0000000..8a7f3d9
--- /dev/null
+++ b/t/tests/source-copyright-unique/debian/NEWS
@@ -0,0 +1 @@
+no news
\ No newline at end of file
diff --git a/t/tests/source-copyright-unique/debian/README b/t/tests/source-copyright-unique/debian/README
new file mode 100644
index 0000000..1a9d2ad
--- /dev/null
+++ b/t/tests/source-copyright-unique/debian/README
@@ -0,0 +1 @@
+trivial
diff --git a/t/tests/source-copyright-unique/debian/debian/copyright b/t/tests/source-copyright-unique/debian/debian/copyright
new file mode 100644
index 0000000..fd12194
--- /dev/null
+++ b/t/tests/source-copyright-unique/debian/debian/copyright
@@ -0,0 +1,27 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+License: some-license
+ some license
+
+Files: *
+Copyright: 2014, somebody1
+License: some-license
+ some license
+
+Files: debian/*
+Copyright: 2014, somebody1
+License: other-license
+ this is a valid license short name
+
+Files: NEWS
+Copyright: 2014, somebody1
+License: other-license
+ this is a valid license short name 3
+
+License: other-license
+ other-license
+
+License: other-license
+ other-license 2
\ No newline at end of file
diff --git a/t/tests/source-copyright-unique/desc b/t/tests/source-copyright-unique/desc
new file mode 100644
index 0000000..e08a9d6
--- /dev/null
+++ b/t/tests/source-copyright-unique/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-unique
+Sequence: 6000
+Version: 1.0
+Description: Test if standalone paragraph name are unique
+Test-For:
+ pipe-symbol-used-as-license-disjunction
diff --git a/t/tests/source-copyright-unique/tags b/t/tests/source-copyright-unique/tags
new file mode 100644
index 0000000..993cd21
--- /dev/null
+++ b/t/tests/source-copyright-unique/tags
@@ -0,0 +1,5 @@
+W: source-copyright-unique source: dep5-copyright-license-name-not-unique (paragraph at line 18)
+W: source-copyright-unique source: dep5-copyright-license-name-not-unique (paragraph at line 23)
+W: source-copyright-unique source: dep5-copyright-license-name-not-unique (paragraph at line 26)
+W: source-copyright-unique source: dep5-copyright-license-name-not-unique (paragraph at line 8)
+W: source-copyright-unique source: dep5-file-paragraph-reference-header some-license (paragraph at line 8)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: