[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.2-48-gd6d39f9



The following commit has been merged in the master branch:
commit d6d39f976fe654dd0a7b7d13fb1cc75b69f8ce50
Author: Jakub Wilk <jwilk@debian.org>
Date:   Mon Aug 22 15:29:46 2011 +0200

    Added check for common DEP-5 issues
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/source-copyright b/checks/source-copyright
new file mode 100644
index 0000000..f7fec61
--- /dev/null
+++ b/checks/source-copyright
@@ -0,0 +1,229 @@
+# source-copyright-file -- lintian check script -*- perl -*-
+
+# Copyright (C) 2011 Jakub Wilk
+#
+# 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 2 of the License, 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, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::source_copyright;
+
+use strict;
+use warnings;
+
+use Lintian::Relation::Version qw(versions_compare);
+use Lintian::Tags qw(tag);
+use Util;
+
+my $dep5_last_normative_change = '0+svn~166';
+my $dep5_last_overhaul = '0+svn~148';
+my %dep5_renamed_fields = (
+    'format-specification' => 'format',
+    'maintainer' => 'upstream-contact',
+    'upstream-maintainer' => 'upstream-contact',
+    'contact' => 'upstream-contact',
+    'name' => 'upstream-name',
+);
+
+sub run {
+ 
+my ($pkg, $type, $info) = @_;
+
+my $copyright_filename = $info->debfiles('copyright');
+
+if (-l $copyright_filename) {
+    tag 'debian-copyright-is-symlink';
+    return;
+}
+
+if (not -f $copyright_filename) {
+    my $pkgs = $info->binaries;
+    tag 'no-debian-copyright';
+    $copyright_filename = undef;
+    if (keys(%$pkgs) == 1) {
+	# If debian/copyright doesn't exist, and the only a single binary
+	# package is built, there's a good chance that the copyright file is
+	# available as debian/<pkgname>.copyright.
+	$copyright_filename = $info->debfiles((keys(%$pkgs))[0] . '.copyright');
+	if (not -f $copyright_filename or -l $copyright_filename) {
+	    $copyright_filename = undef;
+	}
+    }
+}
+
+return unless defined $copyright_filename;
+
+$_ = slurp_entire_file($copyright_filename);
+study $_;
+
+my @dep5;
+
+if (m{
+    (^ | \n)
+    (?i: format(:|[-\s]spec) )
+    (?: . | \n\s+ )*
+    (?: /dep[5s]?\b | \bDEP-?5\b | [Mm]achine-readable\s(?:license|copyright) | /copyright-format/ | CopyrightFormat | VERSIONED_FORMAT_URL )
+}x)
+{
+    # Before trying to parse the copyright as Debian control file, try to
+    # determine the format URI.
+    my $first_para = $_;
+    $first_para =~ s,^#.*,,mg;
+    $first_para =~ s,[ \t]+$,,mg;
+    $first_para =~ s,^\n+,,g;
+    $first_para =~ s,\n\n.*,\n,s; #;; hi emacs
+    $first_para =~ s,\n?[ \t]+, ,g;
+    $first_para =~ m,^Format(?:-Specification)?:\s*(.*),mi;
+    my $uri = $1;
+    $uri =~ s/^([^#\s]+)#/$1/ if defined $uri; # strip fragment identifier
+    if (defined $uri) {
+	my $original_uri = $uri;
+	my $version;
+	if ($uri =~ m,\b(?:rev=REVISION|VERSIONED_FORMAT_URL)\b,) {
+	    tag 'boilerplate-copyright-format-uri', $uri;
+	}
+	elsif ($uri =~ s,http://wiki\.debian\.org/Proposals/CopyrightFormat\b,,) {
+	    $version = '0~wiki';
+	    $uri =~ m,^\?action=recall&rev=(\d+)$, and $version = "$version~$1";
+	}
+	elsif ($uri =~ m,^http://dep\.debian\.net/deps/dep5/?$,) {
+	    $version = '0+svn';
+	}
+	elsif ($uri =~ s,^http://svn\.debian\.org/wsvn/dep/web/deps/dep5\.mdwn\b,,) {
+	    $version = '0+svn';
+	    $uri =~ m,^\?(?:\S+&)?rev=(\d+)(?:&\S+)?$, and $version = "$version~$1";
+	}
+	elsif ($uri =~ s,^http://anonscm\.debian\.org/viewvc/dep/web/deps/dep5\.mdwn\b,,) {
+	    $version = '0+svn';
+	    $uri =~ m,^\?(?:\S+&)?revision=(\d+)(?:&\S+)?$, and $version = "$version~$1";
+	}
+	elsif ($uri =~ m,^http://www\.debian\.org/doc/(?:packaging-manuals/)?copyright-format/(\d+\.\d+)$,) {
+	    $version = $1;
+	}
+	else {
+	    tag 'unknown-copyright-format-uri', $original_uri;
+	}
+	if (defined $version) {
+	    if ($version =~ m,wiki,) {	
+		    tag 'wiki-copyright-format-uri', $original_uri;
+	    }
+	    elsif ($version =~ m,svn$,) {
+		tag 'unversioned-copyright-format-uri', $original_uri;
+	    }
+	    elsif (versions_compare $version, '<<', $dep5_last_normative_change) {
+		tag 'out-of-date-copyright-format-uri', $original_uri;
+	    }
+	    if (versions_compare $version, '>=', $dep5_last_overhaul) {
+		# We are reasonably certain that we're dealing with an up-to-date
+		# DEP-5 format. Let's try to do more strict checks.
+		eval {
+		    @dep5 = read_dpkg_control($copyright_filename);
+		};
+		if ($@) {
+		    $@ =~ s/^internal error: //;
+		    tag 'syntax-error-in-dep5-copyright', $@;
+		}
+	    }
+	}
+    }
+    else {
+	tag 'unknown-copyright-format-uri';
+    }
+}
+
+if (@dep5) {
+    my $first_para = shift @dep5;
+    my %standalone_licenses;
+    my %required_standalone_licenses;
+    for my $field (keys %{$first_para}) {
+	my $renamed_to = $dep5_renamed_fields{$field};
+	if (defined $renamed_to) {
+	    tag 'obsolete-field-in-dep5-copyright', $field, $renamed_to
+	}
+    }
+    if (not defined $first_para->{'format'} and not defined $first_para->{'format-specification'}) {
+	tag 'missing-field-in-dep5-copyright', 'paragraph', '1', 'format';
+    }
+    for my $license (split_licenses($first_para->{'license'})) {
+	$required_standalone_licenses{$license} = 1;
+    }
+    my $commas_in_files = 0;
+    my $i = 1;
+    for my $para (@dep5) {
+	$i++;
+	my $license = $para->{'license'};
+	my $files = $para->{'files'};
+	if (defined $license and not defined $files) {
+	    # Standalone license paragraph
+	    if (not $license =~ m/\n/) {
+		tag 'missing-license-text-in-dep5-copyright', 'paragraph', $i, "\L$license";
+	    }
+	    ($license, undef) = split /\n/, $license, 2;
+	    for (split_licenses($license)) {
+		$standalone_licenses{$_} = $i;
+	    }
+	}
+	elsif (defined $files) {
+	    # Files paragraph
+	    $commas_in_files = 1 if $files =~ /,/;
+	    if (defined $license) {
+		for (split_licenses($license)) {
+		    $required_standalone_licenses{$_} = $i;
+		}
+	    }
+	    else {
+		tag 'missing-field-in-dep5-copyright', 'paragraph', $i, 'license';
+	    }
+	    if (not defined $para->{'copyright'}) {
+		tag 'missing-field-in-dep5-copyright', 'paragraph', $i, 'copyright';
+	    }
+	}
+	else {
+	    tag 'unknown-paragraph-in-dep5-copyright', 'paragraph', $i;
+	}
+    }
+    if ($commas_in_files) {
+	tag 'comma-separated-files-in-dep5-copyright'
+	    unless grep(/,/, $info->sorted_index);
+    }
+    while ((my $license, $i) = each %required_standalone_licenses) {
+	if (not defined $standalone_licenses{$license}) {
+	    tag 'missing-license-paragraph-in-dep5-copyright', 'paragraph', $i, $license;
+	}
+    }
+    while ((my $license, $i) = each %standalone_licenses) {
+	if (not defined $required_standalone_licenses{$license}) {
+	    tag 'unused-license-paragraph-in-dep5-copyright', 'paragraph', $i, $license;
+	}
+    }
+}
+
+}
+
+sub split_licenses {
+    my ($_) = @_;
+    return () unless defined;
+    return () if /\n/;
+    s/[(),]//;
+    return map "\L$_", (split /\s++(?:and|or)\s++/);
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sw=4 ts=8 noet shiftround
diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
new file mode 100644
index 0000000..34bd492
--- /dev/null
+++ b/checks/source-copyright.desc
@@ -0,0 +1,132 @@
+Check-Script: source-copyright
+Author: Jakub Wilk <jwilk@debian.org>
+Abbrev: scpy
+Type: source
+Needs-Info: debfiles, source-control-file, index
+Info: This script checks if a source package conforms to policy
+ with regard to copyright files.
+ .
+ Each source package should have a debian/copyright file.
+
+Tag: debian-copyright-is-symlink
+Severity: normal
+Certainty: certain
+Info: The file <tt>debian/copyright</tt> is a symlink instead of a regular
+ file.  This makes package checking and manipulation more difficult.
+ .
+ This problem may have prevented lintian from performing other checks.
+
+Tag: no-debian-copyright
+Severity: minor
+Certainty: certain
+Ref: policy 12.5
+Info: Every package must include the file <tt>/usr/share/doc/<i>pkg</i>/copyright</tt>.
+ A copy of this file should be in <tt>debian/copyright</tt> in the source package.
+
+Tag: unknown-copyright-format-uri
+Severity: pedantic
+Certainty: wild-guess
+Info: The copyright file appears to intended as machine-readable, but lintian
+ cannot recognize its format URI.  It could be a typo for a common URI or a
+ syntax error in the first paragraph.  Please file a bug against Lintian if you
+ believe that the copyright file in syntactically valid and the URI is
+ correct.
+
+Tag: boilerplate-copyright-format-uri
+Severity: normal
+Certainty: possible
+Info: Format URI of the machine-readable copyright file contains
+ <tt>VERSIONED_FORMAT_URL</tt> or <tt>REVISION</tt> string.  Please replace it
+ with an actual URI or an actual revision number respectively.
+
+Tag: wiki-copyright-format-uri
+Severity: pedantic
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: Format URI of the machine-readable copyright file refers to Debian Wiki.
+ .
+ Debian Wiki is not used for the format development anymore.  Please use
+ <tt>http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=<i>revision</i></tt>
+ as the format URI instead.
+
+Tag: unversioned-copyright-format-uri
+Severity: pedantic
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: Format URI of the machine-readable copyright file is not versioned.
+ .
+ Please use
+ <tt>http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=<i>revision</i></tt>
+ as the format URI instead.
+
+Tag: out-of-date-copyright-format-uri
+Severity: pedantic
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: A newer version of the machine-readable copyright file specification,
+ than the one referenced by the copyright file, is available.
+ .
+ This problem may have prevented lintian from performing other checks.
+
+Tag: syntax-error-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The machine-readable copyright file didn't pass Debian control file
+ syntax check.
+
+Tag: obsolete-field-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The machine-readable copyright file uses a field, that used to be defined
+ by the specification, but has been renamed since then.
+ .
+ Please use Format instead of Format-Specification.
+ .
+ Please use Upstream-Contact instead of Contact, Maintainer or Upstream-Maintainer.
+ .
+ Please use Upstream-Name instead of Name.
+
+Tag: comma-separated-files-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: A list of files in the machine-readable copyright format appears to be
+ separated by commas.  The file list should be whitespace separated instead.
+
+Tag: missing-field-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The paragraph in the machine readable copyright file is missing a field
+ that is required by the specification.
+
+Tag: missing-license-paragraph-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The files paragraph in the machine readable copyright file references a
+ license, for which no standalone license paragraph exists.
+
+Tag: missing-license-text-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The standalone license header contains only short license name, but not
+ the license text.
+
+Tag: unused-license-paragraph-in-dep5-copyright
+Severity: minor
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The license paragraph in the machine-readable copyright file is not
+ referenced by any files paragraph.  It could be a typo in the license name or
+ the license paragraph is simply not needed and can be removed.
+
+Tag: unknown-paragraph-in-dep5-copyright
+Severity: normal
+Certainty: possible
+Ref: http://dep.debian.net/deps/dep5/
+Info: The machine-readable copyright file contains a paragraph that is neither
+ a standalone license paragraph nor a files paragraph.
diff --git a/debian/changelog b/debian/changelog
index 3f21e77..b28e13a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,23 @@
 lintian (2.5.3) UNRELEASED; urgency=low
 
+  * Summary of tag changes:
+    + Added:
+      - boilerplate-copyright-format-uri
+      - comma-separated-files-in-dep5-copyright
+      - debian-copyright-is-symlink
+      - missing-field-in-dep5-copyright
+      - missing-license-paragraph-in-dep5-copyright
+      - missing-license-text-in-dep5-copyright
+      - no-debian-copyright
+      - obsolete-field-in-dep5-copyright
+      - out-of-date-copyright-format-uri
+      - syntax-error-in-dep5-copyright
+      - unknown-copyright-format-uri
+      - unknown-paragraph-in-dep5-copyright
+      - unused-license-paragraph-in-dep5-copyright
+      - unversioned-copyright-format-uri
+      - wiki-copyright-format-uri
+
   * checks/*:
     + [NT] Dropped fields from Needs-Info, it is no longer needed.
     + [JW] Use LC_ALL rather than LANG, since LC_ALL overrules
@@ -24,6 +42,8 @@ lintian (2.5.3) UNRELEASED; urgency=low
       static libraries, .pc-, elf and pyshared-data-files.  This
       covers all the false-positives currently found in the liblicense
       package.  (Closes: #617901)
+  * checks/source-copyright{,.desc}:
+    + [JW] Added check for DEP-5 copyright files.  (Closes: #633779)
   * checks/standards-version:
     + [NT] Made the ancient-standards-version independent of the
       system time.
@@ -61,6 +81,7 @@ lintian (2.5.3) UNRELEASED; urgency=low
       LANG.
   * lib/Lintian/Collect/Source.pm:
     + [NT] Removed a requirement for fields that was not needed.
+    + [NT] Fixed "index" method for source packages.
   * lib/Lintian/Collect/Package.pm:
     + [JW,NT] Replace use of fail with croak.  (Closes: #637741)
   * lib/Lintian/Profile.pm:
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index d4b6acd..a71c115 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -276,6 +276,16 @@ sub debfiles {
     return $self->_fetch_extracted_dir('debfiles', 'debfiles', $file);
 }
 
+# Overriden method; please see Lintian::Collect::Package::index for
+# more information.
+#
+#
+# sub index Needs-Info index
+sub index {
+    my ($self) = @_;
+    return $self->_fetch_index_data('index', 'index', undef);
+}
+
 =head1 NAME
 
 Lintian::Collect::Source - Lintian interface to source package data collection
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index 4210259..14a68d0 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -6,6 +6,6 @@ Enable-Tags-From-Check: binaries, changelog-file, changes-file, circular-deps, c
  debhelper, debian-readme, debian-source-dir, description, duplicate-files,
  fields, filename-length, files, huge-usr-share, infofiles, init.d, java,
  lintian, manpages, md5sums, menu-format, menus, nmu, ocaml, patch-systems,
- po-debconf, rules, scripts, shared-libs, standards-version, symlinks,
- version-substvars, watch-file
+ po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
+ symlinks, version-substvars, watch-file
 
diff --git a/t/COVERAGE b/t/COVERAGE
index 029c8e8..fb0cec5 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,5 @@
-Last generated 2011-08-17
-Coverage: 697/915 (76.17%), w. legacy tests: 820/915 (89.62%)
+Last generated 2011-08-22
+Coverage: 712/930 (76.56%), w. legacy tests: 835/930 (89.78%)
 
 The following tags are not tested by the test suite:
 
diff --git a/t/tests/generic-empty/tags b/t/tests/generic-empty/tags
index 2acd3a2..179dab8 100644
--- a/t/tests/generic-empty/tags
+++ b/t/tests/generic-empty/tags
@@ -12,6 +12,7 @@ W: generic-empty source: changelog-should-mention-nmu
 W: generic-empty source: debian-rules-missing-recommended-target build-arch
 W: generic-empty source: debian-rules-missing-recommended-target build-indep
 W: generic-empty source: maintainer-not-full-name a
+W: generic-empty source: no-debian-copyright
 W: generic-empty source: no-section-field-for-source
 W: generic-empty source: source-nmu-has-incorrect-version-number 1.0
 W: generic-empty: empty-binary-package
diff --git a/t/tests/source-copyright-boilerplate-uri/debian/debian/copyright b/t/tests/source-copyright-boilerplate-uri/debian/debian/copyright
new file mode 100644
index 0000000..d890aa5
--- /dev/null
+++ b/t/tests/source-copyright-boilerplate-uri/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format: <VERSIONED_FORMAT_URL>
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-boilerplate-uri/desc b/t/tests/source-copyright-boilerplate-uri/desc
new file mode 100644
index 0000000..1514f89
--- /dev/null
+++ b/t/tests/source-copyright-boilerplate-uri/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-boilerplate-uri
+Sequence: 6000
+Version: 1.0
+Description: Test for boilerplace DEP-5-like URI
+Test-For:
+ boilerplate-copyright-format-uri
diff --git a/t/tests/source-copyright-boilerplate-uri/tags b/t/tests/source-copyright-boilerplate-uri/tags
new file mode 100644
index 0000000..a086aef
--- /dev/null
+++ b/t/tests/source-copyright-boilerplate-uri/tags
@@ -0,0 +1 @@
+W: source-copyright-boilerplate-uri source: boilerplate-copyright-format-uri <VERSIONED_FORMAT_URL>
diff --git a/t/tests/source-copyright-dep5-general/debian/debian/copyright b/t/tests/source-copyright-dep5-general/debian/debian/copyright
new file mode 100644
index 0000000..9be2c7e
--- /dev/null
+++ b/t/tests/source-copyright-dep5-general/debian/debian/copyright
@@ -0,0 +1,57 @@
+Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174
+Upstream-Name: Doohickey
+Upstream-Maintainer: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Comment: I'm a bogus paragraph.
+
+Files: a/*, b/*
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+
+Files: c
+Copyright: 2010 J. Random Hacker <j.r.hacker@example.com>
+
+Files: d
+License: GPL-3
+
+Files: 5
+License: MIT
+Copyright: 2010 J. Random Hacker <j.r.hacker@example.com>
+
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
+
+License: GPL-3
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the “Software”), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
diff --git a/t/tests/source-copyright-dep5-general/desc b/t/tests/source-copyright-dep5-general/desc
new file mode 100644
index 0000000..8e4a576
--- /dev/null
+++ b/t/tests/source-copyright-dep5-general/desc
@@ -0,0 +1,12 @@
+Testname: source-copyright-dep5-general
+Sequence: 6000
+Version: 1.0
+Description: Test for various errors in DEP-5 copyright files
+Test-For:
+ comma-separated-files-in-dep5-copyright
+ missing-field-in-dep5-copyright
+ missing-license-paragraph-in-dep5-copyright
+ missing-license-text-in-dep5-copyright
+ obsolete-field-in-dep5-copyright
+ unknown-paragraph-in-dep5-copyright
+ unused-license-paragraph-in-dep5-copyright
diff --git a/t/tests/source-copyright-dep5-general/tags b/t/tests/source-copyright-dep5-general/tags
new file mode 100644
index 0000000..a85d85d
--- /dev/null
+++ b/t/tests/source-copyright-dep5-general/tags
@@ -0,0 +1,8 @@
+I: source-copyright-dep5-general source: unused-license-paragraph-in-dep5-copyright paragraph 9 expat
+W: source-copyright-dep5-general source: comma-separated-files-in-dep5-copyright
+W: source-copyright-dep5-general source: missing-field-in-dep5-copyright paragraph 4 license
+W: source-copyright-dep5-general source: missing-field-in-dep5-copyright paragraph 5 copyright
+W: source-copyright-dep5-general source: missing-license-paragraph-in-dep5-copyright paragraph 6 mit
+W: source-copyright-dep5-general source: missing-license-text-in-dep5-copyright paragraph 8 gpl-3
+W: source-copyright-dep5-general source: obsolete-field-in-dep5-copyright upstream-maintainer upstream-contact
+W: source-copyright-dep5-general source: unknown-paragraph-in-dep5-copyright paragraph 2
diff --git a/t/tests/source-copyright-dep5-syntax-error/debian/debian/copyright b/t/tests/source-copyright-dep5-syntax-error/debian/debian/copyright
new file mode 100644
index 0000000..ee42935
--- /dev/null
+++ b/t/tests/source-copyright-dep5-syntax-error/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-dep5-syntax-error/desc b/t/tests/source-copyright-dep5-syntax-error/desc
new file mode 100644
index 0000000..9d83393
--- /dev/null
+++ b/t/tests/source-copyright-dep5-syntax-error/desc
@@ -0,0 +1,6 @@
+Testname: source-copyright-dep5-syntax-error
+Sequence: 6000
+Version: 1.0
+Description: Test for DEP-5 syntax error
+Test-For:
+ syntax-error-in-dep5-copyright
diff --git a/t/tests/source-copyright-dep5-syntax-error/tags b/t/tests/source-copyright-dep5-syntax-error/tags
new file mode 100644
index 0000000..6a7686b
--- /dev/null
+++ b/t/tests/source-copyright-dep5-syntax-error/tags
@@ -0,0 +1 @@
+W: source-copyright-dep5-syntax-error source: syntax-error-in-dep5-copyright syntax error in section 2 after the tag license:  This package is distributed in the hope that it will be useful, but WITHOUT\n
diff --git a/t/tests/source-copyright-missing/desc b/t/tests/source-copyright-missing/desc
new file mode 100644
index 0000000..482b7c3
--- /dev/null
+++ b/t/tests/source-copyright-missing/desc
@@ -0,0 +1,7 @@
+Testname: source-copyright-missing
+Sequence: 6000
+Version: 1.0
+Description: Test for missing copyright
+Test-For:
+ no-copyright-file
+ no-debian-copyright
diff --git a/t/tests/source-copyright-missing/pre_build b/t/tests/source-copyright-missing/pre_build
new file mode 100755
index 0000000..50ea07f
--- /dev/null
+++ b/t/tests/source-copyright-missing/pre_build
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -f "$1/debian/copyright"
diff --git a/t/tests/source-copyright-missing/tags b/t/tests/source-copyright-missing/tags
new file mode 100644
index 0000000..dd14d83
--- /dev/null
+++ b/t/tests/source-copyright-missing/tags
@@ -0,0 +1,2 @@
+E: source-copyright-missing: no-copyright-file
+W: source-copyright-missing source: no-debian-copyright
diff --git a/t/tests/source-copyright-ood-uri/debian/debian/copyright b/t/tests/source-copyright-ood-uri/debian/debian/copyright
new file mode 100644
index 0000000..f73439f
--- /dev/null
+++ b/t/tests/source-copyright-ood-uri/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Name: Doohickey
+Maintainer: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-ood-uri/desc b/t/tests/source-copyright-ood-uri/desc
new file mode 100644
index 0000000..acc60e7
--- /dev/null
+++ b/t/tests/source-copyright-ood-uri/desc
@@ -0,0 +1,7 @@
+Testname: source-copyright-ood-uri
+Sequence: 6000
+Version: 1.0
+Description: Test for out-of-date DEP-5-like URI
+Options: -I -E --pedantic
+Test-For:
+ out-of-date-copyright-format-uri
diff --git a/t/tests/source-copyright-ood-uri/tags b/t/tests/source-copyright-ood-uri/tags
new file mode 100644
index 0000000..cd49f07
--- /dev/null
+++ b/t/tests/source-copyright-ood-uri/tags
@@ -0,0 +1 @@
+P: source-copyright-ood-uri source: out-of-date-copyright-format-uri http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
diff --git a/t/tests/source-copyright-symlink/desc b/t/tests/source-copyright-symlink/desc
new file mode 100644
index 0000000..b45e2e6
--- /dev/null
+++ b/t/tests/source-copyright-symlink/desc
@@ -0,0 +1,5 @@
+Testname: source-copyright-symlink
+Sequence: 6000
+Version: 1.0
+Description: Test for symlinked debian/copyright
+Test-For: debian-copyright-is-symlink
diff --git a/t/tests/source-copyright-symlink/pre_build b/t/tests/source-copyright-symlink/pre_build
new file mode 100755
index 0000000..0afeafe
--- /dev/null
+++ b/t/tests/source-copyright-symlink/pre_build
@@ -0,0 +1,4 @@
+#!/bin/sh
+cd "$1/debian"
+mv copyright source-copyright-symlink.copyright
+ln -sf source-copyright-symlink.copyright copyright
diff --git a/t/tests/source-copyright-symlink/tags b/t/tests/source-copyright-symlink/tags
new file mode 100644
index 0000000..bc70a39
--- /dev/null
+++ b/t/tests/source-copyright-symlink/tags
@@ -0,0 +1 @@
+W: source-copyright-symlink source: debian-copyright-is-symlink
diff --git a/t/tests/source-copyright-unknown-uri/debian/debian/copyright b/t/tests/source-copyright-unknown-uri/debian/debian/copyright
new file mode 100644
index 0000000..63e0f4b
--- /dev/null
+++ b/t/tests/source-copyright-unknown-uri/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format-Specification: http://bzr.debian.org/loggerhead/dep/dep5/trunk/annotate/110/dep5.mdwn
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-unknown-uri/desc b/t/tests/source-copyright-unknown-uri/desc
new file mode 100644
index 0000000..b6c4e8b
--- /dev/null
+++ b/t/tests/source-copyright-unknown-uri/desc
@@ -0,0 +1,7 @@
+Testname: source-copyright-unknown-uri
+Sequence: 6000
+Version: 1.0
+Description: Test for unkown DEP-5-like URI
+Options: -I -E --pedantic
+Test-For:
+ unknown-copyright-format-uri
diff --git a/t/tests/source-copyright-unknown-uri/tags b/t/tests/source-copyright-unknown-uri/tags
new file mode 100644
index 0000000..14803e2
--- /dev/null
+++ b/t/tests/source-copyright-unknown-uri/tags
@@ -0,0 +1 @@
+P: source-copyright-unknown-uri source: unknown-copyright-format-uri http://bzr.debian.org/loggerhead/dep/dep5/trunk/annotate/110/dep5.mdwn
diff --git a/t/tests/source-copyright-unversioned-uri/debian/debian/copyright b/t/tests/source-copyright-unversioned-uri/debian/debian/copyright
new file mode 100644
index 0000000..cf66541
--- /dev/null
+++ b/t/tests/source-copyright-unversioned-uri/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format: http://dep.debian.net/deps/dep5/
+Upstream-Name: Doohickey
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-unversioned-uri/desc b/t/tests/source-copyright-unversioned-uri/desc
new file mode 100644
index 0000000..d585746
--- /dev/null
+++ b/t/tests/source-copyright-unversioned-uri/desc
@@ -0,0 +1,7 @@
+Testname: source-copyright-unversioned-uri
+Sequence: 6000
+Version: 1.0
+Description: Test for unversioned DEP-5-like URI
+Options: -I -E --pedantic
+Test-For:
+ unversioned-copyright-format-uri
diff --git a/t/tests/source-copyright-unversioned-uri/tags b/t/tests/source-copyright-unversioned-uri/tags
new file mode 100644
index 0000000..e383019
--- /dev/null
+++ b/t/tests/source-copyright-unversioned-uri/tags
@@ -0,0 +1 @@
+P: source-copyright-unversioned-uri source: unversioned-copyright-format-uri http://dep.debian.net/deps/dep5/
diff --git a/t/tests/source-copyright-wiki-uri/debian/debian/copyright b/t/tests/source-copyright-wiki-uri/debian/debian/copyright
new file mode 100644
index 0000000..4b8947c
--- /dev/null
+++ b/t/tests/source-copyright-wiki-uri/debian/debian/copyright
@@ -0,0 +1,22 @@
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Name: Doohickey
+Upstream-Maintainer: J. Random Hacker <j.r.hacker@example.com>
+Upstream-Source: http://examples.com/doohickey/source/
+
+Files: *
+Copyright: 2011 J. Random Hacker <j.r.hacker@example.com>
+License: GPL-2
+ This package 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; version 2 dated June, 1991.
+ .
+ This package 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the full text of the GNU General Public License version 2
+ can be found in the file `/usr/share/common-licenses/GPL-2'.
diff --git a/t/tests/source-copyright-wiki-uri/desc b/t/tests/source-copyright-wiki-uri/desc
new file mode 100644
index 0000000..ee5d7e0
--- /dev/null
+++ b/t/tests/source-copyright-wiki-uri/desc
@@ -0,0 +1,7 @@
+Testname: source-copyright-wiki-uri
+Sequence: 6000
+Version: 1.0
+Description: Test for wiki.debian.org DEP-5-like URI
+Options: -I -E --pedantic
+Test-For:
+ wiki-copyright-format-uri
diff --git a/t/tests/source-copyright-wiki-uri/tags b/t/tests/source-copyright-wiki-uri/tags
new file mode 100644
index 0000000..f0afc73
--- /dev/null
+++ b/t/tests/source-copyright-wiki-uri/tags
@@ -0,0 +1 @@
+P: source-copyright-wiki-uri source: wiki-copyright-format-uri http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
diff --git a/testset/tags.etcfiles b/testset/tags.etcfiles
index b3c7ec1..da2f79e 100644
--- a/testset/tags.etcfiles
+++ b/testset/tags.etcfiles
@@ -11,6 +11,7 @@ E: etcfiles: non-etc-file-marked-as-conffile var/lib/foo
 E: only-etcfiles: extended-description-is-empty
 I: etcfiles source: missing-debian-source-format
 W: etcfiles source: ancient-standards-version 3.5.0 (current is 3.9.2)
+W: etcfiles source: no-debian-copyright
 W: etcfiles: file-missing-in-md5sums etc/improper-link
 W: etcfiles: file-missing-in-md5sums usr/share/doc/etcfiles/changelog
 W: etcfiles: package-contains-hardlink etc/improper -> etc/improper-link
diff --git a/testset/tags.fields b/testset/tags.fields
index 3d88672..1c5a102 100644
--- a/testset/tags.fields
+++ b/testset/tags.fields
@@ -12,6 +12,7 @@ W: fields source: debhelper-but-no-misc-depends another-version
 W: fields source: debhelper-but-no-misc-depends fields
 W: fields source: debian-revision-not-well-formed 1.5-.3
 W: fields source: native-package-with-dash-version
+W: fields source: no-debian-copyright
 W: fields source: package-uses-deprecated-debhelper-compat-version 1
 W: fields source: source-nmu-has-incorrect-version-number 1.5-.3
 W: fields: debian-revision-not-well-formed 1.5-.3
diff --git a/testset/tags.filenames b/testset/tags.filenames
index 3ed0031..a8b6aea 100644
--- a/testset/tags.filenames
+++ b/testset/tags.filenames
@@ -60,6 +60,7 @@ W: filenames source: diff-contains-svk-commit-file files/svk-commitsEr9P.tmp
 W: filenames source: diff-contains-svn-commit-file files/svn-commit.tmp
 W: filenames source: diff-contains-svn-conflict-file files/Maelstrom Sounce.r121
 W: filenames source: diff-contains-svn-control-dir .svn
+W: filenames source: no-debian-copyright
 W: filenames source: no-section-field-for-source
 W: filenames: bad-permissions-for-ali-file usr/lib/ada/adalib/test.ali
 W: filenames: binary-without-manpage usr/X11R6/bin/testxbin2
diff --git a/testset/tags.maintainer-scripts b/testset/tags.maintainer-scripts
index 2a68ab0..5e3e9a0 100644
--- a/testset/tags.maintainer-scripts
+++ b/testset/tags.maintainer-scripts
@@ -47,6 +47,7 @@ W: maintainer-scripts source: debian-watch-file-should-mangle-version line 11
 W: maintainer-scripts source: debian-watch-file-should-mangle-version line 7
 W: maintainer-scripts source: debian-watch-file-unknown-version 4
 W: maintainer-scripts source: dfsg-version-in-native-package 7+dfsg-0.1
+W: maintainer-scripts source: no-debian-copyright
 W: maintainer-scripts source: package-uses-deprecated-debhelper-compat-version 1
 W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7+dfsg-0.1
 W: maintainer-scripts: ancient-dpkg-epoch-check preinst:8
diff --git a/testset/tags.relations b/testset/tags.relations
index 67a427b..6a3b958 100644
--- a/testset/tags.relations
+++ b/testset/tags.relations
@@ -36,6 +36,7 @@ W: relations source: ancient-standards-version 3.7.3 (current is 3.9.2)
 W: relations source: bad-homepage lintian.debian.org
 W: relations source: build-depends-on-1-revision build-depends-indep: libfoo (>= 1.2-1)
 W: relations source: build-depends-on-python-dev-with-no-arch-any
+W: relations source: no-debian-copyright
 W: relations source: package-depends-on-itself relations depends
 W: relations source: package-depends-on-itself relations-multiple-libs recommends
 W: relations source: package-has-a-duplicate-build-relation foo (= 3) [!amd64 !i386], foo (<< 4) [!amd64 !i386]

-- 
Debian package checker


Reply to: