SVN devscripts commit: r557 - trunk/scripts

Adam D. Barratt adam-guest at alioth.debian.org
Sat Mar 10 13:37:08 CET 2007


Author: adam-guest
Date: 2007-03-10 12:37:08 +0000 (Sat, 10 Mar 2007)
New Revision: 557

Modified:
   trunk/scripts/bts.pl
Log:
download_attachments(): Pull the correct subreference out of the URL
Add support for collapsed version graphs


Modified: trunk/scripts/bts.pl
===================================================================
--- trunk/scripts/bts.pl	2007-03-10 11:50:49 UTC (rev 556)
+++ trunk/scripts/bts.pl	2007-03-10 12:37:08 UTC (rev 557)
@@ -1952,8 +1952,9 @@
     # occurrence of either "[<a " or plain "<a ", preserving any "[".
     my @data = split /(?:(?=\[<[Aa]\s)|(?<!\[)(?=<[Aa]\s))/, $toppage;
     foreach (@data) {
-	next unless m%<a(?: class=\".*?\")? href="((bugreport|version)\.cgi[^\"]+)">%i;
-	my $ref = $1;
+	next unless m%<a(?: class=\".*?\")? href="((bugreport\.cgi[^\"]+)">|(version\.cgi[^\"]+)">(<img[^>]+>)?)%i;
+	my $ref = $2;
+	$ref = $3 if not defined $ref;
 	my ($msg, $filename) = href_to_filename($_);
 
 	next unless defined $msg;
@@ -1985,7 +1986,7 @@
 	    # Always need refreshing, as they could change each time the
 	    # bug does
 	}
-	elsif ($cachemode eq 'full' and $msg eq 'versions') {
+	elsif ($cachemode eq 'full' and $msg =~ /^versions(coll)?$/) {
 	    $bug2filename{$msg} = $filename;
 	    # already downloaded?
 	    next if -f $bug2filename{$msg} and not $refreshmode;
@@ -2133,6 +2134,7 @@
 		s%<a((?: class=\".*?\")?) href="(pkgreport\.cgi\?submitter=([^\"&;]+)[^\"]*)">(.+?)</a>%<a$1 href="from_$3.html">$4</a> (<a$1 href="$btscgiurl$2">online</a>)%i;
 		s%<a((?: class=\".*?\")?) href="(?:/cgi-bin/)?(bugspam\.cgi[^\"]+)">%<a$1 href="$btscgiurl$2">%i;
 		s%<a((?: class=\".*?\")?) href="(version\.cgi\?package=(?:[^;]+);found=([^\%]+)\%2F([^\";]+))(?:;[^\"]+)?">(.*?)</a>%<a$1 href="$3.$4.png">$5</a>%;
+		s%<img((?: class=\".*?\")?) src="(version\.cgi\?package=(?:[^;]+);found=([^\%]+)\%2F([^;]+);width=([^;]+);height=([^;\"]+)(?:[^\"]*));collapse=1">%<img$1 src="$3.$4.collapsed.png" width="25\%" height="25\%">%;
 		s%<img((?: class=\".*?\")?) src="(version\.cgi\?package=(?:[^;]+);found=([^\%]+)\%2F([^;]+);width=([^;]+);height=([^;\"]+)(?:[^\"]*))">%<img$1 src="$3.$4.png" width="25\%" height="25\%">%;
 	    }
 	}
@@ -2327,6 +2329,13 @@
 	    return undef;
 	}
     }
+    elsif ($href =~ m%<a href=\"version\.cgi[^>]+><img src=\"version\.cgi\?package=[^;]+;found=([^\%]+)\%2F([^;]+);[^\"]*collapse=1\">%) {
+	my $package = $1;
+	my $version = $2;
+
+	$msg = 'versionscoll';
+	$filename = "$package.$version.collapsed.png";
+    }
     elsif ($href =~ m%<a href=\"version\.cgi\?package=[^;]+;found=([^\%]+)\%2F([^\"]+)\">%) {
 	my $package = $1;
 	my $version = $2;




More information about the Devscripts-devel mailing list