summaryrefslogtreecommitdiff
path: root/tests/tests/orig-include-exclude-chkquery
blob: f8eac5798062a75e685a8f87294e8783bb209fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e
. tests/lib

t-git-config dgit-distro.test-dummy.archive-query ftpmasterapi:
# ^ that will crash if it gets unexpected file_in_archive queries

# orig-include-exclude will set origs and usvsns
update-files_in_archive () {
	for o in $origs; do for usvsn in $usvsns; do \
		of=${p}_${v%-*}.${o}.tar.gz
		pat="%/${of//_/\\_}"
		# curl url-decodes these things so we have to have literals
		find $tmp/mirror -name $of | \
			xargs -r sha256sum | \
			perl -pe '
				BEGIN { print "["; }
				chomp;
				s/^/{"sha256sum":"/;
				s/  /","filename":"/;
				s/$/"}$delim/;
				$delim=",";
				END { print "]\n"; }
			' \
			>$tmp/aq/"file_in_archive/$pat"
	done; done
}

test_push_2_hook=update-files_in_archive

. $troot/lib-orig-include-exclude

t-ok