summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-10-23 00:05:07 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-10-30 16:35:58 +0000
commitdc711dab0d5e682372d2110655286012be08fdbe (patch)
tree6aa35f59d1bd35bec249b134151d31df3e9d447a /dgit
parentd4d430ea4597ac788cf112587e0a715eed236551 (diff)
dummyapicat: New archive query method
Like ftpmasterapi but knows that actually behind the scenes it's just mostly cat. Ths is relevant because file_in_archive_dummycatapi has to be different. (This is because the test suite can't sensibly predict what queries dgit might make, because the relevant bits of the test suite don't actually really know what .origs might be supposed to exist.) Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit27
1 files changed, 27 insertions, 0 deletions
diff --git a/dgit b/dgit
index abe636d..1b32fa7 100755
--- a/dgit
+++ b/dgit
@@ -1089,6 +1089,33 @@ sub file_in_archive_ftpmasterapi {
my $info = api_query($data, "file_in_archive/$pat", 1);
}
+#---------- `dummyapicat' archive query method ----------
+
+sub archive_query_dummycatapi { archive_query_ftpmasterapi @_; }
+sub canonicalise_suite_dummycatapi { canonicalise_suite_ftpmasterapi @_; }
+
+sub file_in_archive_dummycatapi ($$$) {
+ my ($proto,$data,$filename) = @_;
+ my $mirror = access_cfg('mirror');
+ $mirror =~ s#^file://#/# or die "$mirror ?";
+ my @out;
+ my @cmd = (qw(sh -ec), '
+ cd "$1"
+ find -name "$2" -print0 |
+ xargs -0r sha256sum
+ ', qw(x), $mirror, $filename);
+ debugcmd "-|", @cmd;
+ open FIA, "-|", @cmd or die $!;
+ while (<FIA>) {
+ chomp or die;
+ printdebug "| $_\n";
+ m/^(\w+) (\S+)$/ or die "$_ ?";
+ push @out, { sha256sum => $1, filename => $2 };
+ }
+ close FIA or die failedcmd @cmd;
+ return \@out;
+}
+
#---------- `madison' archive query method ----------
sub archive_query_madison {