[devscripts] 02/05: rc-alert: Ensure the tag/dist description order is stable

James McCoy jamessan at debian.org
Wed Jan 15 02:31:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 5e617030ecb16b84b5da4b5959b29bd1bf5e0cf2
Author: James McCoy <jamessan at debian.org>
Date:   Tue Jan 14 19:55:29 2014 -0500

    rc-alert: Ensure the tag/dist description order is stable
    
    Closes: #735286
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog    |  2 ++
 scripts/rc-alert.pl | 53 +++++++++++++++++++++++++++++------------------------
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3976508..09b3e90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ devscripts (2.13.10) UNRELEASED; urgency=low
   [ James McCoy ]
   * chdist: Ensure error messages end with an EOL.  (Closes: #734307)
   * licensecheck: Add handling for a variation of 3 clause BSD.
+  * rc-alert:
+    + Ensure the tag/dist description order is stable.  (Closes: #735286)
 
  -- Jakub Wilk <jwilk at debian.org>  Fri, 27 Dec 2013 18:39:11 +0100
 
diff --git a/scripts/rc-alert.pl b/scripts/rc-alert.pl
index afa5619..8f1f5aa 100755
--- a/scripts/rc-alert.pl
+++ b/scripts/rc-alert.pl
@@ -38,21 +38,24 @@ my $cachefile = $cachedir . basename($url);
 my $forcecache = 0;
 my $usecache = 0;
 
-my %flagmap = ( '(P)' => "pending",
-		'.(\+)' => "patch",
-		'..(H)' => "help [wanted]",
-		'...(M)' => "moreinfo [needed]",
-		'....(R)' => "unreproducible",
-		'.....(S)' => "security",
-		'......(U)' => "upstream",
-		'.......(I)' => "wheezy-ignore or squeeze-ignore",
-	      );
+my @flags = (
+    [qr/P/ => 'pending'],
+    [qr/\+/ => 'patch'],
+    [qr/H/ => 'help [wanted]'],
+    [qr/M/ => 'moreinfo [needed]'],
+    [qr/R/ => 'unreproducible'],
+    [qr/S/ => 'security'],
+    [qr/U/ => 'upstream'],
+    [qr/I/ => 'wheezy-ignore or squeeze-ignore'],
+);
 # A little hacky but allows us to sort the list by length
-my %distmap = ( '(O)' => "oldstable",
-		'.?(S)' => "stable",
-		'.?.?(T)' => "testing",
-		'.?.?.?(U)' => "unstable",
-		'.?.?.?.?(E)' => "experimental");
+my @dists = (
+    [qr/O/ => 'oldstable'],
+    [qr/S/ => 'stable'],
+    [qr/T/ => 'testing'],
+    [qr/U/ => 'unstable'],
+    [qr/E/ => 'experimental'],
+);
 
 my $includetags = "";
 my $excludetags = "";
@@ -349,14 +352,15 @@ sub human_flags($) {
     my $matchedexcludes = 0;
     my $applies = 1;
 
-    foreach my $flag ( sort { length $a <=> length $b } keys %flagmap ) {
-	if ($mrf =~ /^\[(?:$flag)/) {
-	    if ($excludetags =~ /\Q$1\E/) {
+    foreach my $flagref (@flags) {
+	my ($flag, $desc) = @{$flagref};
+	if ($mrf =~ $flag) {
+	    if ($excludetags =~ $flag) {
 		$matchedexcludes++;
-	    } elsif ($includetags =~ /\Q$1\E/ or ! $includetags) {
+	    } elsif ($includetags =~ $flag or ! $includetags) {
 		$matchedflags++;
 	    }
-	    push @hrf, $flagmap{$flag};
+	    push @hrf, $desc;
 	}
     }
     if ($excludetags and $tagexcoperation eq 'and' and
@@ -387,14 +391,15 @@ sub human_dists($) {
     my $matchedexcludes = 0;
     my $applies = 1;
 
-    foreach my $dist ( sort { length $a <=> length $b } keys %distmap ) {
-	if ($mrf =~ /(?:$dist)/) {
-	    if ($excludedists =~ /$dist/) {
+    foreach my $distref (@dists) {
+	my ($dist, $desc) = @{$distref};
+	if ($mrf =~ $dist) {
+	    if ($excludedists =~ $dist) {
 		$matchedexcludes++;
-	    } elsif ($includedists =~ /$dist/ or ! $includedists) {
+	    } elsif ($includedists =~ $dist or ! $includedists) {
 		$matcheddists++;
 	    }
-	    push @hrf, $distmap{$dist};
+	    push @hrf, $desc;
 	}
     }
     if ($excludedists and $distexcoperation eq 'and' and

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list