From: Ian Jackson Date: Sat, 16 Nov 2013 16:46:37 +0000 (+0000) Subject: Provide "test-dummy" distro with "dummycat" access method. X-Git-Tag: debian/0.19~31 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=3f109a333aa0186c183641312e36f34066dab9e2 Provide "test-dummy" distro with "dummycat" access method. --- diff --git a/debian/changelog b/debian/changelog index a1baad2b..5a543d79 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 24 Nov 2013 17:42:57 +0000 - dgit (0.18.1) unstable; urgency=low Bugfixes: diff --git a/dgit b/dgit index 0f372f21..70305040 100755 --- 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; $_ = ; + 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 () { + 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';