Author: adam-guest
Date: 2008-04-22 21:55:28 +0000 (Tue, 22 Apr 2008)
New Revision: 1375
Modified:
trunk/debian/changelog
trunk/scripts/debcheckout.pl
Log:
debcheckout: Use the Vcs-* headers from the highest available version
rather than the first returned by "apt-get source"
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-04-22 05:44:57 UTC (rev 1374)
+++ trunk/debian/changelog 2008-04-22 21:55:28 UTC (rev 1375)
@@ -3,6 +3,8 @@
* checkbashisms: When rebuilding the list of bashisms to check, ensure it is
based on whether the current file is a makefile, rather than whether the
previous file was. Thanks to Raphael Geissert for the brown paper bag.
+ * debcheckout: Use the Vcs-* headers from the highest available version
+ rather than the first returned by "apt-get source"
-- Adam D. Barratt <[EMAIL PROTECTED]> Mon, 21 Apr 2008 20:06:13 +0100
Modified: trunk/scripts/debcheckout.pl
===================================================================
--- trunk/scripts/debcheckout.pl 2008-04-22 05:44:57 UTC (rev 1374)
+++ trunk/scripts/debcheckout.pl 2008-04-22 21:55:28 UTC (rev 1375)
@@ -118,6 +118,8 @@
use File::Copy qw/copy/;
use File::Temp qw/tempdir/;
use Cwd;
+use lib '/usr/share/devscripts';
+use Devscripts::Versort;
my @files = (); # files to checkout
@@ -168,6 +170,10 @@
my ($pkg) = @_;
my @repo = (0, "");
my $found = 0;
+ my $version = "";
+ my $type = "";
+ my $url = "";
+ my @repos = ();
open(APT, "apt-cache showsrc $pkg |");
while (my $line = <APT>) {
@@ -175,12 +181,24 @@
chomp($line);
if ($line =~ /^(x-)?vcs-(\w+):\s*(.*)$/i) {
next if lc($2) eq "browser";
- @repo = (lc($2), $3);
- last;
+ ($type, $url) = (lc($2), $3);
+ } elsif ($line =~ /^Version:\s*(.*)$/i) {
+ $version = $1;
+ } elsif ($line =~ /^$/) {
+ push (@repos, [$version, $type, $url])
+ if ($version and $type and $url);
+ $version = "";
+ $type = "";
+ $url = "";
}
}
close(APT);
die "unknown package '$pkg'\n" unless $found;
+
+ if (@repos) {
+ @repos = Devscripts::Versort::versort(@repos);
+ @repo = ($repos[0][1], $repos[0][2])
+ }
return @repo;
}
@@ -189,6 +207,8 @@
my ($pkg) = @_;
my $browse = "";
my $found = 0;
+ my $version = "";
+ my @browses;
open(APT, "apt-cache showsrc $pkg |");
while (my $line = <APT>) {
@@ -197,12 +217,22 @@
if ($line =~ /^(x-)?vcs-(\w+):\s*(.*)$/i) {
if (lc($2) eq "browser") {
$browse = $3;
- last;
}
+ } elsif ($line =~ /^Version:\s*(.*)$/i) {
+ $version = $1;
+ } elsif ($line =~ /^$/) {
+ push(@browses, [$version, $browse])
+ if $version and $browse;
+ $version = "";
+ $browse = "";
}
}
close(APT);
die "unknown package '$pkg'\n" unless $found;
+ if (@browses) {
+ @browses = Devscripts::Versort::versort(@browses);
+ $browse = $browses[0][1];
+ }
return $browse;
}
--
To unsubscribe, send mail to [EMAIL PROTECTED]