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

[SCM] Debian package checker branch, master, updated. 7e9168b4cab2acc9b1bf1bc904231bbe7fc601a1



The following commit has been merged in the master branch:
commit 7e9168b4cab2acc9b1bf1bc904231bbe7fc601a1
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date:   Wed Jul 2 19:19:34 2008 +0100

    Check copyright files for lines > 80 characters
    
      * checks/copyright-file{,.desc}:
        + [ADB] Check for over-long lines in copyright files.  (Closes: #479651)

diff --git a/checks/copyright-file b/checks/copyright-file
index 5b4c050..d2141a2 100644
--- a/checks/copyright-file
+++ b/checks/copyright-file
@@ -25,6 +25,8 @@ use Spelling;
 use Tags;
 use Util;
 
+use Encode qw(decode);
+
 sub run {
 
 my $pkg = shift;
@@ -147,6 +149,17 @@ local $/ = undef;
 $_ = <IN>;
 close(IN);
 
+# We have to decode into UTF-8 to get the right length for the length
+# check.  For some reason, use open ':utf8' isn't sufficient.  If the
+# file uses a non-UTF-8 encoding, this will mangle it, but it doesn't
+# matter for the length check.
+my @lines = split ("\n", decode ('utf-8', $_));
+for my $i (0 .. $#lines) {
+    if (length ($lines[$i]) > 80) {
+	tag "debian-copyright-line-too-long", "line " . ($i+1);
+    }
+}
+
 my $wrong_directory_detected = 0;
 
 if (m,\<fill in (http/)?ftp site\>, or m/\<Must follow here\>/) {
diff --git a/checks/copyright-file.desc b/checks/copyright-file.desc
index dea3ff6..4481595 100644
--- a/checks/copyright-file.desc
+++ b/checks/copyright-file.desc
@@ -266,3 +266,11 @@ Info: This package appears to be covered by the GNU GPL but depends on
  linked with OpenSSL, is covered by the GNU GPL, please add a lintian
  override for this tag.  Lintian currently has no good way of
  distinguishing between that case and problematic packages.
+
+Tag: debian-copyright-line-too-long
+Type: warning
+Info: One or more lines in the copyright file contain more than 80 characters.
+ For the benefit of users of 80x25 terminals, it is recommended that the
+ lines do not exceed 80 characters.
+Ref: policy 12.5
+
diff --git a/debian/changelog b/debian/changelog
index ec47c57..845c5f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ lintian (1.24.2) unstable; urgency=low
 
   * checks/changelog-file:
     + [ADB] Add missing "use Dep". Thanks gregor herrmann (Closes: #488397)
+  * checks/copyright-file{,.desc}:
+    + [ADB] Check for over-long lines in copyright files.  (Closes: #479651)
   * checks/debconf{,.desc}:
     + [ADB] Warn about the use of "_Choices" in templates file and suggest
       using "__Choices" instead (Closes: #481152)
diff --git a/testset/copyright/debian/copyright.misc-errors b/testset/copyright/debian/copyright.misc-errors
index c434ac0..50c5213 100644
--- a/testset/copyright/debian/copyright.misc-errors
+++ b/testset/copyright/debian/copyright.misc-errors
@@ -16,3 +16,9 @@ This path /usr/share/doc/copyright is obsolete.
 This copyright info was automatically extracted from the perl module.
 It may not be accurate, so you better check the module sources
 if you don't want to get into legal troubles.
+
+This line is overly long. It should be less than 80 characters so that it fits nicely in an 80x25 terminal.
+
+This line isn't too long, but ćōňţăĭņş a number of UTF-8 characters which
+could make it appear to be if improperly decoded.
+
diff --git a/testset/tags.copyright b/testset/tags.copyright
index c78fa16..72005ab 100644
--- a/testset/tags.copyright
+++ b/testset/tags.copyright
@@ -17,5 +17,6 @@ W: copyright.iso-8859-1: debian-copyright-file-uses-obsolete-national-encoding a
 W: copyright.misc-errors: copyright-contains-dh-make-perl-boilerplate
 W: copyright.misc-errors: copyright-has-url-from-dh_make-boilerplate
 W: copyright.misc-errors: copyright-lists-upstream-authors-with-dh_make-boilerplate
+W: copyright.misc-errors: debian-copyright-line-too-long line 20
 W: copyright.old-style: copyright-without-copyright-notice
 W: copyright.symlink: copyright-without-copyright-notice

-- 
Debian package checker


Reply to: