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

[SCM] Debian package checker branch, master, updated. 2.1.6-12-gca85ece



The following commit has been merged in the master branch:
commit ca85ece1c8ab2fb274204e6e53383fb30b6e426a
Author: Russ Allbery <rra@debian.org>
Date:   Sat Jan 24 01:42:04 2009 -0800

    Use Lintian::Collect to read the changelog in checks/nmu
    
    * checks/nmu:
      + [RA] Use Lintian::Collect to read the changelog.
    
    This way, we take advantage of the cached parse already required by other
    check scripts.

diff --git a/checks/nmu b/checks/nmu
index 326ac93..6e8b9df 100644
--- a/checks/nmu
+++ b/checks/nmu
@@ -30,11 +30,10 @@ sub run {
 my $pkg = shift;
 my $type = shift;
 my $info = shift;
-my $distribution = undef;
+
 my $changelog_mentions_nmu = 0;
 my $changelog_mentions_local = 0;
 my $changelog_mentions_qa = 0;
-my $uploader = undef;
 
 # This isn't really an NMU check, but right now no other check looks at
 # debian/changelog in source packages.  Catch a debian/changelog file that's a
@@ -45,24 +44,25 @@ if (-l "debfiles/changelog") {
     return 0 unless -f "debfiles/changelog";
 }
 
-open (CHANGELOG, '<', "debfiles/changelog")
-    or fail("Failed opening changelog");
-$distribution = $1 if (<CHANGELOG> =~ /^.* \(.*\) (.*);.*$/);
-my $firstline = 1;
-while (<CHANGELOG>) {
-	if ($firstline) {
-		$changelog_mentions_nmu = 1
-			if (/\bnmu\b/i or /non-maintainer upload/i) and not /(ackno|\back\b|confir|incorporat)/i;
-		$changelog_mentions_local = 1 if /\blocal\s+package\b/i;
-		$changelog_mentions_qa = 1 if /orphan/i or /qa (?:group )?upload/i;
-		$firstline = 0 if /^\s+\S/;
-	}
-	if (/^ -- ([^>]+>)/) {
-		$uploader = canonicalize($1);
-		last;
+# Get some data from the changelog file.
+my ($entry) = $info->changelog->data;
+my $distribution = $entry->Distribution;
+my $uploader = canonicalize($entry->Maintainer);
+my $changes = $entry->Changes;
+$changes =~ s/^(\s*\n)+//;
+my $firstline = (split('\n', $changes))[0];
+
+# Check the first line for QA and NMU mentions.
+if ($firstline) {
+	local $_ = $firstline;
+	if (/\bnmu\b/i or /non-maintainer upload/i) {
+		unless (/(ackno|\back\b|confir|incorporat)/i) {
+			$changelog_mentions_nmu = 1;
+		}
 	}
+	$changelog_mentions_local = 1 if /\blocal\s+package\b/i;
+	$changelog_mentions_qa = 1 if /orphan/i or /qa (?:group )?upload/i;
 }
-close CHANGELOG;
 
 my $version = $info->field("version");
 my $maintainer = canonicalize($info->field("maintainer"));
diff --git a/debian/changelog b/debian/changelog
index dcf9373..88e8eea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ lintian (2.1.7) UNRELEASED; urgency=low
   * checks/files:
     + [RA] Add swfobject.js to embedded-javascript-library.  Thanks, Paul
       Wise.  (Closes: #512363)
+  * checks/nmu:
+    + [RA] Use Lintian::Collect to read the changelog.
   * checks/standards-version{,.desc}:
     + [ADB] Add source-control-file to the list of information needed by
       the script.  Thanks, Raphael Geissert.  (Closes: #512563)

-- 
Debian package checker


Reply to: