File archlinux-url-561536.patch of Package whohas

Description: update search URL for Arch repositories
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561536
Author: Guillaume Delacour <gui@iroqwa.org>
Reviewed-by: Jonathan Wiltshire <jmw@debian.org>
Last-Update: 2010-12-05

--- whohas-0.24.orig/program/whohas	2010-04-05 00:42:48.000000000 +0200
+++ whohas-0.24/program/whohas		2010-12-03 12:26:01.780263569 +0100
@@ -1115,7 +1124,8 @@
 
 sub arch {
 	my $archbase   = "http://www.archlinux.org";
-	my @lines = split /\n/, &fetchdoc($archbase."/packages/?arch=i686&repo=&q=".$_[0]."&last_update=&limit=all");
+	# if we directly query i686, redirected to the specific package page
+	my @lines = split /\n/, &fetchdoc($archbase."/packages/?repo=&q=".$_[0]."&last_update=&limit=all");
 
 	my @repos;
 	my @names;
@@ -1124,7 +1134,7 @@
 	my @urls;
 	my @sizes;
 	for (my $i = 0; $i < @lines; $i++) {
-		if ($lines[$i] =~ /\<tr class\=\"pkgr/) {
+		if ($lines[$i] =~ /\<tr class\=\"odd/) {
 			for (my $a = 2; $a < 11;$a++) {
 				my $temp = $lines[$a+$i];
 				$temp =~ s/.*\<td\>|\<\/td\>//g;
@@ -1132,15 +1142,16 @@
 					push @repos,$temp;
 				} elsif ($a == 4) {
 					push @urls, $archbase.&arch_site_get_url ($lines[$i+$a]);
+				} elsif ($a == 5) {
 					push @names, &arch_site_ger_cont($lines[$i+$a]);
-				} elsif ($a == 6) {
-					$temp =~ s/<span style=\".*\">|<\/span>//g;
+				} elsif ($a == 7) {
+					$temp =~ s/<span class=\".*\">|<\/span>//g;
 					push @versions, $temp;
 				} elsif ($a == 10) {
 					push @dates,    $temp;
 				}
 			}
-			# 2 is package group, 5 is description
+			# 2 is package group
 			push @sizes, "";
 			$i += 7;
 		}
@@ -1153,7 +1164,7 @@
 
 sub arch_site_get_url {
 	my $temp = $_[0];
-	$temp =~ s/.*\<a href=\"|\">.*//g;
+	$temp =~ s/.*\<a href=\"|\".*//g;
 	return $temp;
 }