if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
if [ -n "$APT_DEBUG_TESTS" ]; then
- $SHELL
+ APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" $SHELL
fi
EXIT_CODE=$((EXIT_CODE+1));
}
'gz') printf "gzip\tgz\tgzip\n";;
'bz2') printf "bzip2\tbz2\tbzip2\n";;
'lzma') printf "lzma\tlzma\txz --format=lzma\n";;
- 'xz') printf "xz\txz\txz\n";;
*) printf "$1\t$1\t$1\n";;
esac
shift
}
forcecompressor() {
COMPRESSOR="$1"
+ COMPRESS="$1"
COMPRESSOR_CMD="$1"
case $COMPRESSOR in
gzip) COMPRESS='gz';;
bzip2) COMPRESS='bz2';;
- lzma) COMPRESS='lzma';;
- xz) COMPRESS='xz';;
- *) msgdie "Compressor $COMPRESSOR is unknown to framework, so can't be forced by forcecompressor!";;
esac
local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor"
echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; };
-Dir::Bin::uncompressed \"/does/not/exist\";
-Dir::Bin::gzip \"/does/not/exist\";
-Dir::Bin::bzip2 \"/does/not/exist\";
-Dir::Bin::lzma \"/does/not/exist\";
-Dir::Bin::xz \"/does/not/exist\";" > "$CONFFILE"
+Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE"
+ for COMP in $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Name \([^.].\+\)$#\1#p'); do
+ echo "Dir::Bin::${COMP} \"/does/not/exist\";"
+ done >> "$CONFFILE"
if [ -e "/bin/${COMPRESSOR}" ]; then
echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE"
elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
done
} | sort
}
+forallsupportedcompressors() {
+ for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do
+ if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = 'lz4' ]; then continue; fi
+ "$@" "$COMP"
+ done
+}
### convenience hacks ###
mkdir() {
. "$TESTDIR/framework"
setupenvironment
-configcompression '.' 'xz' 'bz2' 'lzma' 'gz'
+configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p')
configarchitecture 'i386'
buildsimplenativepackage 'testpkg' 'i386' '1.0'
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'file policy is broken'
testsuccessequal "$GOODPOLICY" aptcache policy testpkg
-for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done
+forallsupportedcompressors testovermethod 'file'
rewritesourceslist "copy://${TMPWORKINGDIRECTORY}/aptarchive"
rm -rf rootdir/var/lib/apt/lists
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 copy:/' | wc -l) -eq 4 || msgdie 'copy policy is broken'
testsuccessequal "$GOODPOLICY" aptcache policy testpkg
-for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'copy' $COMPRESSOR; done
+forallsupportedcompressors testovermethod 'copy'
changetowebserver
rm -rf rootdir/var/lib/apt/lists
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'http policy is broken'
testsuccessequal "$GOODPOLICY" aptcache policy testpkg
-for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done
+forallsupportedcompressors testovermethod 'http'
changetohttpswebserver
rm -rf rootdir/var/lib/apt/lists
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 https://' | wc -l) -eq 4 || msgdie 'https policy is broken'
testsuccessequal "$GOODPOLICY" aptcache policy testpkg
-for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'https' $COMPRESSOR; done
+forallsupportedcompressors testovermethod 'https'
changetocdrom 'Debian APT Testdisk 0.8.15'
rm -rf rootdir/var/lib/apt/lists
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'cdrom policy is broken'
testsuccessequal "$GOODPOLICY" aptcache policy testpkg
-for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'cdrom' $COMPRESSOR; done
+forallsupportedcompressors testovermethod 'cdrom'