chiark / gitweb /
archive-query config
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Aug 2013 15:46:00 +0000 (16:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Aug 2013 15:46:00 +0000 (16:46 +0100)
dgit
dgit.1

diff --git a/dgit b/dgit
index 23c5f812a50a7411e8664155f7dea09f1c41fec1..1e7be7286de63a62972f1f67b06de54d5d2f415a 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -156,10 +156,14 @@ sub cfg {
     return undef;
 }
 
+sub access_distro () {
+    return cfg("dgit-suite.$suite.distro",
+              "dgit.default.distro");
+}
+
 sub access_cfg ($) {
     my ($key) = @_;
-    my $distro = cfg("dgit-suite.$suite.distro",
-                    "dgit.default.distro");
+    my $distro = access_distro();
     my $value = cfg("dgit-distro.$distro.$key",
                    "dgit.default.$key");
     return $value;
@@ -199,8 +203,14 @@ sub parsechangelog {
 
 our $rmad;
 
-sub askmadison () {
-    $rmad ||= cmdoutput qw(rmadison -asource),"-s$suite",$package;
+sub archive_query () {
+    my $query = access_cfg('archive-query');
+    $query ||= "madison:".access_distro();
+    $query =~ s/^(\w+):// or die "$query ?";
+    my $proto = $1;
+    my $url = $'; #';
+    die unless $proto eq 'madison';
+    $rmad ||= cmdoutput qw(rmadison -asource),"-s$suite","-u$url",$package;
     $rmad =~ m/^ \s*( [^ \t|]+ )\s* \|
                  \s*( [^ \t|]+ )\s* \|
                  \s*( [^ \t|]+ )\s* \|
@@ -213,19 +223,19 @@ sub askmadison () {
        $suite = $3;
     }
     $4 eq 'source' or die "$rmad ?";
-    return $vsn;
+    my $prefix = substr($package, 0, $package =~ m/^l/ ? 4 : 1);
+    my $subpath = "/pool/main/$prefix/$package/${package}_$vsn.dsc";
+    return ($vsn,$subpath);
 }
 
 sub canonicalise_suite () {
-    askmadison();
+    archive_query();
 }
 
 sub get_archive_dsc () {
-    my $vsn = askmadison();
+    my ($vsn,$subpath) = archive_query();
     # fixme madison does not show us the component
-    my $prefix = substr($package, 0, $package =~ m/^l/ ? 4 : 1);
-    $dscurl = access_cfg('mirror').
-       "/pool/main/$prefix/$package/${package}_$vsn.dsc";
+    $dscurl = access_cfg('mirror').$subpath;
     $dscdata = url_get($dscurl);
     my $dscfh = new IO::File \$dscdata, '<' or die $!;
     print DEBUG Dumper($dscdata);
diff --git a/dgit.1 b/dgit.1
index 5895458a1722b0bf360662382f355b4577871344..d2cc128cec7cec012e7ec1f9b973f1fd3635728d 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -162,6 +162,8 @@ on the dgit command line.
 .TP
 .BI dgit-distro. distro .mirror
 .TP
+.BI dgit-distro. distro .archive-query
+.TP
 .BI dgit-distro. distro .ssh
 .TP
 .BR dgit.default. *