chiark / gitweb /
Provide "test-dummy" distro with "dummycat" access method.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Nov 2013 16:46:37 +0000 (16:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 24 Nov 2013 17:45:26 +0000 (17:45 +0000)
debian/changelog
dgit

index a1baad2b7de8cb5c4ab602bf37149a099b488a09..5a543d792f1577f905f375d43a96da4a4181f805 100644 (file)
@@ -1,9 +1,15 @@
+dgit (0.19~experimental1) experimental; urgency=low
+
+  Testing facilities:
+  * Provide "test-dummy" distro with "dummycat" access method.
+
+ --
+
 dgit (0.18.2) unstable; urgency=high
 
   Bump archive upload urgency to high.
 
  -- Ian Jackson <ijackson@chiark.greenend.org.uk>  Sun, 24 Nov 2013 17:42:57 +0000
-
 dgit (0.18.1) unstable; urgency=low
 
   Bugfixes:
diff --git a/dgit b/dgit
index 0f372f21a3b33c690c1a1a5a7004da788f98a08f..70305040451becf05db4c4b67545111eb6b5219c 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -441,6 +441,8 @@ sub cmd_help () {
     exit 0;
 }
 
+our $td = $ENV{DGIT_TEST_DUMMY_DIR} || "DGIT_TEST_DUMMY_DIR-unset";
+
 our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit.default.username' => '',
               'dgit.default.archive-query-default-component' => 'main',
@@ -453,7 +455,17 @@ our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit-distro.debian.sshpsql-host' => 'coccia.debian.org',
               'dgit-distro.debian.sshpsql-dbname' => 'service=projectb',
               'dgit-distro.debian.upload-host' => 'ftp-master', # for dput
-              'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/');
+              'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/',
+              'dgit-distro.test-dummy.ssh' => "$td/ssh",
+              'dgit-distro.test-dummy.username' => "alice",
+              'dgit-distro.test-dummy.git-check' => "ssh-cmd",
+              'dgit-distro.test-dummy.git-create' => "ssh-cmd",
+              'dgit-distro.test-dummy.git-url' => "$td/git",
+              'dgit-distro.test-dummy.git-host' => "git",
+              'dgit-distro.test-dummy.git-path' => "$td/git",
+              'dgit-distro.test-dummy.archive-query' => "dummycat:$td/aq",
+              'dgit-distro.test-dummy.mirror' => "file://$td/mirror/",
+               );
 
 sub cfg {
     foreach my $c (@_) {
@@ -715,6 +727,45 @@ END
     return $rows[0];
 }
 
+sub canonicalise_suite_dummycat ($$) {
+    my ($proto,$data) = @_;
+    my $dpath = "$data/suite.$isuite";
+    if (!open C, "<", $dpath) {
+       $!==ENOENT or die "$dpath: $!";
+       printdebug "dummycat canonicalise_suite $isuite $dpath ENOENT\n";
+       return $isuite;
+    }
+    $!=0; $_ = <C>;
+    chomp or die "$dpath: $!";
+    close C;
+    printdebug "dummycat canonicalise_suite $isuite $dpath = $_\n";
+    return $_;
+}
+
+sub archive_query_dummycat ($$) {
+    my ($proto,$data) = @_;
+    canonicalise_suite();
+    my $dpath = "$data/package.$csuite.$package";
+    if (!open C, "<", $dpath) {
+       $!==ENOENT or die "$dpath: $!";
+       printdebug "dummycat query $csuite $package $dpath ENOENT\n";
+       return ();
+    }
+    my @rows;
+    while (<C>) {
+       next if m/^\#/;
+       next unless m/\S/;
+       die unless chomp;
+       printdebug "dummycat query $csuite $package $dpath | $_\n";
+       my @row = split /\s+/, $_;
+       @row==2 or die "$dpath: $_ ?";
+       push @rows, \@row;
+    }
+    C->error and die "$dpath: $!";
+    close C;
+    return @rows;
+}
+
 sub canonicalise_suite () {
     return if defined $csuite;
     fail "cannot operate on $isuite suite" if $isuite eq 'UNRELEASED';