From 5e07567d5a77ed7083394ff625b884a2a0ca1465 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sat, 11 Feb 2023 15:26:48 +0100 Subject: [PATCH] move running debootstrap from make_mirror.sh to a test case --- coverage.sh | 15 --------------- coverage.txt | 5 +++++ make_mirror.sh | 31 ------------------------------- tests/debootstrap | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 46 deletions(-) create mode 100644 tests/debootstrap diff --git a/coverage.sh b/coverage.sh index 2a0f6f7..cf650c1 100755 --- a/coverage.sh +++ b/coverage.sh @@ -51,21 +51,6 @@ if [ "$HAVE_QEMU" = "yes" ]; then fi fi -# check if all required debootstrap tarballs exist -notfound=0 -for dist in oldstable stable testing unstable; do - for variant in minbase buildd -; do - if [ ! -e "shared/cache/debian-$dist-$variant.tar" ]; then - echo "shared/cache/debian-$dist-$variant.tar does not exist" >&2 - notfound=1 - fi - done -done -if [ "$notfound" -ne 0 ]; then - echo "not all required debootstrap tarballs are present" >&2 - exit 1 -fi - # choose the timestamp of the unstable Release file, so that we get # reproducible results for the same mirror timestamp SOURCE_DATE_EPOCH=$(date --date="$(grep-dctrl -s Date -n '' "$mirrordir/dists/$DEFAULT_DIST/Release")" +%s) diff --git a/coverage.txt b/coverage.txt index a064daa..045dbc8 100644 --- a/coverage.txt +++ b/coverage.txt @@ -1,3 +1,8 @@ +Test: debootstrap +Dists: any +Variants: minbase buildd - +Needs-Root: true + Test: check-against-debootstrap-dist Dists: any Variants: minbase buildd - diff --git a/make_mirror.sh b/make_mirror.sh index e56397e..b9dee1d 100755 --- a/make_mirror.sh +++ b/make_mirror.sh @@ -673,37 +673,6 @@ END trap "cleanup_newcachedir" EXIT INT TERM fi -mirror="http://127.0.0.1/debian" -for dist in oldstable stable testing unstable; do - for variant in minbase buildd -; do - echo "running debootstrap --variant=$variant $dist \${TEMPDIR} $mirror" - cat << END > shared/test.sh -#!/bin/sh -set -eu -export LC_ALL=C.UTF-8 -export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH -echo "SOURCE_DATE_EPOCH=\$SOURCE_DATE_EPOCH" -tmpdir="\$(mktemp -d)" -chmod 755 "\$tmpdir" -case "$dist" in - oldstable|stable) - debootstrap --no-merged-usr --variant=$variant $dist "\$tmpdir" $mirror - ;; - *) - debootstrap --merged-usr --variant=$variant $dist "\$tmpdir" $mirror - ;; -esac -tar --sort=name --mtime=@$SOURCE_DATE_EPOCH --clamp-mtime --numeric-owner --one-file-system --xattrs -C "\$tmpdir" -c . > "$newcache/debian-$dist-$variant.tar" -rm -r "\$tmpdir" -END - if [ "$HAVE_QEMU" = "yes" ]; then - cachedir=$newcachedir ./run_qemu.sh - else - ./run_null.sh SUDO - fi - done -done - if [ "$HAVE_QEMU" = "yes" ]; then # now replace the minihttpd config with one that serves the new repository guestfish -a "$newcachedir/debian-$DEFAULT_DIST.qcow" -i < "./cache/debian-{{ DIST }}-{{ VARIANT }}.tar" +rm -r "$tmpdir"