coverage.sh: only copy or test files that actually exist

This commit is contained in:
Johannes 'josch' Schauer 2020-11-27 01:00:56 +01:00
parent 0b27660468
commit df04cf91f2
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -2,26 +2,28 @@
set -eu set -eu
TMPFILE=$(mktemp) if [ -e ./mmdebstrap -a -e ./taridshift -a -e ./tarfilter ]; then
perltidy < mmdebstrap > "$TMPFILE" TMPFILE=$(mktemp)
ret=0 perltidy < ./mmdebstrap > "$TMPFILE"
diff -u mmdebstrap "$TMPFILE" || ret=$? ret=0
if [ "$ret" -ne 0 ]; then diff -u ./mmdebstrap "$TMPFILE" || ret=$?
if [ "$ret" -ne 0 ]; then
echo "perltidy failed" >&2 echo "perltidy failed" >&2
rm "$TMPFILE" rm "$TMPFILE"
exit 1 exit 1
fi fi
rm "$TMPFILE" rm "$TMPFILE"
if [ $(sed -e '/^__END__$/,$d' mmdebstrap | wc --max-line-length) -gt 79 ]; then if [ $(sed -e '/^__END__$/,$d' ./mmdebstrap | wc --max-line-length) -gt 79 ]; then
echo "exceeded maximum line length of 79 characters" >&2 echo "exceeded maximum line length of 79 characters" >&2
exit 1 exit 1
fi
perlcritic --severity 4 --verbose 8 ./mmdebstrap
black --check ./taridshift ./tarfilter
fi fi
perlcritic --severity 4 --verbose 8 mmdebstrap
black --check taridshift tarfilter proxysolver
mirrordir="./shared/cache/debian" mirrordir="./shared/cache/debian"
if [ ! -e "$mirrordir" ]; then if [ ! -e "$mirrordir" ]; then
@ -66,27 +68,48 @@ fi
# only copy if necessary # only copy if necessary
if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
if [ -e ./mmdebstrap ]; then
cp -a mmdebstrap shared cp -a mmdebstrap shared
else
cp -a /usr/bin/mmdebstrap shared
fi
fi fi
if [ ! -e shared/taridshift ] || [ taridshift -nt shared/taridshift ]; then if [ ! -e shared/taridshift ] || [ taridshift -nt shared/taridshift ]; then
cp -a taridshift shared if [ -e ./taridshift ]; then
cp -a ./taridshift shared
else
cp -a /usr/bin/mmtaridshift shared/taridshift
fi
fi fi
if [ ! -e shared/tarfilter ] || [ tarfilter -nt shared/tarfilter ]; then if [ ! -e shared/tarfilter ] || [ tarfilter -nt shared/tarfilter ]; then
if [ -e ./tarfilter ]; then
cp -a tarfilter shared cp -a tarfilter shared
fi else
if [ ! -e shared/proxysolver ] || [ proxysolver -nt shared/proxysolver ]; then cp -a /usr/bin/mmtarfilter shared/tarfilter
cp -a proxysolver shared fi
fi fi
mkdir -p shared/hooks mkdir -p shared/hooks
if [ ! -e shared/hooks/setup00-merged-usr.sh ] || [ hooks/setup00-merged-usr.sh -nt shared/hooks/setup00-merged-usr.sh ]; then if [ ! -e shared/hooks/setup00-merged-usr.sh ] || [ hooks/setup00-merged-usr.sh -nt shared/hooks/setup00-merged-usr.sh ]; then
cp -a hooks/setup00-merged-usr.sh shared/hooks/setup00-merged-usr.sh if [ -e hooks/setup00-merged-usr.sh ]; then
cp -a hooks/setup00-merged-usr.sh shared/hooks/
else
cp -a /usr/share/mmdebstrap/hooks/setup00-merged-usr.sh shared/hooks/
fi
fi fi
mkdir -p shared/hooks/eatmydata mkdir -p shared/hooks/eatmydata
if [ ! -e shared/hooks/eatmydata/extract.sh ] || [ hooks/eatmydata/extract.sh -nt shared/hooks/eatmydata/extract.sh ]; then if [ ! -e shared/hooks/eatmydata/extract.sh ] || [ hooks/eatmydata/extract.sh -nt shared/hooks/eatmydata/extract.sh ]; then
cp -a hooks/eatmydata/extract.sh shared/hooks/eatmydata/extract.sh if [ -e hooks/eatmydata/extract.sh ]; then
cp -a hooks/eatmydata/extract.sh shared/hooks/eatmydata/
else
cp -a /usr/share/mmdebstrap/hooks/eatmydata/extract.sh shared/hooks/eatmydata/
fi
fi fi
if [ ! -e shared/hooks/eatmydata/customize.sh ] || [ hooks/eatmydata/customize.sh -nt shared/hooks/eatmydata/customize.sh ]; then if [ ! -e shared/hooks/eatmydata/customize.sh ] || [ hooks/eatmydata/customize.sh -nt shared/hooks/eatmydata/customize.sh ]; then
cp -a hooks/eatmydata/customize.sh shared/hooks/eatmydata/customize.sh if [ -e hooks/eatmydata/customize.sh ]; then
cp -a hooks/eatmydata/customize.sh shared/hooks/eatmydata/
else
cp -a /usr/share/mmdebstrap/hooks/eatmydata/customize.sh shared/hooks/eatmydata/
fi
fi fi
starttime= starttime=