Debian Codegraph @

debian/tests/double

raw symbols SCIP
1 #!/usr/bin/env bash
2 set -Eeuo pipefail
3
4 suite='bullseye'
5 timestamp='2023-01-01T00:00:00Z'
6
7 expectedEpoch='1672531200'
8
9 tempDir="$(mktemp -d)"
10 trap "rm -rf '$tempDir'" EXIT
11 rootfs="$tempDir/rootfs"
12
13 set -x
14
15 # make a new keyring that contains all archive keys so this still works in the future too
16 # (see also "debian.sh" in the debuerreotype examples, which this is a hyper-simplified version of)
17 keyring="$tempDir/keyring.gpg"
18 gpg --batch --no-default-keyring --keyring "$keyring" --import \
19 /usr/share/keyrings/debian-archive-keyring.gpg \
20 /usr/share/keyrings/debian-archive-removed-keys.gpg
21
22 dpkgArch="$(dpkg --print-architecture)"
23
24 do-the-thing() {
25 local rootfs="$1"; shift
26
27 debuerreotype-init --arch="$dpkgArch" --keyring="$keyring" "$rootfs" "$suite" "$timestamp"
28 [ "$(< "$rootfs/debuerreotype-epoch")" = "$expectedEpoch" ]
29
30 debuerreotype-chroot "$rootfs" true
31
32 debuerreotype-debian-sources-list "$rootfs" "$suite"
33
34 debuerreotype-tar "$rootfs" "$rootfs.tar"
35 }
36
37 do-the-thing "${rootfs}1"
38
39 # TODO https://manpages.debian.org/bullseye/manpages/time_namespaces.7.en.html
40
41 if [ "$sha256" != "$expectedSha256" ]; then
42 if [ -z "$expectedSha256" ]; then
43 (
44 set +x
45 echo >&2
46 echo >&2 "WARNING: no expected SHA256 for '$dpkgArch' known -- please file a bug with this full build output against src:debuerreotype!"
47 echo >&2
48 )
49 exit 0
50 fi
51
52 (
53 set +x
54 echo >&2
55 echo >&2 'ERROR: expected SHA256 does not match actual -- downloading pristine source to compare (via diffoscope)'
56 echo >&2 " - $expectedCompareUrl"
57 echo >&2
58 )
59
60 wget -qO "$tempDir/expected.txz" "$expectedCompareUrl"
61 xz -d < "$tempDir/expected.txz" > "$tempDir/expected.tar"
62 diffoscope >&2 "$tempDir/expected.tar" "$tempDir/actual.tar"
63 exit 1
64 fi