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

[SCM] Debian package checker branch, master, updated. 2.2.7-6-ga4925c6



The following commit has been merged in the master branch:
commit a4925c6977a7237a6833eac99f867e669e534763
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date:   Tue Mar 10 14:09:31 2009 +0000

    Check diversions after parsing all maintainer scripts rather than inline.
    
    Check all added and removed diversions at once rather than as each
    maintainer script is processed.  This avoids differing results and
    false positives if the postrm is processed before other maintainer
    scripts.  (Closes: #518966)

diff --git a/checks/scripts b/checks/scripts
index 08d9b3b..3dbcfec 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -526,6 +526,7 @@ open(SCRIPTS, '<', "control-scripts")
 # make a shared function awkward.
 
 my %added_diversions;
+my %removed_diversions;
 while (<SCRIPTS>) {
     chop;
 
@@ -885,17 +886,7 @@ while (<SCRIPTS>) {
 		    tag 'diversion-for-unknown-file', $divert, "$file:$."
 			unless (exists $info->index->{$divert});
 		} elsif ($mode eq 'remove') {
-		    if (exists $added_diversions{$divert}) {
-			# do not really delete the entry, because a --remove
-			# might happen in two branches in the script, i.e. we
-			# see it twice, which is not a bug
-			undef $added_diversions{$divert};
-		    } elsif ($file eq 'postrm') {
-			# Allow preinst and postinst to remove diversions the
-			# package doesn't add to clean up after previous
-			# versions of the package.
-			tag 'remove-of-unknown-diversion', $divert, "$file:$.";
-		    }
+		    $removed_diversions{$divert} = [ $file, $. ];
 		} else {
 		    fail "Internal error: \$mode has unknown value: ".
 			"$mode";
@@ -923,6 +914,23 @@ while (<SCRIPTS>) {
 }
 close(SCRIPTS);
 
+for my $divert (keys %removed_diversions) {
+    my $file = $removed_diversions{$divert}[0];
+    my $line = $removed_diversions{$divert}[1];
+
+    if (exists $added_diversions{$divert}) {
+	# do not really delete the entry, because a --remove
+	# might happen in two branches in the script, i.e. we
+	# see it twice, which is not a bug
+	undef $added_diversions{$divert};
+    } elsif ($file eq 'postrm') {
+	# Allow preinst and postinst to remove diversions the
+	# package doesn't add to clean up after previous
+	# versions of the package.
+	tag 'remove-of-unknown-diversion', $divert, "$file:$line";
+    }
+}
+
 for my $file (grep { defined $added_diversions{$_} } keys %added_diversions) {
     tag 'orphaned-diversion', $file, $added_diversions{$file};
 }
diff --git a/debian/changelog b/debian/changelog
index 69d8c37..f5ecf3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,10 @@ lintian (2.2.8) UNRELEASED; urgency=low
   * checks/scripts:
     + [RA] Policy allows scripts to assume that /bin/sh supports local
       with simple variable assignments.
+    + [ADB] Check all added and removed diversions at once rather than
+      as each maintainer script is processed.  This avoids differing
+      results and false positives if the postrm is processed before other
+      maintainer scripts.  (Closes: #518966)
 
   * lib/Dep.pm:
     + [RA] Remove, replaced with Lintian::Relation.

-- 
Debian package checker


Reply to: