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

[SCM] Debian package checker branch, master, updated. 2.5.2-129-g8bd7c93



The following commit has been merged in the master branch:
commit 4cda8e923aaf83ccfd648a5317a349471a82c535
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Sep 10 10:22:18 2011 +0200

    Skip possible upstream changelogs in coll/changelog-file
    
    coll/changelog-file now double checks changelogs that does not
    have "debian" in their filename.  If such a changelog fails the
    check, it is assumed to be an upstream changelog and the Debian
    one is assumed to be missing.
    
    This avoids a myriad of "syntax errors" tags in packages like
    perl, where the Debian changelog is missing and the upstream
    one is present.

diff --git a/checks/changelog-file.desc b/checks/changelog-file.desc
index 8b6657f..2c0b6fe 100644
--- a/checks/changelog-file.desc
+++ b/checks/changelog-file.desc
@@ -62,6 +62,9 @@ Info: Each Debian package (which provides a /usr/share/doc/<i>pkg</i>
  to be a native Debian package (i.e., there is no upstream source),
  the file should usually be installed as
  /usr/share/doc/<i>pkg</i>/changelog.gz
+ .
+ Note that Lintian may emit this tag if the changelog exists, but it
+ does not look like a Debian changelog.
 Ref: policy 12.7
 
 Tag: wrong-name-for-upstream-changelog
diff --git a/collection/changelog-file b/collection/changelog-file
index 4e58c90..ea3ab7f 100755
--- a/collection/changelog-file
+++ b/collection/changelog-file
@@ -91,6 +91,26 @@ if (not defined $chl) {
 	or fail("cannot link $chl to changelog: $!");
 }
 
+if ($chl && $chl !~ m/changelog\.debian/i) {
+    # Either this is a native package OR a non-native package where the
+    # debian changelog is missing.  checks/changelog is not too happy
+    # with the latter case, so check looks like a Debian changelog.
+    open my $fd, '<', 'changelog' or fail "Opening changelog: $!";
+    my $ok = 0;
+    while ( my $line = <$fd> ) {
+        next if $line =~ m/^\s*+$/o;
+        # look for something like
+        # lintian (2.5.3) UNRELEASED; urgency=low
+        if ($line =~ m/^\S+\s*\([^\)]+\)\s*(?:UNRELEASED|(?:[^ \t;]+\s*)+)\;/o) {
+            $ok = 1;
+        }
+        last;
+    }
+    close $fd;
+    # Remove it if it not the Debian changelog.
+    unlink 'changelog' unless $ok;
+}
+
 # Extract NEWS.Debian files as well, with similar precautious.  Ignore any
 # symlinks to other packages here; in that case, we just won't check the file.
 unlink('NEWS.Debian') or fail("cannot unlink NEWS.Debian: $!")
diff --git a/debian/changelog b/debian/changelog
index 48e6ead..e4faa6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -48,6 +48,9 @@ lintian (2.5.3) UNRELEASED; urgency=low
       (Closes: #639946)
     + [JW,NT] Fixed use of uninitialized value as hash key.
       (Closes: #640238)
+    + [NT] Mention that the missing native changelog tag can, in
+      some cases, be emitted if it does not look like a Debian
+      changelog.
   * checks/{conffile,etcfiles}{,.desc}:
     + [JW] Merged etcfiles into conffile.  (Closes: #637590)
   * checks/copyright-file{,.desc}:
@@ -143,6 +146,11 @@ lintian (2.5.3) UNRELEASED; urgency=low
 
   * collection/fields{,.desc}:
     + [NT] Removed, no longer used.
+  * collection/changelog-file:
+    + [NT] Double check changelogs that does not explicitly contains
+      "debian" in the filename.  This should avoid a myriad of syntax
+      error tags in some cases (such as perl), where the Debian
+      changelog is not present and there is an upstream changelog.
 
   * data/fields/archive-sections:
     + [NT] Fixed a typo in "otherosfs" section name.  Thanks to
diff --git a/t/tests/changelog-file-missing/debian/debian/rules b/t/tests/changelog-file-no-dch/debian/debian/rules
similarity index 51%
copy from t/tests/changelog-file-missing/debian/debian/rules
copy to t/tests/changelog-file-no-dch/debian/debian/rules
index a687494..8d01470 100755
--- a/t/tests/changelog-file-missing/debian/debian/rules
+++ b/t/tests/changelog-file-no-dch/debian/debian/rules
@@ -5,5 +5,5 @@
 
 
 override_dh_md5sums:
-	find debian/*/ -type f -a -name 'changelog*' -delete
+	find debian/*/ -type f -a -iname 'changelog.debian*' -delete
 	dh_md5sums
diff --git a/t/tests/changelog-file-no-dch/desc b/t/tests/changelog-file-no-dch/desc
new file mode 100644
index 0000000..af27503
--- /dev/null
+++ b/t/tests/changelog-file-no-dch/desc
@@ -0,0 +1,7 @@
+Testname: changelog-file-no-dch
+Sequence: 6000
+Type: non-native
+Version: 1.0-1
+Description: Test if Debian changelog is missing
+Test-For: debian-changelog-file-missing-or-wrong-name
+Test-Against: syntax-error-in-debian-changelog
diff --git a/t/tests/changelog-file-no-dch/tags b/t/tests/changelog-file-no-dch/tags
new file mode 100644
index 0000000..66091c5
--- /dev/null
+++ b/t/tests/changelog-file-no-dch/tags
@@ -0,0 +1 @@
+E: changelog-file-no-dch: debian-changelog-file-missing-or-wrong-name
diff --git a/t/tests/changelog-file-no-dch/upstream/ChangeLog b/t/tests/changelog-file-no-dch/upstream/ChangeLog
new file mode 100644
index 0000000..a935b07
--- /dev/null
+++ b/t/tests/changelog-file-no-dch/upstream/ChangeLog
@@ -0,0 +1,5 @@
+2011-09-10  Niels Thykier  <niels@thykier.net>
+
+	* This is a non-Debian ChangeLog.  Lintian should not be tricked
+	to believe this is a Debian changelog.
+
diff --git a/t/tests/changelog-file-missing/upstream/README b/t/tests/changelog-file-no-dch/upstream/README
similarity index 100%
copy from t/tests/changelog-file-missing/upstream/README
copy to t/tests/changelog-file-no-dch/upstream/README

-- 
Debian package checker


Reply to: