summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/framework396
-rwxr-xr-xtest/integration/run-tests57
-rwxr-xr-xtest/integration/test-allow-scores-for-all-dependency-types144
-rwxr-xr-xtest/integration/test-apt-bug-718329-support-data.tar34
-rwxr-xr-xtest/integration/test-apt-cdrom86
-rwxr-xr-xtest/integration/test-apt-cli-list53
-rwxr-xr-xtest/integration/test-apt-cli-search48
-rwxr-xr-xtest/integration/test-apt-cli-show38
-rwxr-xr-xtest/integration/test-apt-cli-upgrade39
-rwxr-xr-xtest/integration/test-apt-get-autoremove10
-rwxr-xr-xtest/integration/test-apt-get-changelog10
-rwxr-xr-xtest/integration/test-apt-get-download16
-rwxr-xr-xtest/integration/test-apt-get-source16
-rwxr-xr-xtest/integration/test-apt-get-source-multisources30
-rwxr-xr-xtest/integration/test-apt-helper39
-rwxr-xr-xtest/integration/test-apt-https-no-redirect30
-rwxr-xr-xtest/integration/test-apt-progress-fd-conffile17
-rwxr-xr-xtest/integration/test-apt-progress-fd-error-postinst22
-rwxr-xr-xtest/integration/test-apt-sources-deb822112
-rwxr-xr-xtest/integration/test-architecture-specification-parsing82
-rwxr-xr-xtest/integration/test-bug-602412-dequote-redirect33
-rwxr-xr-xtest/integration/test-bug-612958-use-dpkg-multiarch-config9
-rwxr-xr-xtest/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted2
-rwxr-xr-xtest/integration/test-bug-661537-build-profiles-support147
-rwxr-xr-xtest/integration/test-bug-723705-tagfile-truncates-fields2
-rwxr-xr-xtest/integration/test-bug-728500-tempdir19
-rwxr-xr-xtest/integration/test-bug-735967-lib32-to-i386-unavailable89
-rwxr-xr-xtest/integration/test-bug-737130-multicompress-file-modes30
-rwxr-xr-xtest/integration/test-bug-738785-switch-protocol63
-rwxr-xr-xtest/integration/test-bug-740843-versioned-up-down-breaks55
-rwxr-xr-xtest/integration/test-bug-multiarch-upgrade29
-rwxr-xr-xtest/integration/test-compressed-indexes1
-rwxr-xr-xtest/integration/test-conflicts-loop12
-rwxr-xr-xtest/integration/test-failing-maintainer-scripts132
-rwxr-xr-xtest/integration/test-ignore-provides-if-versioned-breaks4
-rwxr-xr-xtest/integration/test-ignore-provides-if-versioned-conflicts4
-rwxr-xr-xtest/integration/test-kernel-helper-autoremove101
-rwxr-xr-xtest/integration/test-partial-file-support43
-rwxr-xr-xtest/integration/test-pdiff-usage170
-rwxr-xr-xtest/integration/test-prevent-markinstall-multiarch-same-versionscrew8
-rwxr-xr-xtest/integration/test-sourceslist-arch-plusminus-options2
-rwxr-xr-xtest/integration/test-ubuntu-bug-1078697-missing-source-hashes (renamed from test/integration/test-bug-1078697-missing-source-hashes)0
-rwxr-xr-xtest/integration/test-ubuntu-bug-346386-apt-get-update-paywall2
-rwxr-xr-xtest/integration/test-ubuntu-bug-784473-InRelease-one-message-only2
-rwxr-xr-xtest/integration/test-very-tight-loop-configure-with-unpacking-new-packages29
45 files changed, 1869 insertions, 398 deletions
diff --git a/test/integration/framework b/test/integration/framework
index a28363768..8e401cb5f 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -3,40 +3,46 @@
EXIT_CODE=0
# we all like colorful messages
-if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \
- expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then
- CERROR="" # red
- CWARNING="" # yellow
- CMSG="" # green
- CINFO="" # light blue
- CDEBUG="" # blue
- CNORMAL="" # default system console color
- CDONE="" # green
- CPASS="" # green
- CFAIL="" # red
- CCMD="" # pink
+if [ "$MSGCOLOR" != 'NO' ]; then
+ if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+ export MSGCOLOR='NO'
+ fi
+fi
+
+
+if [ "$MSGCOLOR" != 'NO' ]; then
+ CERROR="\033[1;31m" # red
+ CWARNING="\033[1;33m" # yellow
+ CMSG="\033[1;32m" # green
+ CINFO="\033[1;96m" # light blue
+ CDEBUG="\033[1;94m" # blue
+ CNORMAL="\033[0;39m" # default system console color
+ CDONE="\033[1;32m" # green
+ CPASS="\033[1;32m" # green
+ CFAIL="\033[1;31m" # red
+ CCMD="\033[1;35m" # pink
fi
msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; }
msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; }
-msgmsg() { echo "${CMSG}$1${CNORMAL}" >&2; }
-msginfo() { echo "${CINFO}I: $1${CNORMAL}" >&2; }
-msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}" >&2; }
-msgdone() { echo "${CDONE}DONE${CNORMAL}" >&2; }
+msgmsg() { echo "${CMSG}$1${CNORMAL}"; }
+msginfo() { echo "${CINFO}I: $1${CNORMAL}"; }
+msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}"; }
+msgdone() { echo "${CDONE}DONE${CNORMAL}"; }
msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; }
-msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; }
-msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; }
-msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; }
+msgnmsg() { echo -n "${CMSG}$1${CNORMAL}"; }
+msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}"; }
+msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; }
msgtest() {
while [ -n "$1" ]; do
- echo -n "${CINFO}$1${CCMD} " >&2;
- echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2;
+ echo -n "${CINFO}$1${CCMD} "
+ echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} "
shift
if [ -n "$1" ]; then shift; else break; fi
done
- echo -n "…${CNORMAL} " >&2;
+ echo -n "…${CNORMAL} "
}
-msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
+msgpass() { echo "${CPASS}PASS${CNORMAL}"; }
msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
msgfail() {
if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2;
@@ -57,7 +63,7 @@ if [ $MSGLEVEL -le 2 ]; then
msgmsg() { true; }
msgnmsg() { true; }
msgtest() { true; }
- msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; }
+ msgpass() { echo -n " ${CPASS}P${CNORMAL}"; }
msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; }
if [ -n "$CFAIL" ]; then
msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); }
@@ -81,48 +87,54 @@ msgdone() {
[ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
true;
else
- echo "${CDONE}DONE${CNORMAL}" >&2;
+ echo "${CDONE}DONE${CNORMAL}";
fi
}
-
-runapt() {
- msgdebug "Executing: ${CCMD}$*${CDEBUG} "
+getaptconfig() {
if [ -f ./aptconfig.conf ]; then
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ echo "./aptconfig.conf"
elif [ -f ../aptconfig.conf ]; then
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
- else
- MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
- fi
+ echo "../aptconfig.conf"
+ fi
}
-aptconfig() { runapt apt-config $*; }
-aptcache() { runapt apt-cache $*; }
-aptcdrom() { runapt apt-cdrom $*; }
-aptget() { runapt apt-get $*; }
-aptftparchive() { runapt apt-ftparchive $*; }
-aptkey() { runapt apt-key $*; }
-aptmark() { runapt apt-mark $*; }
-aptwebserver() {
- LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver $*;
+runapt() {
+ msgdebug "Executing: ${CCMD}$*${CDEBUG} "
+ local CMD="$1"
+ shift
+ case $CMD in
+ sh|aptitude|*/*) ;;
+ *) CMD="${BUILDDIRECTORY}/$CMD";;
+ esac
+ MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@"
}
+aptconfig() { runapt apt-config "$@"; }
+aptcache() { runapt apt-cache "$@"; }
+aptcdrom() { runapt apt-cdrom "$@"; }
+aptget() { runapt apt-get "$@"; }
+aptftparchive() { runapt apt-ftparchive "$@"; }
+aptkey() { runapt apt-key "$@"; }
+aptmark() { runapt apt-mark "$@"; }
+apt() { runapt apt "$@"; }
+apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; }
+aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
+aptitude() { runapt aptitude "$@"; }
+
dpkg() {
- $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $*
+ command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
}
-aptitude() {
- if [ -f ./aptconfig.conf ]; then
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
- elif [ -f ../aptconfig.conf ]; then
- APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
- else
- LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
- fi
+dpkgcheckbuilddeps() {
+ command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@"
}
gdb() {
echo "gdb: run »$*«"
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1 --args $*
+ APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@"
}
-http() {
- LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http
+gpg() {
+ # see apt-key for the whole trickery. Setup is done in setupenvironment
+ command gpg --ignore-time-conflict --no-options --no-default-keyring \
+ --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
+ --no-auto-check-trustdb --trust-model always \
+ "$@"
}
exitwithstatus() {
@@ -160,7 +172,9 @@ setupenvironment() {
# allow overriding the default BUILDDIR location
BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
+ LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
+ APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
# -----
@@ -170,11 +184,12 @@ setupenvironment() {
mkdir rootdir aptarchive keys
cd rootdir
mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d
- mkdir -p var/cache var/lib var/log
+ mkdir -p var/cache var/lib/apt var/log tmp
mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
touch var/lib/dpkg/available
mkdir -p usr/lib/apt
- ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods
+ ln -s ${METHODSDIR} usr/lib/apt/methods
+ ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove
cd ..
local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
@@ -196,15 +211,34 @@ setupenvironment() {
echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
- if ! $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
+ if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then
echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
fi
echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
echo 'quiet::NoUpdate "true";' >> aptconfig.conf
echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https
- export LC_ALL=C
- export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
+ echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary
configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
+
+ # gpg needs a trustdb to function, but it can't be invalid (not even empty)
+ # see also apt-key where this trickery comes from:
+ local TRUSTDBDIR="${TMPWORKINGDIRECTORY}/gnupghome"
+ mkdir "$TRUSTDBDIR"
+ chmod 700 "$TRUSTDBDIR"
+ # We also don't use a secret keyring, of course, but gpg panics and
+ # implodes if there isn't one available - and writeable for imports
+ local SECRETKEYRING="${TRUSTDBDIR}/secring.gpg"
+ touch $SECRETKEYRING
+ # now create the trustdb with an (empty) dummy keyring
+ # newer gpg versions are fine without it, but play it safe for now
+ gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1
+
+ # cleanup the environment a bit
+ export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
+ export LC_ALL=C.UTF-8
+ unset LANGUAGE APT_CONFIG
+ unset GREP_OPTIONS DEB_BUILD_PROFILES
+
msgdone "info"
}
@@ -225,6 +259,10 @@ getarchitectures() {
echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
}
+getarchitecturesfromcommalist() {
+ echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
+}
+
configarchitecture() {
{
echo "APT::Architecture \"$(getarchitecture $1)\";"
@@ -246,7 +284,7 @@ configdpkg() {
fi
fi
rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
- if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
+ if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
local ARCHS="$(getarchitectures)"
if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
DPKGARCH="$(dpkg --print-architecture)"
@@ -288,7 +326,7 @@ setupsimplenativepackage() {
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -338,7 +376,7 @@ buildsimplenativepackage() {
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -346,6 +384,7 @@ buildsimplenativepackage() {
local SECTION="${7:-others}"
local PRIORITY="${8:-optional}"
local FILE_TREE="$9"
+ local COMPRESS_TYPE="${10:-gzip}"
local DISTSECTION
if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
DISTSECTION="main"
@@ -390,14 +429,14 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
| while read SRC; do
echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
# if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
-# gpg --yes --no-default-keyring --secret-keyring ./keys/joesixpack.sec \
+# gpg --yes --secret-keyring ./keys/joesixpack.sec \
# --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
# --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
# mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
# fi
done
- for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
+ for arch in $(getarchitecturesfromcommalist "$ARCH"); do
rm -rf ${BUILDDIR}/debian/tmp
mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
@@ -408,7 +447,14 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
(cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
(cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
- dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
+ local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
+ # ensure the right permissions as dpkg-deb ensists
+ chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
+ if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
+ cat $LOG
+ false
+ fi
+ rm $LOG
echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
done
@@ -424,14 +470,19 @@ buildpackage() {
local RELEASE=$2
local SECTION=$3
local ARCH=$(getarchitecture $4)
- msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… "
+ local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
+ local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
+ msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… "
cd $BUILDDIR
if [ "$ARCH" = "all" ]; then
ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
fi
- local BUILT="$(dpkg-buildpackage -uc -us -a$ARCH 2> /dev/null)"
- local PKGS="$( echo "$BUILT" | grep '^dpkg-deb: building package' | cut -d'/' -f 2 | sed -e "s#'\.##")"
- local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
+ if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
+ cat $BUILDLOG
+ false
+ fi
+ local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
+ local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
cd - > /dev/null
for PKG in $PKGS; do
echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
@@ -444,9 +495,9 @@ buildpackage() {
buildaptarchive() {
if [ -d incoming ]; then
- buildaptarchivefromincoming $*
+ buildaptarchivefromincoming "$@"
else
- buildaptarchivefromfiles $*
+ buildaptarchivefromfiles "$@"
fi
}
@@ -535,12 +586,12 @@ insertpackage() {
local VERSION="$4"
local DEPENDENCIES="$5"
local PRIORITY="${6:-optional}"
- local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
local ARCHS=""
- for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
+ for arch in $(getarchitecturesfromcommalist "$ARCH"); do
if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
ARCHS="$(getarchitectures)"
else
@@ -595,14 +646,14 @@ insertinstalledpackage() {
local DEPENDENCIES="$4"
local PRIORITY="${5:-optional}"
local STATUS="${6:-install ok installed}"
- local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed
+ local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
local FILE='rootdir/var/lib/dpkg/status'
local INFO='rootdir/var/lib/dpkg/info'
- for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
+ for arch in $(getarchitecturesfromcommalist "$ARCH"); do
echo "Package: $NAME
Status: $STATUS
Priority: $PRIORITY
@@ -662,7 +713,12 @@ compressfile() {
}
# can be overridden by testcases for their pleasure
-getcodenamefromsuite() { echo -n "$1"; }
+getcodenamefromsuite() {
+ case "$1" in
+ unstable) echo 'sid';;
+ *) echo -n "$1";;
+ esac
+}
getreleaseversionfromsuite() { true; }
getlabelfromsuite() { true; }
@@ -759,7 +815,7 @@ setupaptarchive() {
signreleasefiles() {
local SIGNER="${1:-Joe Sixpack}"
- local GPG="gpg --batch --yes --no-default-keyring --trustdb-name rootdir/etc/apt/trustdb.gpg"
+ local GPG="gpg --batch --yes"
msgninfo "\tSign archive with $SIGNER key… "
local REXKEY='keys/rexexpired'
local SECEXPIREBAK="${REXKEY}.sec.bak"
@@ -803,18 +859,16 @@ signreleasefiles() {
webserverconfig() {
msgtest "Set webserver config option '${1}' to" "$2"
- downloadfile "http://localhost:8080/_config/set/${1}/${2}" '/dev/null' >/dev/null
- local DOWNLOG='download-testfile.log'
- rm -f "$DOWNLOG"
- local STATUS="$(mktemp)"
- addtrap "rm $STATUS;"
- downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
- if [ "$(cat "$STATUS")" = '200' ]; then
+ local DOWNLOG='rootdir/tmp/download-testfile.log'
+ local STATUS='rootdir/tmp/webserverconfig.status'
+ rm -f "$STATUS" "$DOWNLOG"
+ if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
msgpass
else
- cat >&2 "$DOWNLOG"
- msgfail "Statuscode was $(cat "$STATUS")"
+ cat "$DOWNLOG" "$STATUS"
+ msgfail
fi
+ testwebserverlaststatuscode '200'
}
rewritesourceslist() {
@@ -830,10 +884,13 @@ changetowebserver() {
else
shift
fi
- local LOG='/dev/null'
if test -x ${APTWEBSERVERBINDIR}/aptwebserver; then
cd aptarchive
- aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1
+ local LOG="webserver.log"
+ if ! aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 ; then
+ cat $LOG
+ false
+ fi
local PID="$(cat aptwebserver.pid)"
if [ -z "$PID" ]; then
msgdie 'Could not fork aptwebserver successfully'
@@ -850,7 +907,7 @@ changetohttpswebserver() {
msgdie 'You need to install stunnel4 for https testcases'
fi
if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
- changetowebserver --no-rewrite
+ changetowebserver --no-rewrite "$@"
fi
echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
cert = ${TESTDIRECTORY}/apt.pem
@@ -869,50 +926,29 @@ connect = 8080
changetocdrom() {
mkdir -p rootdir/media/cdrom/.disk
local CD="$(readlink -f rootdir/media/cdrom)"
- echo "acquire::cdrom::mount \"${CD}\";" > rootdir/etc/apt/apt.conf.d/00cdrom
- echo 'acquire::cdrom::autodetect 0;' >> rootdir/etc/apt/apt.conf.d/00cdrom
+ echo "acquire::cdrom::mount \"${CD}\";
+acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
+acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
+acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom
echo -n "$1" > ${CD}/.disk/info
if [ ! -d aptarchive/dists ]; then
msgdie 'Flat file archive cdroms can not be created currently'
return 1
fi
- mv aptarchive/dists $CD
+ mv aptarchive/dists "$CD"
ln -s "$(readlink -f ./incoming)" $CD/pool
find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete
+ # start with an unmounted disk
+ mv "${CD}" "${CD}-unmounted"
+ # we don't want the disk to be modifiable
+ addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
+ chmod -R -w rootdir/media/cdrom-unmounted/dists
}
downloadfile() {
- PROTO="$(echo "$1" | cut -d':' -f 1)"
- local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
- rm -f "$DOWNLOG"
- touch "$DOWNLOG"
- {
- echo "601 Configuration
-Config-Item: Acquire::https::CaInfo=${TESTDIR}/apt.pem
-Config-Item: Debug::Acquire::${PROTO}=1
-
-600 Acquire URI
-URI: $1
-Filename: ${2}
-"
- # simple worker keeping stdin open until we are done (201) or error (400)
- # and requesting new URIs on try-agains/redirects inbetween
- { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
- if [ "$f1" = 'TAILPID:' ]; then
- TAILPID="$f2"
- elif [ "$f1" = 'New-URI:' ]; then
- echo "600 Acquire URI
-URI: $f2
-Filename: ${2}
-"
- elif [ "$f1" = '201' ] || [ "$f1" = '400' ]; then
- # tail would only die on next read – which never happens
- test -z "$TAILPID" || kill -s HUP "$TAILPID"
- break
- fi
- done
- } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/${PROTO} 2>&1 | tee "$DOWNLOG"
- rm "$DOWNLOG"
+ local PROTO="$(echo "$1" | cut -d':' -f 1 )"
+ apthelper -o Debug::Acquire::${PROTO}=1 \
+ download-file "$1" "$2" 2>&1 || true
# only if the file exists the download was successful
if [ -e "$2" ]; then
return 0
@@ -922,10 +958,10 @@ Filename: ${2}
}
checkdiff() {
- local DIFFTEXT="$($(which diff) -u $* | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
+ local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
if [ -n "$DIFFTEXT" ]; then
- echo
- echo "$DIFFTEXT"
+ echo >&2
+ echo >&2 "$DIFFTEXT"
return 1
else
return 0
@@ -949,29 +985,42 @@ testempty() {
}
testequal() {
- local COMPAREFILE=$(mktemp)
- addtrap "rm $COMPAREFILE;"
+ local MSG='Test of equality of'
+ if [ "$1" = '--nomsg' ]; then
+ MSG=''
+ shift
+ fi
+
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
echo "$1" > $COMPAREFILE
shift
- msgtest "Test for equality of" "$*"
+
+ if [ -n "$MSG" ]; then
+ msgtest "$MSG" "$*"
+ fi
$* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
}
testequalor2() {
- local COMPAREFILE1=$(mktemp)
- local COMPAREFILE2=$(mktemp)
- local COMPAREAGAINST=$(mktemp)
- addtrap "rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST;"
+ local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
+ local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
+ local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
echo "$1" > $COMPAREFILE1
echo "$2" > $COMPAREFILE2
shift 2
msgtest "Test for equality OR of" "$*"
$* >$COMPAREAGAINST 2>&1 || true
- (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
- checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
- ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \
- "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" &&
- msgfail )
+ if checkdiff $COMPAREFILE1 $COMPAREAGAINST >/dev/null 2>&1 || \
+ checkdiff $COMPAREFILE2 $COMPAREAGAINST >/dev/null 2>&1
+ then
+ msgpass
+ else
+ echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
+ checkdiff $COMPAREFILE1 $COMPAREAGAINST || true
+ echo -n "${CINFO}Diff against OR 2${CNORMAL}"
+ checkdiff $COMPAREFILE2 $COMPAREAGAINST || true
+ msgfail
+ fi
}
testshowvirtual() {
@@ -987,8 +1036,7 @@ N: Can't select versions from package '$1' as it is purely virtual"
msgtest "Test for virtual packages" "apt-cache show $PACKAGE"
VIRTUAL="${VIRTUAL}
N: No packages found"
- local COMPAREFILE=$(mktemp)
- addtrap "rm $COMPAREFILE;"
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
local ARCH="$(getarchitecture 'native')"
echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
@@ -996,43 +1044,42 @@ N: No packages found"
testnopackage() {
msgtest "Test for non-existent packages" "apt-cache show $*"
- local SHOWPKG="$(aptcache show $* 2>&1 | grep '^Package: ')"
+ local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
if [ -n "$SHOWPKG" ]; then
- echo
- echo "$SHOWPKG"
+ echo >&2
+ echo >&2 "$SHOWPKG"
msgfail
- return 1
+ else
+ msgpass
fi
- msgpass
}
testdpkginstalled() {
msgtest "Test for correctly installed package(s) with" "dpkg -l $*"
- local PKGS="$(dpkg -l $* 2>/dev/null | grep '^i' | wc -l)"
+ local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
if [ "$PKGS" != $# ]; then
- echo $PKGS
- dpkg -l $* | grep '^[a-z]'
+ echo >&2 $PKGS
+ dpkg -l "$@" | grep '^[a-z]' >&2
msgfail
- return 1
+ else
+ msgpass
fi
- msgpass
}
testdpkgnotinstalled() {
msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*"
- local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)"
+ local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
if [ "$PKGS" != 0 ]; then
echo
- dpkg -l $* | grep '^[a-z]'
+ dpkg -l "$@" | grep '^[a-z]' >&2
msgfail
- return 1
+ else
+ msgpass
fi
- msgpass
}
testmarkedauto() {
- local COMPAREFILE=$(mktemp)
- addtrap "rm $COMPAREFILE;"
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
if [ -n "$1" ]; then
msgtest 'Test for correctly marked as auto-installed' "$*"
while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
@@ -1049,13 +1096,12 @@ testsuccess() {
else
msgtest 'Test for successful execution of' "$*"
fi
- local OUTPUT=$(mktemp)
- addtrap "rm $OUTPUT;"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
if $@ >${OUTPUT} 2>&1; then
msgpass
else
- echo
- cat $OUTPUT
+ echo >&2
+ cat >&2 $OUTPUT
msgfail
fi
}
@@ -1064,19 +1110,39 @@ testfailure() {
if [ "$1" = '--nomsg' ]; then
shift
else
- msgtest 'Test for failure in execution of' "$*"
+ msgtest 'Test for failure in execution of' "$*"
fi
- local OUTPUT=$(mktemp)
- addtrap "rm $OUTPUT;"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
if $@ >${OUTPUT} 2>&1; then
- echo
- cat $OUTPUT
+ echo >&2
+ cat >&2 $OUTPUT
msgfail
else
msgpass
fi
}
+testwebserverlaststatuscode() {
+ local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log'
+ local STATUS='rootdir/tmp/webserverstatus-statusfile.log'
+ rm -f "$DOWNLOG" "$STATUS"
+ msgtest 'Test last status code from the webserver was' "$1"
+ downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
+ if [ "$(cat "$STATUS")" = "$1" ]; then
+ msgpass
+ else
+ echo >&2
+ if [ -n "$2" ]; then
+ shift
+ echo >&2 '#### Additionally provided output files contain:'
+ cat >&2 "$@"
+ fi
+ echo >&2 '#### Download log of the status code:'
+ cat >&2 "$DOWNLOG"
+ msgfail "Status was $(cat "$STATUS")"
+ fi
+}
+
pause() {
echo "STOPPED execution. Press enter to continue"
local IGNORE
diff --git a/test/integration/run-tests b/test/integration/run-tests
index 7316016e2..79d5d1a29 100755
--- a/test/integration/run-tests
+++ b/test/integration/run-tests
@@ -2,24 +2,38 @@
set -e
FAIL=0
+PASS=0
+ALL=0
+
FAILED_TESTS=""
DIR=$(readlink -f $(dirname $0))
-if [ "$1" = "-q" ]; then
- export MSGLEVEL=2
-elif [ "$1" = "-v" ]; then
- export MSGLEVEL=4
-fi
+while [ -n "$1" ]; do
+ if [ "$1" = "-q" ]; then
+ export MSGLEVEL=2
+ elif [ "$1" = "-v" ]; then
+ export MSGLEVEL=4
+ elif [ "$1" = '--color=no' ]; then
+ export MSGCOLOR='NO'
+ else
+ echo >&2 "WARNING: Unknown parameter »$1« will be ignored"
+ fi
+ shift
+done
+export MSGLEVEL="${MSGLEVEL:-3}"
-if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+if [ "$MSGCOLOR" != 'NO' ]; then
+ if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
+ export MSGCOLOR='NO'
+ fi
+fi
+if [ "$MSGCOLOR" != 'NO' ]; then
CTEST='\033[1;32m'
CHIGH='\033[1;35m'
CRESET='\033[0m'
-elif [ -z "${MSGLEVEL}" ]; then
- export MSGLEVEL=2
-fi
-
-if [ -z "$MSGLEVEL" ]; then
- MSGLEVEL=5
+else
+ CTEST=''
+ CHIGH=''
+ CRESET=''
fi
for testcase in $(run-parts --list $DIR | grep '/test-'); do
@@ -29,18 +43,23 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do
echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
fi
if ! ${testcase}; then
- FAIL=$((FAIL+1))
- FAILED_TESTS="$FAILED_TESTS $(basename $testcase)"
- echo "$(basename $testcase) ... FAIL"
- fi
+ FAIL=$((FAIL+1))
+ FAILED_TESTS="$FAILED_TESTS $(basename $testcase)"
+ echo >&2 "$(basename $testcase) ... FAIL"
+ else
+ PASS=$((PASS+1))
+ fi
+ ALL=$((ALL+1))
if [ "$MSGLEVEL" -le 2 ]; then
echo
fi
done
-echo "failures: $FAIL"
-if [ -n "$FAILED_TESTS" ]; then
- echo "Failed tests: $FAILED_TESTS";
+echo >&2 "Statistics: $ALL tests were run: $PASS successfully and $FAIL failed"
+if [ -n "$FAILED_TESTS" ]; then
+ echo >&2 "Failed tests: $FAILED_TESTS"
+else
+ echo >&2 'All tests seem to have been run successfully. What could possibly go wrong?'
fi
# ensure we don't overflow
exit $((FAIL <= 255 ? FAIL : 255))
diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types
new file mode 100755
index 000000000..a5c98f3d6
--- /dev/null
+++ b/test/integration/test-allow-scores-for-all-dependency-types
@@ -0,0 +1,144 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unversioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev'
+insertpackage 'unversioned' 'libdb5.1-dev' 'amd64' '5.1.29-7'
+insertpackage 'unversioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev'
+
+insertpackage 'unversioned' 'foo' 'amd64' '1'
+insertpackage 'unversioned' 'bar' 'amd64' '1'
+insertpackage 'unversioned' 'foo' 'amd64' '2' 'Conflicts: bar'
+insertpackage 'unversioned' 'bar' 'amd64' '2' 'Conflicts: foo'
+insertpackage 'unversioned' 'baz' 'amd64' '2' 'Depends: bar | foo'
+
+insertpackage 'versioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev
+Conflicts: libdb5.1-dev (<< 5.2)'
+insertpackage 'versioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev (<< 5.2)'
+
+insertpackage 'versioned' 'foo' 'amd64' '2' 'Conflicts: bar (<= 2)'
+insertpackage 'versioned' 'bar' 'amd64' '2' 'Conflicts: foo (<= 2)'
+insertpackage 'versioned' 'baz' 'amd64' '2' 'Depends: bar (>= 2) | foo (>= 2)'
+
+insertpackage 'multipleno' 'foo' 'amd64' '2.1' 'Conflicts: bar (<= 3)'
+insertpackage 'multipleno' 'bar' 'amd64' '2.1' 'Conflicts: foo (<= 3), foo (<= 1)'
+
+insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)'
+# having foo multiple times as conflict is a non-advisable hack in general
+insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)'
+
+cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup
+setupaptarchive
+
+insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
+insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 unversioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 unversioned [amd64])
+Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libdb5.1-dev
+The following NEW packages will be installed:
+ libdb5.3-dev
+The following packages will be upgraded:
+ libdb-dev
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ]
+Inst libdb-dev [5.1.7] (5.3.0 versioned [amd64]) []
+Inst libdb5.3-dev (5.3.28-3 versioned [amd64])
+Conf libdb5.3-dev (5.3.28-3 versioned [amd64])
+Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned
+
+cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
+insertinstalledpackage 'foo' 'amd64' '1'
+insertinstalledpackage 'bar' 'amd64' '1'
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages have been kept back:
+ bar foo
+0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ foo
+The following packages will be upgraded:
+ bar
+1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv foo [1]
+Inst bar [1] (2.2 multipleyes [amd64])
+Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ baz
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst baz (2 unversioned [amd64])
+Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ foo
+The following packages will be REMOVED:
+ bar
+The following NEW packages will be installed:
+ baz
+The following packages will be upgraded:
+ foo
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv bar [1]
+Inst foo [1] (2 versioned [amd64])
+Inst baz (2 versioned [amd64])
+Conf foo (2 versioned [amd64])
+Conf baz (2 versioned [amd64])' aptget install baz -st versioned
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ baz
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst baz (2 unversioned [amd64])
+Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ foo
+The following packages will be REMOVED:
+ bar
+The following NEW packages will be installed:
+ baz
+The following packages will be upgraded:
+ foo
+1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv bar [1]
+Inst foo [1] (2 versioned [amd64])
+Inst baz (2 versioned [amd64])
+Conf foo (2 versioned [amd64])
+Conf baz (2 versioned [amd64])' aptget install baz -st versioned
diff --git a/test/integration/test-apt-bug-718329-support-data.tar b/test/integration/test-apt-bug-718329-support-data.tar
new file mode 100755
index 000000000..5cfb31917
--- /dev/null
+++ b/test/integration/test-apt-bug-718329-support-data.tar
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+test_process_package_with_compression() {
+ COMPRESSOR="$1"
+ DATA_TAR="$2"
+
+ msgtest "Testing apt-ftparchive with compression type: $COMPRESSOR"
+
+ buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR"
+ testequal "debian-binary
+control.tar.gz
+$DATA_TAR" ar t incoming/pkg_1.0_all.deb
+
+ testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)"
+
+ testequal "usr/bin/pkg-all pkg
+usr/share/doc/pkg/FEATURES pkg
+usr/share/doc/pkg/changelog pkg
+usr/share/doc/pkg/copyright pkg" aptftparchive contents incoming/
+
+ rm -rf incoming/*
+}
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+test_process_package_with_compression "gzip" "data.tar.gz"
+test_process_package_with_compression "none" "data.tar"
+test_process_package_with_compression "xz" "data.tar.xz"
+
+
+
diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom
index cc3483f9b..8d8fdf167 100755
--- a/test/integration/test-apt-cdrom
+++ b/test/integration/test-apt-cdrom
@@ -12,31 +12,60 @@ setupaptarchive --no-update
changetocdrom 'Debian APT Testdisk 0.8.15'
# -de is not in the Release file, but picked up anyway for compatibility
-cd rootdir/media/cdrom/dists/stable/main/i18n
+cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n
+chmod +w .
sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de
echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable
Diese Pakete sind nur für das testen von APT gedacht,
sie erfüllen keinen Zweck auf einem normalen System…
' >> Translation-de
compressfile Translation-de
-rm Translation-en Translation-de
+rm -f Translation-en Translation-de
+chmod -R -w .
cd - > /dev/null
-addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;"
-chmod -R -w rootdir/media/cdrom/dists
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
-Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
-Found label 'Debian APT Testdisk 0.8.15'
-This disc is called:
+aptcdromlog() {
+ rm -f rootdir/tmp/apt-cdrom.log
+ test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
+ test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
+ aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null
+ sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log
+ test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
+ test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
+}
+
+CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
+Unmounting CD-ROM...
+Waiting for disc...
+Please insert a Disc in the drive and press enter
+Mounting CD-ROM...
+Scanning disc for index files..."
+CDROM_POST="This disc is called:
'Debian APT Testdisk 0.8.15'
Writing new source list
Source list entries for this disc are:
deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
+Unmounting CD-ROM...
Repeat this process for the rest of the CDs in your set."
+testequal "$CDROM_PRE
+Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
+Found label 'Debian APT Testdisk 0.8.15'
+$CDROM_POST" aptcdromlog add
+
+testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
+Mounting CD-ROM...
+Stored label: Debian APT Testdisk 0.8.15
+Unmounting CD-ROM..." aptcdromlog ident
+
+# apt-setup uses these commands (expect the tr in the id) to find id and label
+ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
+CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
+CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
+testequal "CD::${CD_ID} \"${CD_LABEL}\";
+CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
+
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
@@ -54,49 +83,24 @@ Inst testing:i386 (0.8.15 stable [i386])
Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
# check Idempotence of apt-cdrom (and disabling of Translation dropping)
-aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
# take Translations from previous runs as needed
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$CDROM_POST" aptcdromlog add
msgtest 'Test for the german description translation of' 'testing'
aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
rm -rf rootdir/var/lib/apt/lists
mkdir -p rootdir/var/lib/apt/lists/partial
-aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1
-sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log
-testfileequal apt-cdrom.log "Scanning disc for index files..
+testequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
-This disc is called:
-'Debian APT Testdisk 0.8.15'
-Writing new source list
-Source list entries for this disc are:
-deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
-Repeat this process for the rest of the CDs in your set."
+$CDROM_POST" aptcdromlog add
msgtest 'Test for the english description translation of' 'testing'
aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail
-
# check that we really can install from a 'cdrom'
testdpkgnotinstalled testing
testsuccess aptget install testing -y
diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list
new file mode 100755
index 000000000..47cfb624a
--- /dev/null
+++ b/test/integration/test-apt-cli-list
@@ -0,0 +1,53 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+if [ ! -x ${BUILDDIRECTORY}/apt ]; then
+ msgmsg "No ${BUILDDIRECTORY}/apt"
+ msgskip
+ exit 0
+fi
+
+insertpackage 'unstable' 'foo' 'all' '1.0'
+insertinstalledpackage 'bar' 'i386' '1.0'
+
+insertinstalledpackage 'foobar' 'i386' '1.0'
+insertpackage 'unstable' 'foobar' 'i386' '2.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+testequal "Listing...
+bar/now 1.0 i386 [installed,local]
+foo/unstable 1.0 all
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
+
+testequal "Listing...
+foo/unstable 1.0 all
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
+
+testequal "Listing...
+foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
+
+# FIXME: hm, hm - does it make sense to have this different? shouldn't
+# we use "installed,upgradable" consitently?
+testequal "Listing...
+bar/now 1.0 i386 [installed,local]
+foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
+
+testequal "Listing...
+foobar/unstable 2.0 i386 [upgradable from: 1.0]
+foobar/now 1.0 i386 [installed,upgradable to: 2.0]
+" apt list foobar --all-versions
+
+testequal "Listing...
+bar/now 1.0 i386 [installed,local]
+ an autogenerated dummy bar=1.0/installed
+" apt list bar --verbose
+
diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search
new file mode 100755
index 000000000..84650b366
--- /dev/null
+++ b/test/integration/test-apt-cli-search
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+if [ ! -x ${BUILDDIRECTORY}/apt ]; then
+ msgmsg "No ${BUILDDIRECTORY}/apt"
+ msgskip
+ exit 0
+fi
+
+DESCR='Some description that has a unusual word xxyyzz and aabbcc'
+DESCR2='Some other description with the unusual aabbcc only'
+insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# with OP progress
+testequal "Sorting...
+Full Text Search...
+foo/unstable 1.0 all
+ $DESCR
+" apt search xxyyzz
+
+# without op progress
+testequal "foo/unstable 1.0 all
+ $DESCR
+" apt search -qq xxyyzz
+
+# search with multiple words is a AND search
+testequal "foo/unstable 1.0 all
+ $DESCR
+" apt search -qq aabbcc xxyyzz
+
+# output is sorted and search word finds both package
+testequal "bar/testing 2.0 i386
+ $DESCR2
+
+foo/unstable 1.0 all
+ $DESCR
+" apt search -qq aabbcc
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
new file mode 100755
index 000000000..4c8e134d6
--- /dev/null
+++ b/test/integration/test-apt-cli-show
@@ -0,0 +1,38 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+if [ ! -x ${BUILDDIRECTORY}/apt ]; then
+ msgmsg "No ${BUILDDIRECTORY}/apt"
+ msgskip
+ exit 0
+fi
+
+DESCR='Some description
+ That has multiple lines'
+insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+insertinstalledpackage 'foo' 'all' '1.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# note that we do not display Description-md5 with the "apt" cmd
+# and also show some additional fields that are calculated
+testequal "Package: foo
+Priority: optional
+Section: other
+Installed-Size: 43.0 kB
+Maintainer: Joe Sixpack <joe@example.org>
+Version: 1.0
+Download-Size: unknown
+APT-Manual-Installed: yes
+APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages
+Description: Some description
+ That has multiple lines
+" apt show foo
diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade
new file mode 100755
index 000000000..b6ee2270b
--- /dev/null
+++ b/test/integration/test-apt-cli-upgrade
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+if [ ! -x ${BUILDDIRECTORY}/apt ]; then
+ msgmsg "No ${BUILDDIRECTORY}/apt"
+ msgskip
+ exit 0
+fi
+
+
+insertpackage 'unstable' 'foo' 'all' '2.0' 'Depends: foo-new-dependency'
+insertpackage 'unstable' 'foo-new-dependency' 'all' '2.0'
+insertinstalledpackage 'foo' 'all' '1.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# default is to allow new dependencies
+testequal "The following NEW packages will be installed:
+ foo-new-dependency
+The following packages will be upgraded:
+ foo
+1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo-new-dependency (2.0 unstable [all])
+Inst foo [1.0] (2.0 unstable [all])
+Conf foo-new-dependency (2.0 unstable [all])
+Conf foo (2.0 unstable [all])" apt upgrade -qq -s
+
+# ensure
+testequal "The following packages have been kept back:
+ foo
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove
index 68ea1c574..acde4b096 100755
--- a/test/integration/test-apt-get-autoremove
+++ b/test/integration/test-apt-get-autoremove
@@ -42,12 +42,12 @@ testsuccess aptget autoremove -y
testdpkgnotinstalled 'po-debconf'
testmarkedauto
-sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
-testfileequal 'rootdir/var/log/apt/history.log' '
-Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, automatic)
-
+sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e 's#), #)\nInstall: #g' | sort -u > apt-history.log
+testfileequal 'apt-history.log' '
+Install: debhelper:i386 (8.0.0)
+Install: po-debconf:i386 (1.0.16, automatic)
+Install: unrelated:i386 (1)
Remove: debhelper:i386 (8.0.0)
-
Remove: po-debconf:i386 (1.0.16)'
testsuccess aptget install debhelper -y
diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog
index d013cc458..a73c3e249 100755
--- a/test/integration/test-apt-get-changelog
+++ b/test/integration/test-apt-get-changelog
@@ -9,11 +9,11 @@ configarchitecture "i386"
buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
-setupaptarchive
+setupaptarchive --no-update
changetowebserver
-aptget update -qq
+testsuccess aptget update
-echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf
+echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf
testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris
@@ -24,7 +24,7 @@ aptget changelog apt -qq > apt.changelog
testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)"
rm apt.changelog
-aptget changelog apt -d -qq
+testsuccess aptget changelog apt -d
testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)"
rm apt.changelog aptarchive/pool/apt_1.0/changelog
@@ -32,7 +32,7 @@ aptget changelog apt -qq -o APT::Changelogs::Server='http://not-on-the-main-serv
testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)"
rm apt.changelog
-aptget changelog apt -d -qq
+testsuccess aptget changelog apt -d
testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0.changelog)"
rm apt.changelog aptarchive/pool/apt_1.0.changelog
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index 6eac079f3..be3144e1f 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -19,10 +19,12 @@ testdownload() {
APT="${APT}/${3}"
fi
msgtest "Test download of package file $1 with" "$APT"
- aptget -qq download ${APT} && test -f $1 && msgpass || msgfail
+ testsuccess --nomsg aptget download ${APT}
+ testsuccess test -f $1
rm $1
}
+# normal case(es)
testdownload apt_1.0_all.deb apt stable
testdownload apt_2.0_all.deb apt
@@ -31,3 +33,15 @@ testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sh
# deb:677887
testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
+
+# deb:736962
+testsuccess aptget download apt
+testsuccess aptget download apt
+testsuccess test -s apt_2.0_all.deb
+
+rm -f apt_1.0_all.deb apt_2.0_all.deb
+
+# deb:738103
+testsuccess aptget download apt apt apt/unstable apt=2.0
+testsuccess test -s apt_2.0_all.deb
+
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source
index 3ee7a9e23..33bd980d0 100755
--- a/test/integration/test-apt-get-source
+++ b/test/integration/test-apt-get-source
@@ -39,12 +39,24 @@ Need to get 0 B of source archives.
'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo
-# select by release
+# select by release: suite
testequal "$HEADER
Selected version '1.0' (stable) for foo
Need to get 0 B of source archives.
'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/stable
+testequal "$HEADER
+Selected version '2.0' (unstable) for foo
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/unstable
+
+# select by release: codename
+testequal "$HEADER
+Selected version '2.0' (sid) for foo
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/sid
# select by version
testequal "$HEADER
@@ -53,7 +65,7 @@ Need to get 0 B of source archives.
'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo=1.0
# select by release with no binary package (Bug#731102) but ensure to get
-# higest version
+# highest version
testequal "$HEADER
Selected version '0.1' (wheezy) for foo
Need to get 0 B of source archives.
diff --git a/test/integration/test-apt-get-source-multisources b/test/integration/test-apt-get-source-multisources
new file mode 100755
index 000000000..cc759e8c1
--- /dev/null
+++ b/test/integration/test-apt-get-source-multisources
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'armhf'
+
+insertsource 'unstable' 'adduser' 'all' '3.113+nmu3'
+insertsource 'stable' 'python-fll' 'all' '0.9.11'
+
+insertpackage 'unstable' 'adduser' 'all' '3.113+nmu3'
+insertpackage 'stable' 'python-fll' 'all' '0.9.11'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+HEADER="Reading package lists...
+Building dependency tree..."
+testequal "$HEADER
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11
+
+testequal "$HEADER
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113
diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper
new file mode 100755
index 000000000..6505b5956
--- /dev/null
+++ b/test/integration/test-apt-helper
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+changetohttpswebserver
+
+echo "foo" > aptarchive/foo
+
+msgtest 'apt-file download-file md5sum'
+apthelper -qq download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail
+testfileequal foo2 'foo'
+
+msgtest 'apt-file download-file sha1'
+apthelper -qq download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail
+testfileequal foo1 'foo'
+
+msgtest 'apt-file download-file sha256'
+apthelper -qq download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail
+testfileequal foo3 'foo'
+
+msgtest 'apt-file download-file no-hash'
+apthelper -qq download-file http://localhost:8080/foo foo4 && msgpass || msgfail
+testfileequal foo4 'foo'
+
+msgtest 'apt-file download-file wrong hash'
+if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then
+ msgpass
+else
+ msgfail
+fi
+testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch
+
+E: Download Failed'
+testfileequal foo5.FAILED 'foo'
diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect
new file mode 100755
index 000000000..73352a28c
--- /dev/null
+++ b/test/integration/test-apt-https-no-redirect
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'stable' 'apt' 'all' '1'
+setupaptarchive --no-update
+
+echo 'alright' > aptarchive/working
+changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
+
+msgtest 'download of a file works via' 'http'
+downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail
+testfileequal httpfile 'alright'
+
+msgtest 'download of a file works via' 'https'
+downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail
+testfileequal httpsfile 'alright'
+
+msgtest 'download of a file does not work if' 'https redirected to http'
+downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass
+
+msgtest 'libcurl has forbidden access in last request to' 'http resource'
+grep -q -- 'Protocol http not supported or disabled in libcurl' curloutput && msgpass || msgfail
+
+
diff --git a/test/integration/test-apt-progress-fd-conffile b/test/integration/test-apt-progress-fd-conffile
index 0b42b1b2f..085d5e871 100755
--- a/test/integration/test-apt-progress-fd-conffile
+++ b/test/integration/test-apt-progress-fd-conffile
@@ -32,12 +32,19 @@ testsuccess aptget install compiz-core=1.0
# fake conffile change
echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
-# install
+# FIXME: Is there really no way to see if dpkg actually prompts?
+msgtest 'Test for successful execution of' 'apt-get install compiz-core=2.0'
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
exec 3> apt-progress.log
-echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false
+if aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false -o dpkg::options::='--force-confold' >${OUTPUT} 2>&1; then
+ msgpass
+else
+ echo
+ cat $OUTPUT
+ msgfail
+fi
# and ensure there is a conffile message in the file
-msgtest "Conffile prompt in apt-progress.log"
+msgtest 'Test status fd for an included' 'pmconffile msg'
grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
-
-cat apt-progress.log \ No newline at end of file
diff --git a/test/integration/test-apt-progress-fd-error-postinst b/test/integration/test-apt-progress-fd-error-postinst
deleted file mode 100755
index 0b6e70212..000000000
--- a/test/integration/test-apt-progress-fd-error-postinst
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-
-setupenvironment
-configarchitecture 'amd64' 'i386'
-
-mkdir -p DEBIAN/
-echo "#!/bin/sh\nexit 1" > DEBIAN/postinst
-chmod 755 DEBIAN/postinst
-
-buildsimplenativepackage 'postinst-error' 'amd64,i386' '0.8.15' 'stable' '' 'pkg with posinst error' '' '' './DEBIAN'
-
-setupaptarchive
-
-exec 3> apt-progress.log
-testfailure aptget install postinst-error -y -o APT::Status-Fd=3
-msgtest "Ensure correct error message for postinst error"
-grep -q "pmerror:postinst-error :80:subprocess installed post-installation script returned error exit status 2" apt-progress.log && msgpass || msgfail
-
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
new file mode 100755
index 000000000..5f54b7531
--- /dev/null
+++ b/test/integration/test-apt-sources-deb822
@@ -0,0 +1,112 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'i386'
+
+echo 'APT::Sources::Use-Deb822 "true";' > rootdir/etc/apt/apt.conf.d/00enabledeb822
+
+SOURCES='rootdir/etc/apt/sources.list'
+BASE='# some comment
+# that contains a : as well
+#Types: meep
+
+Types: deb
+URIs: http://ftp.debian.org/debian
+Suites: stable
+Sections: main
+Description: summay
+ and the long part'
+
+msgtest 'Test sources.list' 'old style'
+echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+msgtest 'Test sources.list' 'simple deb822'
+echo "$BASE" > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+
+msgtest 'Test deb822 with' 'two entries'
+# Two entries
+echo "$BASE" > $SOURCES
+echo "" >> $SOURCES
+echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
+
+# two suite entries
+msgtest 'Test deb822 with' 'two Suite entries'
+echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
+
+msgtest 'Test deb822' 'architecture option'
+echo "$BASE" > $SOURCES
+echo "Architectures: amd64 armel" >> $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+
+msgtest 'Test old-style sources.list file which has' 'malformed dist'
+echo "deb http://ftp.debian.org" > $SOURCES
+testequal --nomsg "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
+E: The list of sources could not be read." aptget update --print-uris
+
+msgtest 'Test deb822 sources.list file which has' 'malformed URI'
+echo "Types: deb
+Suites: stable
+" > $SOURCES
+testequal --nomsg "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
+E: The list of sources could not be read." aptget update --print-uris
+
+# with Enabled: false
+echo "$BASE" > $SOURCES
+echo "Enabled: no" >> $SOURCES
+testempty aptget update --print-uris
+
+# multiple URIs
+msgtest 'Test deb822 sources.list file which has' 'Multiple URIs work'
+echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
+testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+# multiple Type in one field
+msgtest 'Test deb822 sources.list file which has' 'Multiple Types work'
+echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0 :
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 :
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+
+# a Suite
+msgtest 'Test deb822 sources.list file which has' 'a exact path and no sections'
+cat > $SOURCES <<EOF
+Types: deb
+URIs: http://emacs.naquadah.org
+Suites: stable/
+EOF
+testequal --nomsg "'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0 :
+'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0 :
+'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 " aptget update --print-uris
diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing
index 2741509a7..a43354871 100755
--- a/test/integration/test-architecture-specification-parsing
+++ b/test/integration/test-architecture-specification-parsing
@@ -4,102 +4,106 @@ set -e
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture 'amd64' 'armel'
-buildsimplenativepackage 'pkg-arch-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !amd64]
-Depends: foo [amd64 !amd64]'
-buildsimplenativepackage 'pkg-arch-no-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!amd64 amd64]
-Depends: foo [!amd64 amd64]'
-buildsimplenativepackage 'pkg-arch-foo-unrelated-no' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!kfreebsd-any amd64]
-Depends: foo [!kfreebsd-any amd64]'
-buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !kfreebsd-any]
-Depends: foo [amd64 !kfreebsd-any]'
-buildsimplenativepackage 'no-depends' 'armel' '1.0' 'stable' 'Build-Depends: foo [armhf], bar [arm]
-Depends: foo [armhf], bar [arm]'
+# we need this construct here as it isn't really possible to fake native arch for dpkg-* tools
+NATIVE="$(command dpkg --print-architecture)"
+configarchitecture "${NATIVE}" 'armel'
+
+buildsimplenativepackage 'pkg-arch-foo' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [${NATIVE} !${NATIVE}]
+Depends: foo [${NATIVE} !${NATIVE}]"
+buildsimplenativepackage 'pkg-arch-no-foo' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [!${NATIVE} ${NATIVE}]
+Depends: foo [!${NATIVE} ${NATIVE}]"
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [!kfreebsd-any ${NATIVE}]
+Depends: foo [!kfreebsd-any ${NATIVE}]"
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' "$NATIVE" '1.0' 'stable' "Build-Depends: foo [${NATIVE} !kfreebsd-any]
+Depends: foo [${NATIVE} !kfreebsd-any]"
+buildsimplenativepackage 'no-depends' 'armel' '1.0' 'stable' 'Build-Depends: foo [armeb], bar [arm]
+Depends: foo [armeb], bar [arm]'
-buildsimplenativepackage 'foo' 'amd64' '1.0' 'stable'
+buildsimplenativepackage 'foo' "$NATIVE" '1.0' 'stable'
insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign'
setupaptarchive
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
The following NEW packages will be installed:
foo pkg-arch-foo
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Inst pkg-arch-foo (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])
-Conf pkg-arch-foo (1.0 stable [amd64])' aptget install pkg-arch-foo -s
+Inst foo (1.0 stable [${NATIVE}])
+Inst pkg-arch-foo (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])
+Conf pkg-arch-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
pkg-arch-no-foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst pkg-arch-no-foo (1.0 stable [amd64])
-Conf pkg-arch-no-foo (1.0 stable [amd64])' aptget install pkg-arch-no-foo -s
+Inst pkg-arch-no-foo (1.0 stable [${NATIVE}])
+Conf pkg-arch-no-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-no-foo -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
The following NEW packages will be installed:
foo pkg-arch-foo-unrelated-no
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Inst pkg-arch-foo-unrelated-no (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])
-Conf pkg-arch-foo-unrelated-no (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no -s
+Inst foo (1.0 stable [${NATIVE}])
+Inst pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])
+Conf pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
The following NEW packages will be installed:
foo pkg-arch-foo-unrelated-no2
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Inst pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])
-Conf pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no2 -s
+Inst foo (1.0 stable [${NATIVE}])
+Inst pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])
+Conf pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no2 -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo -s
+Inst foo (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo -s
testequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no -s
+Inst foo (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no -s
-testequal 'Reading package lists...
+testequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
-Inst foo (1.0 stable [amd64])
-Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no2 -s
+Inst foo (1.0 stable [${NATIVE}])
+Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no2 -s
testequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep no-depends -s
# this is not really testing APT - more that dpkg is in line with us
+configarchitecture 'amd64' 'armel'
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect
index bcebb57b8..6393f0c27 100755
--- a/test/integration/test-bug-602412-dequote-redirect
+++ b/test/integration/test-bug-602412-dequote-redirect
@@ -15,15 +15,24 @@ changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
mv aptarchive/pool aptarchive/newpool
mv aptarchive/dists aptarchive/newdists
-msgtest 'Test redirection works in' 'apt-get update'
-testsuccess --nomsg aptget update
-
-# check that I-M-S header is kept in redirections
-testequal 'Hit http://localhost:8080 unstable InRelease
-Hit http://localhost:8080 unstable/main Sources
-Hit http://localhost:8080 unstable/main amd64 Packages
-Hit http://localhost:8080 unstable/main Translation-en
-Reading package lists...' aptget update #-o debug::pkgacquire=1 -o debug::pkgacquire::worker=1
-
-msgtest 'Test redirection works in' 'package download'
-testsuccess --nomsg aptget install unrelated --download-only -y
+testrun() {
+ msgtest 'Test redirection works in' 'apt-get update'
+ testsuccess --nomsg aptget update
+
+ # check that I-M-S header is kept in redirections
+ testequal "Hit $1 unstable InRelease
+Hit $1 unstable/main Sources
+Hit $1 unstable/main amd64 Packages
+Hit $1 unstable/main Translation-en
+Reading package lists..." aptget update
+
+ msgtest 'Test redirection works in' 'package download'
+ testsuccess --nomsg aptget install unrelated --download-only -y
+}
+
+testrun 'http://localhost:8080'
+
+rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
+changetohttpswebserver
+
+testrun 'https://localhost:4433'
diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config
index 4d1f00ca0..7bf5781e8 100755
--- a/test/integration/test-bug-612958-use-dpkg-multiarch-config
+++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config
@@ -43,6 +43,15 @@ testpass 'apt config' 'armel'
rm $CONFFILE
echo '#clear APT::Architectures;' >> $CONFFILE
+echo 'APT::Architectures "i386,amd64";' >> $CONFFILE
+
+testpass 'apt config' 'i386'
+testpass 'apt config' 'amd64'
+testfail 'apt config' 'armel'
+
+rm $CONFFILE
+
+echo '#clear APT::Architectures;' >> $CONFFILE
echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE
echo '#! /bin/sh
diff --git a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
index 633c197c0..f93510fd7 100755
--- a/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
+++ b/test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
@@ -11,7 +11,7 @@ buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
setupaptarchive --no-update
testfileexists() {
- msgtest 'Test for existance of file' "$1"
+ msgtest 'Test for existence of file' "$1"
test -e "$1" && msgpass || msgfail
rm -f "$1"
}
diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support
new file mode 100755
index 000000000..ae1403f71
--- /dev/null
+++ b/test/integration/test-bug-661537-build-profiles-support
@@ -0,0 +1,147 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386' 'armel'
+
+insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign'
+
+insertpackage 'unstable' 'foo' 'all' '1.0'
+insertpackage 'unstable' 'bar' 'all' '1.0'
+
+insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] <!profile.stage1 !profile.cross>, bar'
+
+# table from https://wiki.debian.org/BuildProfileSpec
+insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!profile.stage1>'
+insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <profile.stage1>'
+insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!profile.stage1 !profile.notest>'
+insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <profile.stage1 profile.notest>'
+insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!profile.stage1 profile.notest>'
+insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <profile.stage1 !profile.notest>'
+# multiple stanzas not supported: error out
+insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <profile.stage1><!profile.notest>'
+insertsource 'unstable' 'spec-8' 'any' '1' 'Build-Depends: foo <profile.stage1> <!profile.notest>'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar foo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Inst foo (1.0 unstable [all])
+Conf bar (1.0 unstable [all])
+Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ bar
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst bar (1.0 unstable [all])
+Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1
+
+KEEP='Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 unstable [all])
+Conf foo (1.0 unstable [all])'
+DROP='Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.'
+
+msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support'
+if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.2'; then
+ msgpass
+ testwithdpkg() {
+ msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output"
+ if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then
+ if [ "$3" = "$DROP" ]; then
+ msgpass
+ else
+ cat $OUTPUT
+ msgfail
+ fi
+ else
+ if [ "$3" = "$KEEP" ]; then
+ msgpass
+ else
+ cat $OUTPUT
+ msgfail
+ fi
+ fi
+ }
+else
+ msgskip
+ testwithdpkg() {
+ msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'"
+ msgskip
+ }
+fi
+
+testprofile() {
+ if [ -n "$3" ]; then
+ testequal "$4" aptget build-dep "$1" -s -P "$3"
+ export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')"
+ testequal "$4" aptget build-dep "$1" -s -o with::environment=1
+ unset DEB_BUILD_PROFILES
+ else
+ testequal "$4" aptget build-dep "$1" -s
+ fi
+ testwithdpkg "$2" "$3" "$4"
+}
+
+testprofile 'spec-1' 'foo <!profile.stage1>' '' "$KEEP"
+testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1' "$DROP"
+testprofile 'spec-1' 'foo <!profile.stage1>' 'notest' "$KEEP"
+testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1,notest' "$DROP"
+
+testprofile 'spec-2' 'foo <profile.stage1>' '' "$DROP"
+testprofile 'spec-2' 'foo <profile.stage1>' 'stage1' "$KEEP"
+testprofile 'spec-2' 'foo <profile.stage1>' 'notest' "$DROP"
+testprofile 'spec-2' 'foo <profile.stage1>' 'stage1,notest' "$KEEP"
+
+testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' '' "$KEEP"
+testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1' "$DROP"
+testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'notest' "$DROP"
+testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1,notest' "$DROP"
+
+testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' '' "$DROP"
+testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1' "$KEEP"
+testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'notest' "$KEEP"
+testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1,notest' "$KEEP"
+
+testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' '' "$KEEP"
+testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1' "$DROP"
+testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'notest' "$KEEP"
+testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1,notest' "$DROP"
+
+testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' '' "$KEEP"
+testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1' "$KEEP"
+testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'notest' "$DROP"
+testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1,notest' "$KEEP"
+
+testfailure aptget build-dep spec-7 -s
+testfailure aptget build-dep spec-8 -s
diff --git a/test/integration/test-bug-723705-tagfile-truncates-fields b/test/integration/test-bug-723705-tagfile-truncates-fields
index 3180e7fc9..29f98550c 100755
--- a/test/integration/test-bug-723705-tagfile-truncates-fields
+++ b/test/integration/test-bug-723705-tagfile-truncates-fields
@@ -8,7 +8,7 @@ configarchitecture 'amd64'
setupaptarchive
-aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed 's#file:///tmp/tmp.[^/]\+#file:///tmp#g' > filename.log
+aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed "s#file://${TMPWORKINGDIRECTORY}#file:///tmp#g" > filename.log
testfileequal filename.log "Reading package lists...
Building dependency tree...
diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir
index 0606538a1..0451fc1ed 100755
--- a/test/integration/test-bug-728500-tempdir
+++ b/test/integration/test-bug-728500-tempdir
@@ -7,12 +7,23 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'i386'
-buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+insertpackage 'unstable' 'coolstuff' 'all' '1.0'
setupaptarchive
changetowebserver
-msgtest 'Test with incorect TMPDIR'
+msgtest 'Test apt-get update with incorrect' 'TMPDIR'
+
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
export TMPDIR=/does-not-exists
-aptget update && msgpass || msgfail
-unset TMPDIR \ No newline at end of file
+if aptget update >${OUTPUT} 2>&1; then
+ msgpass
+else
+ echo
+ cat $OUTPUT
+ msgfail
+fi
+unset TMPDIR
+
+testequal 'coolstuff' aptcache pkgnames
diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable
new file mode 100755
index 000000000..e9f3bf96d
--- /dev/null
+++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable
@@ -0,0 +1,89 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'i386' 'amd64'
+
+insertpackage 'unstable' 'lib32nss-mdns' 'amd64' '0.10-6' 'Depends: libnss-mdns-i386 (= 0.10-6)'
+insertpackage 'unstable' 'libnss-mdns' 'amd64,i386' '0.10-6' 'Multi-Arch: same
+Breaks: lib32nss-mdns (<< 0.10-6)'
+insertpackage 'unstable' 'libnss-mdns-i386' 'i386' '0.10-6' 'Multi-Arch: foreign
+Depends: libnss-mdns'
+# introduce some dummies so that there are versions, but none works
+insertpackage 'unstable' 'libnss-mdns-i386' 'amd64' '0.1-6'
+insertpackage 'experimental' 'libnss-mdns-amd64' 'i386,amd64' '0.10-6' 'Provides: libnss-mdns-i386'
+
+insertpackage 'unstable' 'foo' 'amd64' '1' 'Depends: libfoo'
+insertpackage 'unstable' 'libfoo' 'amd64' '1' 'Depends: libfoo-bin'
+insertpackage 'unstable' 'libfoo-bin' 'i386' '0.10-6' 'Multi-Arch: foreign'
+
+insertinstalledpackage 'lib32nss-mdns' 'amd64' '0.9-1'
+insertinstalledpackage 'libnss-mdns' 'amd64' '0.9-1'
+
+insertinstalledpackage 'i-make-packages-important' 'all' '1' 'Depends: libnss-mdns'
+
+setupaptarchive --no-update
+
+# make libnss-mdns-i386 unavailable
+configarchitecture 'amd64'
+testsuccess aptget update
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ lib32nss-mdns
+The following packages will be upgraded:
+ libnss-mdns
+1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv lib32nss-mdns [0.9-1]
+Inst libnss-mdns [0.9-1] (0.10-6 unstable [amd64])
+Conf libnss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ foo : Depends: libfoo but it is not going to be installed
+E: Unable to correct problems, you have held broken packages.' aptget install foo -s
+
+# activate multiarch
+configarchitecture 'amd64' 'i386'
+testsuccess aptget update
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ libnss-mdns:i386 libnss-mdns-i386:i386
+The following packages will be upgraded:
+ lib32nss-mdns libnss-mdns
+2 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst lib32nss-mdns [0.9-1] (0.10-6 unstable [amd64]) []
+Inst libnss-mdns [0.9-1] (0.10-6 unstable [amd64]) []
+Inst libnss-mdns:i386 (0.10-6 unstable [i386]) []
+Inst libnss-mdns-i386:i386 (0.10-6 unstable [i386])
+Conf libnss-mdns:i386 (0.10-6 unstable [i386])
+Conf libnss-mdns (0.10-6 unstable [amd64])
+Conf libnss-mdns-i386:i386 (0.10-6 unstable [i386])
+Conf lib32nss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libfoo libfoo-bin:i386
+The following NEW packages will be installed:
+ foo libfoo libfoo-bin:i386
+0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
+Inst libfoo-bin:i386 (0.10-6 unstable [i386])
+Inst libfoo (1 unstable [amd64])
+Inst foo (1 unstable [amd64])
+Conf libfoo-bin:i386 (0.10-6 unstable [i386])
+Conf libfoo (1 unstable [amd64])
+Conf foo (1 unstable [amd64])' aptget install foo -s
diff --git a/test/integration/test-bug-737130-multicompress-file-modes b/test/integration/test-bug-737130-multicompress-file-modes
new file mode 100755
index 000000000..7df6339a2
--- /dev/null
+++ b/test/integration/test-bug-737130-multicompress-file-modes
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+cat >aptarchive/ftparchive.conf <<EOF
+Dir { ArchiveDir "$(pwd)/aptarchive"; CacheDir "$(pwd)/aptarchive"; };
+Default { Translation::Compress ". gzip bzip2 xz"; FileMode 0644; };
+tree "dists/sid" {
+ Sections "main";
+ Architectures "i386";
+ LongDescription "false";
+};
+EOF
+mkdir -p aptarchive/dists/sid/main/binary-i386
+mkdir -p aptarchive/dists/sid/main/i18n
+testsuccess aptftparchive generate aptarchive/ftparchive.conf
+i18n=aptarchive/dists/sid/main/i18n
+for comp in '' .gz .bz2 .xz; do
+ msgtest 'Test apt-ftparchive file mode is 644 for' "Translation-en$comp"
+ FILEMODE="$(stat --format %a "$i18n/Translation-en$comp")"
+ if [ "$FILEMODE" != '644' ]; then
+ msgfail "Mode was '$FILEMODE'!"
+ else
+ msgpass
+ fi
+done
diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol
new file mode 100755
index 000000000..1e5748eae
--- /dev/null
+++ b/test/integration/test-bug-738785-switch-protocol
@@ -0,0 +1,63 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
+
+# setup http redirecting to https
+setupaptarchive --no-update
+changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \
+ -o 'aptwebserver::redirect::replace::/downgrademe/=http://localhost:8080/' \
+ -o 'aptwebserver::support::http=false'
+changetohttpswebserver
+sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/*
+
+testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1
+
+msgtest 'Test that the webserver does not answer' 'http requests'
+downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass
+
+echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf
+testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
+
+testsuccess aptget changelog apt -d
+testsuccess test -s apt.changelog
+rm -f apt.changelog
+
+testsuccess aptget download apt
+testsuccess test -s apt_1.0_all.deb
+rm apt_1.0_all.deb
+
+testsuccess aptget install apt -y
+testdpkginstalled 'apt'
+
+# create a copy of all methods, expect https
+eval `aptconfig shell METHODS Dir::Bin::Methods/d`
+COPYMETHODS='usr/lib/apt/methods'
+mv rootdir/${COPYMETHODS} rootdir/${COPYMETHODS}.bak
+mkdir -p rootdir/$COPYMETHODS
+cd rootdir/$COPYMETHODS
+find $METHODS \! -type d | while read meth; do
+ ln -s $meth
+done
+rm https
+cd - >/dev/null
+echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf
+
+testequal "E: The method driver $(pwd)/rootdir/usr/lib/apt/methods/https could not be found.
+N: Is the package apt-transport-https installed?" aptget download apt -q=0
+testsuccess test ! -e apt_1.0_all.deb
+
+# revert to all methods
+rm -rf rootdir/$COPYMETHODS
+mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS}
+
+# check that downgrades from https to http are not allowed
+webserverconfig 'aptwebserver::support::http' 'true'
+sed -i -e 's#:8080/redirectme#:4433/downgrademe#' -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/*
+testfailure aptget update
diff --git a/test/integration/test-bug-740843-versioned-up-down-breaks b/test/integration/test-bug-740843-versioned-up-down-breaks
new file mode 100755
index 000000000..cb035a71f
--- /dev/null
+++ b/test/integration/test-bug-740843-versioned-up-down-breaks
@@ -0,0 +1,55 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'foo-driver' 'amd64' '1' 'Depends: libfoo (= 1)
+Recommends: libgl1-foo-glx (= 1)
+Breaks: libgl1-foo-glx (<< 1), libgl1-foo-glx (>> 1)'
+insertinstalledpackage 'libgl1-foo-glx' 'amd64,i386' '1' 'Depends: libfoo (= 1)
+Multi-Arch: same'
+insertinstalledpackage 'libfoo' 'amd64,i386' '1' 'Multi-Arch: same'
+
+buildsimplenativepackage 'foo-driver' 'amd64' '2' 'stable' 'Depends: libfoo (= 2)
+Recommends: libgl1-foo-glx (= 2)
+Breaks: libgl1-foo-glx (<< 2), libgl1-foo-glx (>> 2)'
+buildsimplenativepackage 'libgl1-foo-glx' 'amd64,i386' '2' 'stable' 'Depends: libfoo (= 2)
+Multi-Arch: same'
+buildsimplenativepackage 'libfoo' 'amd64,i386' '2' 'stable' 'Multi-Arch: same'
+
+setupaptarchive
+
+testequalor2 'Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+ foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386
+5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst libgl1-foo-glx [1] (2 stable [amd64]) [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:i386 foo-driver:amd64 ]
+Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ]
+Inst foo-driver [1] (2 stable [amd64]) []
+Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ]
+Inst libfoo [1] (2 stable [amd64])
+Conf libfoo:i386 (2 stable [i386])
+Conf libfoo (2 stable [amd64])
+Conf libgl1-foo-glx:i386 (2 stable [i386])
+Conf libgl1-foo-glx (2 stable [amd64])
+Conf foo-driver (2 stable [amd64])' 'Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+ foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386
+5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst libgl1-foo-glx [1] (2 stable [amd64]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 libgl1-foo-glx:i386 ]
+Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ]
+Inst foo-driver [1] (2 stable [amd64]) []
+Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ]
+Inst libfoo [1] (2 stable [amd64])
+Conf libfoo:i386 (2 stable [i386])
+Conf libfoo (2 stable [amd64])
+Conf libgl1-foo-glx:i386 (2 stable [i386])
+Conf libgl1-foo-glx (2 stable [amd64])
+Conf foo-driver (2 stable [amd64])' aptget dist-upgrade -s
+
+testsuccess aptget dist-upgrade -y -o Debug::pkgPackageManager=1 -o Debug::pkgOrderList=1
diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade
new file mode 100755
index 000000000..c29e1f903
--- /dev/null
+++ b/test/integration/test-bug-multiarch-upgrade
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'libcups2' 'amd64' '1' 'Multi-Arch: same'
+insertinstalledpackage 'libcups2' 'i386' '1' 'Multi-Arch: same'
+
+insertpackage 'unstable' 'libcups2' 'amd64' '0' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'amd64' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'i386' '0' 'Multi-Arch: same'
+insertpackage 'unstable' 'libcups2' 'i386' '2' 'Multi-Arch: same'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libcups2
+The following packages will be upgraded:
+ libcups2 libcups2:i386
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ]
+Inst libcups2:i386 [1] (2 unstable [i386])
+Conf libcups2:i386 (2 unstable [i386])
+Conf libcups2 (2 unstable [amd64])' aptget install -s libcups2:i386
diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes
index c6f5ab49e..67ca0ba27 100755
--- a/test/integration/test-compressed-indexes
+++ b/test/integration/test-compressed-indexes
@@ -5,6 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
+configcompression '.' 'gz' # only gz is supported for this, so ensure it is used
configarchitecture "i386"
buildsimplenativepackage "testpkg" "i386" "1.0"
diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop
index 4407fbd9d..4978fe1e8 100755
--- a/test/integration/test-conflicts-loop
+++ b/test/integration/test-conflicts-loop
@@ -6,11 +6,11 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
-insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre-headless (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)'
-insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre-lib' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-headless (<< 6b17~pre3-1)'
-insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1'
+insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1'
insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)'
setupaptarchive
@@ -19,16 +19,10 @@ testequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
- openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386
- openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Remv openjdk-6-jre [6b16-1.8-0ubuntu1]
- openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386
Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1]
Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386
- openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386
Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])
diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts
new file mode 100755
index 000000000..cb82ebc7a
--- /dev/null
+++ b/test/integration/test-failing-maintainer-scripts
@@ -0,0 +1,132 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'native'
+
+# create a bunch of failures
+createfailure() {
+ setupsimplenativepackage "failure-$1" 'native' '1.0' 'unstable' 'Depends: dependee'
+ BUILDDIR="incoming/failure-$1-1.0"
+ echo '#!/bin/sh
+exit 29' > ${BUILDDIR}/debian/$1
+ buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+ rm -rf "$BUILDDIR"
+}
+
+buildsimplenativepackage 'dependee' 'native' '1.0' 'unstable'
+createfailure 'preinst'
+createfailure 'postinst'
+createfailure 'prerm'
+createfailure 'postrm'
+
+setupaptarchive
+
+# create a library to noop chroot() and rewrite maintainer script executions
+# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
+# chroot directory dpkg could chroot into to execute the maintainer scripts
+cat << EOF > noopchroot.c
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+static char * chrootdir = NULL;
+
+int chroot(const char *path) {
+ printf("WARNING: CHROOTing to %s was ignored!\n", path);
+ free(chrootdir);
+ chrootdir = strdup(path);
+ return 0;
+}
+int execvp(const char *file, char *const argv[]) {
+ static int (*func_execvp) (const char *, char * const []) = NULL;
+ if (func_execvp == NULL)
+ func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp");
+ if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0)
+ return func_execvp(file, argv);
+ printf("REWRITE execvp call %s into %s\n", file, chrootdir);
+ char newfile[strlen(chrootdir) + strlen(file)];
+ strcpy(newfile, chrootdir);
+ strcat(newfile, file);
+ return func_execvp(newfile, argv);
+}
+EOF
+testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
+
+mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
+DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
+echo "#!/bin/sh
+if [ -n \"\$LD_PRELOAD\" ]; then
+ export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\"
+else
+ export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\"
+fi
+dpkg \"\$@\"" > $DPKG
+chmod +x $DPKG
+sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf
+
+# setup some pre- and post- invokes to check the output isn't garbled later
+APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook"
+echo '#!/bin/sh
+echo "$1: START"
+echo "$1: MaiN"
+echo "$1: ENd"' > $APTHOOK
+chmod +x $APTHOOK
+echo "DPKG::Pre-Invoke:: \"${APTHOOK} PRE\";
+DPKG::Post-Invoke:: \"${APTHOOK} POST\";" > rootdir/etc/apt/apt.conf.d/99apthooks
+
+testmyfailure() {
+ local PROGRESS='rootdir/tmp/progress.log'
+ exec 3> $PROGRESS
+ testfailure "$@" -o APT::Status-Fd=3
+ msgtest 'Test for failure message of maintainerscript in' 'console log'
+ local TEST='rootdir/tmp/testfailure.output'
+ if grep -q 'exit status 29$' "$TEST"; then
+ msgpass
+ else
+ cat $TEST
+ msgfail
+ fi
+ msgtest 'Test for proper execution of invoke scripts in' 'console log'
+ if grep -q '^PRE: START$' $TEST &&
+ grep -q '^PRE: MaiN$' $TEST &&
+ grep -q '^PRE: ENd$' $TEST &&
+ grep -q '^POST: START$' $TEST &&
+ grep -q '^POST: MaiN$' $TEST &&
+ grep -q '^POST: ENd$' $TEST; then
+ msgpass
+ else
+ cat $TEST
+ msgfail
+ fi
+ msgtest 'Test for failure message of maintainerscript in' 'progress log'
+ if grep -q '^pmerror:.\+exit status 29$' "$PROGRESS"; then
+ msgpass
+ else
+ cat $PROGRESS
+ msgfail
+ fi
+ testmarkedauto 'dependee'
+}
+
+cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status.backup
+testmyfailure aptget install failure-preinst -y
+cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status
+testmyfailure aptget install failure-postinst -y
+cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status
+testsuccess aptget install failure-prerm -y
+testdpkginstalled failure-prerm
+testmyfailure aptget purge failure-prerm -y
+cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status
+testsuccess aptget install failure-postrm -y
+testdpkginstalled failure-postrm
+testmyfailure aptget purge failure-postrm -y
+
+# FIXME: test with output going to a PTY as it usually does
+#cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status
+#aptget install failure-preinst -y
diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks
index f8b4544a0..745f7d206 100755
--- a/test/integration/test-ignore-provides-if-versioned-breaks
+++ b/test/integration/test-ignore-provides-if-versioned-breaks
@@ -142,9 +142,9 @@ The following packages will be upgraded:
2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ]
Inst foo-same [2.0] (4.0 unstable [i386])
-Conf foo-same:amd64 (4.0 unstable [amd64])
-Conf foo-same (4.0 unstable [i386])
Inst foo-same-breaker-3 (1.0 unstable [i386])
Inst foo-same-provider (1.0 unstable [i386])
+Conf foo-same (4.0 unstable [i386])
+Conf foo-same:amd64 (4.0 unstable [amd64])
Conf foo-same-breaker-3 (1.0 unstable [i386])
Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s
diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts
index 44eafcff1..a07252768 100755
--- a/test/integration/test-ignore-provides-if-versioned-conflicts
+++ b/test/integration/test-ignore-provides-if-versioned-conflicts
@@ -142,9 +142,9 @@ The following packages will be upgraded:
2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ]
Inst foo-same [2.0] (4.0 unstable [i386])
-Conf foo-same:amd64 (4.0 unstable [amd64])
-Conf foo-same (4.0 unstable [i386])
Inst foo-same-breaker-3 (1.0 unstable [i386])
Inst foo-same-provider (1.0 unstable [i386])
+Conf foo-same (4.0 unstable [i386])
+Conf foo-same:amd64 (4.0 unstable [amd64])
Conf foo-same-breaker-3 (1.0 unstable [i386])
Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s
diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove
new file mode 100755
index 000000000..c51caa758
--- /dev/null
+++ b/test/integration/test-kernel-helper-autoremove
@@ -0,0 +1,101 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+# the executed script would use the installed apt-config,
+# which is outside of our control
+msgtest 'Check that the installed apt-config supports' '--no-empty'
+if apt-config dump --no-empty >/dev/null 2>&1; then
+ msgpass
+else
+ msgskip
+ exit 0
+fi
+
+CURRENTKERNEL="linux-image-$(uname -r)"
+insertinstalledpackage "$CURRENTKERNEL" 'amd64' '1'
+insertinstalledpackage 'linux-image-1.0.0-2-generic' 'amd64' '1.0.0-2'
+insertinstalledpackage 'linux-image-100.0.0-1-generic' 'amd64' '100.0.0-1'
+insertinstalledpackage 'linux-image-amd64' 'amd64' '100.0.0-1'
+# ensure that the '.' is really a dot and not a wildcard
+insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1'
+
+testsuccess aptmark auto "$CURRENTKERNEL" 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic'
+
+cat > ./fake-dpkg <<EOF
+#!/bin/sh
+exec $(aptconfig dump --no-empty --format='%v ' 'DPKG::options') "\$@"
+EOF
+chmod +x ./fake-dpkg
+echo 'Dir::Bin::dpkg "./fake-dpkg";' > rootdir/etc/apt/apt.conf.d/99fakedpkg
+
+# install fake-dpkg into it
+catfail() {
+ echo >&2
+ echo >&2 '### List of protected kernels:'
+ cat >&2 protected.list
+ msgfail
+}
+
+testprotected() {
+ rm -f rootdir/etc/apt/apt.conf.d/01autoremove-kernels protected.list
+
+ testsuccess runapt sh ${TESTDIR}/../../debian/apt.auto-removal.sh "$@"
+
+ msgtest 'Check kernel autoremoval protection list' 'is created'
+ test -e rootdir/etc/apt/apt.conf.d/01autoremove-kernels && msgpass || msgfail
+
+ msgtest 'Check kernel autoremoval protection list' 'can be dumped'
+ aptconfig dump --no-empty --format '%v%n' 'APT::NeverAutoRemove' >protected.list 2>&1 && msgpass || catfail
+
+ msgtest 'Check kernel autoremoval protection list' 'can be parsed'
+ grep -q '^[A-Z]: ' protected.list && catfail || msgpass
+
+ msgtest 'Check kernel autoremoval protection list includes' 'most recent kernel'
+ grep -q '^\^linux-image-100\\\.0\\\.0-1-generic\$$' protected.list && msgpass || catfail
+
+ msgtest 'Check kernel autoremoval protection list includes' 'running kernel'
+ grep -q "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list && msgpass || catfail
+}
+
+testequal "Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ linux-headers-1000000-1-generic (100.0.0-1)
+ linux-image-1.0.0-2-generic (1.0.0-2)
+ linux-image-100.0.0-1-generic (100.0.0-1)
+ $CURRENTKERNEL (1)
+0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
+Remv linux-headers-1000000-1-generic [100.0.0-1]
+Remv linux-image-1.0.0-2-generic [1.0.0-2]
+Remv linux-image-100.0.0-1-generic [100.0.0-1]
+Remv $CURRENTKERNEL [1]" aptget autoremove -sV
+
+testprotected
+msgtest 'Check kernel autoremoval protection list does not include' 'old kernel'
+grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && catfail || msgpass
+
+testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ linux-headers-1000000-1-generic linux-image-1.0.0-2-generic
+0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
+Remv linux-headers-1000000-1-generic [100.0.0-1]
+Remv linux-image-1.0.0-2-generic [1.0.0-2]' aptget autoremove -s
+
+testprotected 1.0.0-2-generic
+msgtest 'Check kernel autoremoval protection list includes' 'installed kernel'
+grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && msgpass || catfail
+testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ linux-headers-1000000-1-generic
+0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
+Remv linux-headers-1000000-1-generic [100.0.0-1]' aptget autoremove -s
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
index 382789e68..5ab326def 100755
--- a/test/integration/test-partial-file-support
+++ b/test/integration/test-partial-file-support
@@ -13,17 +13,18 @@ copysource() {
touch -d "$(stat --format '%y' "${TESTFILE}")" "$3"
}
+DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
+
testdownloadfile() {
- local DOWNLOG='download-testfile.log'
- rm -f "$DOWNLOG"
+ rm -f "$DOWNLOADLOG"
msgtest "Testing download of file $2 with" "$1"
- if ! downloadfile "$2" "$3" > "$DOWNLOG"; then
- cat >&2 "$DOWNLOG"
+ if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then
+ cat >&2 "$DOWNLOADLOG"
msgfail
else
msgpass
fi
- cat "$DOWNLOG" | while read field hash; do
+ cat "$DOWNLOADLOG" | while read field hash; do
local EXPECTED
case "$field" in
'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";;
@@ -40,28 +41,12 @@ testdownloadfile() {
if [ "$EXPECTED" "$4" "$hash" ]; then
msgpass
else
- cat >&2 "$DOWNLOG"
+ cat >&2 "$DOWNLOADLOG"
msgfail "expected: $EXPECTED ; got: $hash"
fi
done
}
-testwebserverlaststatuscode() {
- local DOWNLOG='download-testfile.log'
- rm -f "$DOWNLOG"
- local STATUS="$(mktemp)"
- addtrap "rm $STATUS;"
- msgtest 'Test last status code from the webserver was' "$1"
- downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
- if [ "$(cat "$STATUS")" = "$1" ]; then
- msgpass
- else
- cat >&2 "$DOWNLOG"
- msgfail "Status was $(cat "$STATUS")"
- fi
-}
-
-
TESTFILE='aptarchive/testfile'
cp -a ${TESTDIR}/framework $TESTFILE
@@ -70,34 +55,34 @@ testrun() {
copysource $TESTFILE 0 ./testfile
testdownloadfile 'no data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
copysource $TESTFILE 20 ./testfile
testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '206'
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
copysource /dev/zero 20 ./testfile
testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!='
- testwebserverlaststatuscode '206'
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
copysource $TESTFILE 1M ./testfile
testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '416'
+ testwebserverlaststatuscode '416' "$DOWNLOADLOG"
copysource /dev/zero 1M ./testfile
testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
copysource /dev/zero 20 ./testfile
touch ./testfile
testdownloadfile 'old data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
webserverconfig 'aptwebserver::support::range' 'false'
copysource $TESTFILE 20 ./testfile
testdownloadfile 'no server support' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
}
testrun 'http://localhost:8080'
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index ac0563b7f..afe1ad443 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -5,39 +5,169 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
buildaptarchive
setupflataptarchive
changetowebserver
-signreleasefiles
-testsuccess aptget update
-testnopackage newstuff
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
-testequal "$(cat ${PKGFILE})
+
+echo '#!/bin/sh
+touch merge-was-used
+/usr/bin/diffindex-rred "$@"' > extrred
+chmod +x extrred
+echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred
+
+wasmergeused() {
+ msgtest 'Test for successful execution of' "$*"
+ local OUTPUT=$(mktemp)
+ addtrap "rm $OUTPUT;"
+ if aptget update "$@" >${OUTPUT} 2>&1; then
+ msgpass
+ else
+ echo
+ cat $OUTPUT
+ msgfail
+ fi
+
+ msgtest 'No intermediate patch files' 'still exist'
+ local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
+ if [ -z "$EDS" ]; then
+ msgpass
+ else
+ echo
+ echo "$EDS"
+ msgfail
+ fi
+
+ msgtest 'Check if the right pdiff merger was used'
+ if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then
+ if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgpass
+ else
+ msgfail "Merge shouldn't have been used, but was"
+ fi
+ elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgfail "Merge should have been used, but wasn't"
+ else
+ msgpass
+ fi
+}
+
+testrun() {
+ msgmsg "Testcase: setup the base with: $*"
+ find aptarchive -name 'Packages*' -type f -delete
+ cp ${PKGFILE} aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ generatereleasefiles
+ signreleasefiles
+ rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists
+ testsuccess aptget update "$@"
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
+ testnopackage newstuff
+ testequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
-cp ${PKGFILE}-new aptarchive/Packages
-compressfile 'aptarchive/Packages'
-rm -rf aptarchive/Packages.diff
-mkdir -p aptarchive/Packages.diff
-PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
-diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
-cat $PATCHFILE | gzip > ${PATCHFILE}.gz
-PATCHINDEX="aptarchive/Packages.diff/Index"
-echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+ msgmsg "Testcase: apply with one patch: $*"
+ cp ${PKGFILE}-new aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
SHA1-History:
9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
$(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
SHA1-Patches:
7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
$(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
-generatereleasefiles '+1hour'
-signreleasefiles
-find aptarchive -name 'Packages*' -type f -delete
-testsuccess aptget update
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ find aptarchive -name 'Packages*' -type f -delete
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
-testnopackage oldstuff
-testequal "$(cat ${PKGFILE}-new)
+ msgmsg "Testcase: index is already up-to-date: $*"
+ find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete
+ testsuccess aptget update "$@"
+ testequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
+
+ msgmsg "Testcase: apply with two patches: $*"
+ cp ${PKGFILE}-new aptarchive/Packages
+ echo '
+Package: futurestuff
+Version: 1.0
+Architecture: i386
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 202
+Filename: pool/futurestuff_1.0_i386.deb
+Size: 202200
+MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671
+SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c
+SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
+Description: some cool and shiny future stuff
+ This package will appear in the next next mirror update
+Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages
+
+ compressfile 'aptarchive/Packages'
+ PATCHFILE2="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
+ diff -e ${PKGFILE}-new aptarchive/Packages > ${PATCHFILE2} || true
+ cat $PATCHFILE2 | gzip > ${PATCHFILE2}.gz
+ echo "SHA1-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE})
+ $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2})
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)
+ $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX
+ generatereleasefiles '+2hour'
+ signreleasefiles
+ cp -a aptarchive/Packages Packages-future
+ find aptarchive -name 'Packages*' -type f -delete
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat Packages-future)
+" aptcache show apt newstuff futurestuff
+
+ msgmsg "Testcase: patch applying fails, but successful fallback: $*"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp ${PKGFILE}-new aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
+ echo 'I am Mallory and I change files' >> $PATCHFILE
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ testsuccess aptget update "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
+}
+echo 'Debug::pkgAcquire::Diffs "true";
+Debug::pkgAcquire::rred "true";' > rootdir/etc/apt/apt.conf.d/rreddebug.conf
+
+testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1
+testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1
+testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=0
+testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=0
diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
index fed12dad0..d647856cb 100755
--- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
+++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
@@ -55,14 +55,14 @@ Remv out-of-sync-gone-foreign:i386 [1]
Remv out-of-sync-gone-native [1]
Inst fine [1] (2 unstable [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ]
Inst fine:i386 [1] (2 unstable [i386])
-Conf fine (2 unstable [amd64])
-Conf fine:i386 (2 unstable [i386])
Inst fine-installed [1] (2 unstable [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ]
Inst fine-installed:i386 [1] (2 unstable [i386])
-Conf fine-installed (2 unstable [amd64])
-Conf fine-installed:i386 (2 unstable [i386])
Inst out-of-sync-gone-foreign [1] (2 unstable [amd64])
Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386])
+Conf fine:i386 (2 unstable [i386])
+Conf fine (2 unstable [amd64])
+Conf fine-installed:i386 (2 unstable [i386])
+Conf fine-installed (2 unstable [amd64])
Conf out-of-sync-gone-foreign (2 unstable [amd64])
Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1
diff --git a/test/integration/test-sourceslist-arch-plusminus-options b/test/integration/test-sourceslist-arch-plusminus-options
index 0d4d7448f..0091964e6 100755
--- a/test/integration/test-sourceslist-arch-plusminus-options
+++ b/test/integration/test-sourceslist-arch-plusminus-options
@@ -76,7 +76,7 @@ echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' >
testbinaries 'substract from a arch-set' 'i386'
echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
-testbinaries 'useless substract from a arch-set' 'i386'
+testbinaries 'useless subtract from a arch-set' 'i386'
echo 'deb [arch=mips,i386 arch+=armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
testbinaries 'addition to a arch-set' 'i386' 'mips' 'armhf'
diff --git a/test/integration/test-bug-1078697-missing-source-hashes b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes
index 6fcb856b5..6fcb856b5 100755
--- a/test/integration/test-bug-1078697-missing-source-hashes
+++ b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes
diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
index 1576c396c..7112d2b45 100755
--- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
+++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
@@ -22,7 +22,7 @@ Config-Item: Acquire::http::DependOnSTDIN=0
600 Acquire URI
URI: http://localhost:8080/holygrail
Filename: knights-talking
-' | http >/dev/null 2>&1 && msgpass || msgfail
+' | ${METHODSDIR}/http >/dev/null 2>&1 && msgpass || msgfail
testfileequal knights-talking 'ni ni ni'
ensure_n_canary_strings_in_dir() {
diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
index e9d684309..50ca2bf57 100755
--- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
+++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
@@ -35,5 +35,5 @@ testequal "Package files:
100 ${ROOTDIR}/rootdir/var/lib/dpkg/status
release a=now
500 file:${ROOTDIR}/aptarchive/ unstable/main i386 Packages
- release a=unstable,n=unstable,c=main
+ release a=unstable,n=sid,c=main
Pinned packages:" aptcache policy
diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages
index 7f3b05e59..c1d454f88 100755
--- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages
+++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages
@@ -15,19 +15,18 @@ Breaks: libreoffice-core (>= 3+), libreoffice-core (<= 3~), libreoffice-style-ga
insertinstalledpackage 'libreoffice-style-galaxy' 'amd64' '3' 'Depends: libreoffice-core
Provides: libreoffice-style'
-buildsimplenativepackage 'libreoffice' 'amd64' '4' 'sid' 'Depends: libreoffice-core (= 4)'
-buildsimplenativepackage 'libreoffice-core' 'amd64' '4' 'sid' 'Depends: libreoffice-common (>= 4)
+insertpackage 'sid' 'libreoffice' 'amd64' '4' 'Depends: libreoffice-core (= 4)'
+insertpackage 'sid' 'libreoffice-core' 'amd64' '4' 'Depends: libreoffice-common (>= 4)
Breaks: libreoffice-common (<< 4), libreoffice-style-galaxy (<< 4)'
-buildsimplenativepackage 'libreoffice-common' 'all' '4' 'sid' 'Depends: libreoffice-style, ure
+insertpackage 'sid' 'libreoffice-common' 'all' '4' 'Depends: libreoffice-style, ure
Breaks: libreoffice-core (>= 4+), libreoffice-core (<= 4~), libreoffice-style-galaxy (>= 4+), libreoffice-style-galaxy (<= 4~)'
-buildsimplenativepackage 'libreoffice-style-galaxy' 'amd64' '4' 'sid' 'Depends: libreoffice-core
+insertpackage 'sid' 'libreoffice-style-galaxy' 'amd64' '4' 'Depends: libreoffice-core
Provides: libreoffice-style'
-
-buildsimplenativepackage 'ure' 'amd64' '4' 'sid'
+insertpackage 'sid' 'ure' 'amd64' '4'
setupaptarchive
-testequal 'Reading package lists...
+testequalor2 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
ure
@@ -40,7 +39,23 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-core:amd64 on libreoffice
Inst libreoffice-common [3] (4 sid [all]) []
Inst ure (4 sid [amd64])
Conf ure (4 sid [amd64])
+Conf libreoffice-common (4 sid [all])
+Conf libreoffice-core (4 sid [amd64])
Conf libreoffice-style-galaxy (4 sid [amd64])
+Conf libreoffice (4 sid [amd64])' 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ ure
+The following packages will be upgraded:
+ libreoffice libreoffice-common libreoffice-core libreoffice-style-galaxy
+4 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libreoffice [3] (4 sid [amd64]) []
+Inst libreoffice-style-galaxy [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffice-style-galaxy:amd64] [libreoffice-common:amd64 ]
+Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffice-core:amd64] [libreoffice-common:amd64 on libreoffice-style-galaxy:amd64] [libreoffice-core:amd64 on libreoffice-common:amd64] [libreoffice-common:amd64 ]
+Inst libreoffice-common [3] (4 sid [all]) []
+Inst ure (4 sid [amd64])
+Conf ure (4 sid [amd64])
Conf libreoffice-common (4 sid [all])
Conf libreoffice-core (4 sid [amd64])
+Conf libreoffice-style-galaxy (4 sid [amd64])
Conf libreoffice (4 sid [amd64])' aptget dist-upgrade -s