From dc711dab0d5e682372d2110655286012be08fdbe Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 23 Oct 2016 00:05:07 +0100 Subject: [PATCH] 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 --- dgit | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dgit b/dgit index abe636df..1b32fa7c 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 () { + 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 { -- 2.30.2