diff options
Diffstat (limited to 'test')
110 files changed, 2875 insertions, 782 deletions
diff --git a/test/integration/framework b/test/integration/framework index b253deb91..b443f2a7b 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -99,10 +99,14 @@ msgdone() { } getaptconfig() { if [ -f ./aptconfig.conf ]; then - echo "./aptconfig.conf" + echo "$(readlink -f ./aptconfig.conf)" elif [ -f ../aptconfig.conf ]; then - echo "../aptconfig.conf" - fi + echo "$(readlink -f ../aptconfig.conf)" + elif [ -f ../../aptconfig.conf ]; then + echo "$(readlink -f ../../aptconfig.conf)" + elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then + echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" + fi } runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " @@ -137,7 +141,17 @@ dpkgcheckbuilddeps() { command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" } gdb() { - local CMD="$1" + local CMD + case "$1" in + aptget) CMD="apt-get";; + aptcache) CMD="apt-cache";; + aptcdrom) CMD="apt-cdrom";; + aptconfig) CMD="apt-config";; + aptmark) CMD="apt-mark";; + apthelper) CMD="apt-helper";; + aptftparchive) CMD="apt-ftparchive";; + *) CMD="$1";; + esac shift runapt command gdb --quiet -ex run "${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@" } @@ -238,7 +252,7 @@ setupenvironment() { echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf - echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf + echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf # store apt-key were we can access it, even if we run it as a different user # destroys coverage reporting though, so just do it for root for now if [ "$(id -u)" = '0' ]; then @@ -266,16 +280,19 @@ EOF chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg - 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 'quiet::NoUpdate "true";' >> aptconfig.conf - echo 'quiet::NoStatistic "true";' >> aptconfig.conf - # too distracting for users, but helpful to detect changes - echo 'Acquire::Progress::Ignore::ShowErrorText "true";' >> aptconfig.conf - # in testcases, it can appear as if localhost has a rotation setup, - # hide this as we can't really deal with it properly - echo 'Acquire::Failure::ShowIP "false";' >> aptconfig.conf + { + if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then + echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it… + fi + echo 'quiet::NoUpdate "true";' + echo 'quiet::NoStatistic "true";' + # too distracting for users, but helpful to detect changes + echo 'Acquire::Progress::Ignore::ShowErrorText "true";' + echo 'Acquire::Progress::Diffpercent "true";' + # in testcases, it can appear as if localhost has a rotation setup, + # hide this as we can't really deal with it properly + echo 'Acquire::Failure::ShowIP "false";' + } >> aptconfig.conf cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" if [ "$(id -u)" = '0' ]; then @@ -513,6 +530,12 @@ Package: $NAME" > debian/control buildsimplenativepackage() { local NAME="$1" + local NM + if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then + NM="$(echo "$NAME" | cut -c 1-4)" + else + NM="$(echo "$NAME" | cut -c 1)" + fi local ARCH="$2" local VERSION="$3" local RELEASE="${4:-unstable}" @@ -547,10 +570,12 @@ echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME} -- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog echo "Source: $NAME -Section: $SECTION Priority: $PRIORITY Maintainer: Joe Sixpack <joe@example.org> Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control + if [ "$SECTION" != '<none>' ]; then + echo "Section: $SECTION" >> ${BUILDDIR}/debian/control + fi local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')" test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control echo " @@ -593,15 +618,15 @@ Package: $NAME" >> ${BUILDDIR}/debian/control (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch) (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" - # ensure the right permissions as dpkg-deb ensists + # ensure the right permissions as dpkg-deb insists chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist done - mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} - cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ - cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog + local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" + mkdir -p $CHANGEPATH + cp ${BUILDDIR}/debian/changelog $CHANGEPATH rm -rf "${BUILDDIR}" msgdone "info" } @@ -773,6 +798,8 @@ insertsource() { local SPATH="aptarchive/dists/${RELEASE}/main/source" mkdir -p $SPATH local FILE="${SPATH}/Sources" + local DSCFILE="${NAME}_${VERSION}.dsc" + local TARFILE="${NAME}_${VERSION}.tar.gz" echo "Package: $NAME Binary: $NAME Version: $VERSION @@ -780,8 +807,8 @@ Maintainer: Joe Sixpack <joe@example.org> Architecture: $ARCH" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE echo "Files: - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz + $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) $DSCFILE + $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) $TARFILE " >> $FILE } @@ -835,7 +862,9 @@ buildaptarchivefromincoming() { buildaptarchivefromfiles() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" - find aptarchive -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do + local DIR='aptarchive' + if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi + find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do msgninfo "\t${line} file… " compressfile "$line" "$1" msgdone "info" @@ -867,6 +896,7 @@ getcodenamefromsuite() { } getreleaseversionfromsuite() { true; } getlabelfromsuite() { true; } +getoriginfromsuite() { true; } generatereleasefiles() { # $1 is the Date header and $2 is the ValidUntil header to be set @@ -878,16 +908,21 @@ generatereleasefiles() { local CODENAME="$(getcodenamefromsuite $SUITE)" local VERSION="$(getreleaseversionfromsuite $SUITE)" local LABEL="$(getlabelfromsuite $SUITE)" + local ORIGIN="$(getoriginfromsuite $SUITE)" if [ -n "$VERSION" ]; then VERSION="-o APT::FTPArchive::Release::Version=${VERSION}" fi if [ -n "$LABEL" ]; then LABEL="-o APT::FTPArchive::Release::Label=${LABEL}" fi + if [ -n "$ORIGIN" ]; then + ORIGIN="-o APT::FTPArchive::Release::Origin=${ORIGIN}" + fi aptftparchive -qq release $dir \ -o APT::FTPArchive::Release::Suite="${SUITE}" \ -o APT::FTPArchive::Release::Codename="${CODENAME}" \ ${LABEL} \ + ${ORIGIN} \ ${VERSION} \ | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then @@ -1263,7 +1298,7 @@ testdpkgstatus() { local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" if [ "$PKGS" != $NR ]; then echo >&2 $PKGS - dpkg -l "$@" | grep '^[a-z]' >&2 + dpkg -l "$@" | grep '^[a-z]' >&2 || true msgfail else msgpass @@ -1289,6 +1324,17 @@ testmarkedauto() { fi aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } +testmarkedmanual() { + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" + if [ -n "$1" ]; then + msgtest 'Test for correctly marked as manually installed' "$*" + while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE + else + msgtest 'Test for correctly marked as manually installed' 'no package' + echo -n > $COMPAREFILE + fi + aptmark showmanual 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail +} msgfailoutput() { local MSG="$1" @@ -1331,8 +1377,17 @@ testsuccess() { if expr match "$1" '^apt.*' >/dev/null; then if grep -q -E ' runtime error: ' "$OUTPUT"; then msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" - elif grep -q -E '^[WE]: ' "$OUTPUT"; then - msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" + elif grep -E '^[WE]: ' "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then + if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then + if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ + | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then + msgpass + else + msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" + fi + else + msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" + fi else msgpass fi @@ -1387,12 +1442,23 @@ testfailure() { else local EXITCODE=$? if expr match "$1" '^apt.*' >/dev/null; then - if grep -q -E ' runtime error: ' "$OUTPUT"; then - msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" - elif ! grep -q -E '^E: ' "$OUTPUT"; then - msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" + if [ "$1" = 'aptkey' ]; then + if grep -q -E " Can't check signature: " "$OUTPUT" || \ + grep -q -E " BAD signature from " "$OUTPUT"; then + msgpass + else + msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" + fi else - msgpass + if grep -q -E ' runtime error: ' "$OUTPUT"; then + msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" + elif grep -q -E '==ERROR' "$OUTPUT"; then + msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" + elif ! grep -q -E '^E: ' "$OUTPUT"; then + msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" + else + msgpass + fi fi else msgpass @@ -1441,9 +1507,9 @@ testfilestats() { msgpass else echo >&2 - ls -ld >&2 "$1" + ls -ld >&2 "$1" || true echo -n >&2 "stat(1) reports for $2: " - stat --format "$2" "$1" + stat --format "$2" "$1" || true msgfail fi } @@ -1529,6 +1595,11 @@ aptautotest() { } aptautotest_aptget_update() { + local TESTCALL="$1" + while [ -n "$2" ]; do + if [ "$2" = '--print-uris' ]; then return; fi # simulation mode + shift + done if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" @@ -1536,7 +1607,7 @@ aptautotest_aptget_update() { for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" done - if [ "$1" = 'testsuccess' ]; then + if [ "$TESTCALL" = 'testsuccess' ]; then # failure cases can retain partial files and such testempty find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) fi diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver deleted file mode 100755 index 0622941ce..000000000 --- a/test/integration/skip-aptwebserver +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework - -setupenvironment -configarchitecture 'amd64' - -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' - -setupaptarchive -changetowebserver - -rm -rf rootdir/var/lib/apt/lists -aptget update -qq -testequal 'Hit http://localhost stable InRelease -Hit http://localhost stable/main Sources -Hit http://localhost stable/main amd64 Packages -Hit http://localhost stable/main Translation-en -Reading package lists...' aptget update - -mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial -aptget update - diff --git a/test/integration/test-acquire-same-file-multiple-times b/test/integration/test-acquire-same-file-multiple-times new file mode 100755 index 000000000..526765521 --- /dev/null +++ b/test/integration/test-acquire-same-file-multiple-times @@ -0,0 +1,80 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +TESTFILE="$TESTDIR/framework" +cp $TESTFILE aptarchive/foo +APTARCHIVE="$(readlink -f ./aptarchive)" + +filedown() { + msgtest 'Downloading the same URI twice over file' "$1" + testsuccess --nomsg apthelper download-file file:///$APTARCHIVE/foo ./downloaded/foo1 '' file:///$APTARCHIVE/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 + cp rootdir/tmp/testsuccess.output download.log + #cat download.log + testsuccess cmp $TESTFILE ./downloaded/foo1 + testsuccess cmp ./downloaded/foo1 ./downloaded/foo2 + #testequal '1' grep -c '200%20URI%20Start' ./download.log + testequal '1' grep -c '201%20URI%20Done' ./download.log + rm -f ./downloaded/foo1 ./downloaded/foo2 +} + +testrun() { + $1 'no partial' + cp $TESTFILE ./downloaded/foo1 + $1 'complete partial 1' + cp $TESTFILE ./downloaded/foo2 + $1 'complete partial 2' + cp $TESTFILE ./downloaded/foo1 + cp $TESTFILE ./downloaded/foo2 + $1 'complete partial 1+2' + dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null + $1 'partial partial 1' + dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null + $1 'partial partial 2' + dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null + dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null + $1 'partial partial 1+2' +} +testrun 'filedown' + +changetowebserver -o aptwebserver::redirect::replace::/foo2=/foo + +httpdown() { + msgtest 'Downloading the same URI to different files' 'twice over http' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 + cp rootdir/tmp/testsuccess.output download.log + testsuccess cmp $TESTDIR/framework ./downloaded/foo1 + testsuccess cmp ./downloaded/foo1 ./downloaded/foo2 + testequal '1' grep -c '200%20URI%20Start' ./download.log + testequal '1' grep -c '201%20URI%20Done' ./download.log + rm -f ./downloaded/foo1 ./downloaded/foo2 +} +testrun 'httpdown' + +httpredirectdown() { + msgtest 'Redirect leads' 'first URI to the second URI' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo2 ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 + cp rootdir/tmp/testsuccess.output download.log + testsuccess cmp $TESTDIR/framework ./downloaded/foo1 + testsuccess cmp ./downloaded/foo1 ./downloaded/foo2 + testequal '1' grep -c '200%20URI%20Start' ./download.log + testequal '1' grep -c '103%20Redirect' ./download.log + testequal '1' grep -c '201%20URI%20Done' ./download.log + rm -f ./downloaded/foo1 ./downloaded/foo2 +} +testrun 'httpredirectdown' + +httpsamedown() { + msgtest 'Downloading two files via the same URI to' 'the same file' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo1 '' -o Debug::pkgAcquire::Worker=1 + cp rootdir/tmp/testsuccess.output download.log + testsuccess cmp $TESTDIR/framework ./downloaded/foo1 + testequal '1' grep -c '200%20URI%20Start' ./download.log + testequal '1' grep -c '201%20URI%20Done' ./download.log + rm -f ./downloaded/foo1 +} +testrun 'httpsamedown' diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times new file mode 100755 index 000000000..d3cb46c14 --- /dev/null +++ b/test/integration/test-acquire-same-repository-multiple-times @@ -0,0 +1,81 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +TESTFILE="$TESTDIR/framework" +cp $TESTFILE aptarchive/foo +APTARCHIVE="$(readlink -f ./aptarchive)" + +getcodenamefromsuite() { echo "jessie"; } +buildsimplenativepackage 'foo' 'all' '1.0' 'stable' +setupaptarchive --no-update +ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie" +for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do + sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g') +done + +# install a slowed down file: otherwise its to fast to reproduce combining +NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods" +OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)" +rm $NEWMETHODS +mkdir $NEWMETHODS +for METH in $(find $OLDMETHODS ! -type d); do + ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS +done +rm $NEWMETHODS/file +cat >$NEWMETHODS/file <<EOF +#!/bin/sh +while read line; do + echo "\$line" + if [ -z "\$line" ]; then + sleep 0.5 + fi +done | $OLDMETHODS/file +EOF +chmod +x $NEWMETHODS/file + +tworepos() { + msgtest "Downloading the same repository twice over $1" "$3" + testsuccess --nomsg aptget update -o Debug::pkgAcquire::Worker=1 + cp rootdir/tmp/testsuccess.output download.log + #cat download.log + aptget indextargets --format '$(FILENAME)' --no-release-info | sort > file.lst + testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst + testsuccess aptcache policy + testequal "foo: + Installed: (none) + Candidate: 1.0 + Version table: + 1.0 500 + 500 $1:$2 jessie/main amd64 Packages + 500 $1:$2 stable/main amd64 Packages" aptcache policy foo + testfailure aptcache show foo/unstable + testsuccess aptcache show foo/stable + testsuccess aptcache show foo/jessie +} + +tworepos 'file' "$APTARCHIVE" 'no partial' +testequal '12' grep -c '200%20URI%20Start' ./download.log +testequal '12' grep -c '201%20URI%20Done' ./download.log +testequal '6' grep -c '^ @ Queue: Action combined' ./download.log +tworepos 'file' "$APTARCHIVE" 'hit' +testequal '6' grep -c '200%20URI%20Start' ./download.log +testequal '6' grep -c '201%20URI%20Done' ./download.log +testequal '0' grep -c '^ @ Queue: Action combined' ./download.log +rm -rf rootdir/var/lib/apt/lists + +changetowebserver + +tworepos 'http' '//localhost:8080' 'no partial' +testequal '10' grep -c '200%20URI%20Start' ./download.log +testequal '10' grep -c '201%20URI%20Done' ./download.log +testequal '6' grep -c '^ @ Queue: Action combined' ./download.log +tworepos 'http' '//localhost:8080' 'hit' +testequal '2' grep -c '200%20URI%20Start' ./download.log +testequal '4' grep -c '201%20URI%20Done' ./download.log +testequal '0' grep -c '^ @ Queue: Action combined' ./download.log +rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-allow b/test/integration/test-allow new file mode 100755 index 000000000..3d773ee95 --- /dev/null +++ b/test/integration/test-allow @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Test for --allow-remove-essential and friends replacing --force-yes +# +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unstable' 'downgrade' 'all' '1' +insertinstalledpackage 'downgrade' 'all' '2' + +insertpackage 'unstable' 'hold' 'all' '2' +insertinstalledpackage 'hold' 'all' '1' + +insertinstalledpackage 'essential' 'all' '1' 'Essential: yes' + +setupaptarchive + +testsuccess aptmark hold hold + +# Test --allow-remove--essential + +testfailureequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + essential +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + essential +0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded. +E: Essential packages were removed and -y was used without --allow-remove-essential.' aptget remove essential -y -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + essential +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + essential +0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded. +Remv essential [1]' aptget remove essential -y --allow-remove-essential -s + +# Test --allow-change-held-packages (should not influence dist-upgrade, but an install) + +testsuccessequal 'Reading package lists... +Building dependency tree... +Calculating upgrade... +The following packages have been kept back: + hold +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' aptget dist-upgrade --allow-change-held-packages -s + +testfailureequal 'Reading package lists... +Building dependency tree... +The following held packages will be changed: + hold +The following packages will be upgraded: + hold +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s + +testfailureequal 'Reading package lists... +Building dependency tree... +The following held packages will be changed: + hold +The following packages will be upgraded: + hold +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +E: Held packages were changed and -y was used without --allow-change-held-packages.' aptget install hold -y -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following held packages will be changed: + hold +The following packages will be upgraded: + hold +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst hold [1] (2 unstable [all]) +Conf hold (2 unstable [all])' aptget install hold -y -s --allow-change-held-packages + +# Test --allow-downgrades + +testfailureequal 'Reading package lists... +Building dependency tree... +The following packages will be DOWNGRADED: + downgrade +0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded. +E: Packages were downgraded and -y was used without --allow-downgrades.' aptget install downgrade=1 -y -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following packages will be DOWNGRADED: + downgrade +0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded. +Inst downgrade [2] (1 unstable [all]) +Conf downgrade (1 unstable [all])' aptget install downgrade=1 --allow-downgrades -y -s diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types index 56cfc9a69..30cc2fc93 100755 --- a/test/integration/test-allow-scores-for-all-dependency-types +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -115,7 +115,7 @@ Inst baz (2 unversioned [amd64]) Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following packages will be REMOVED: bar @@ -139,7 +139,7 @@ Inst baz (2 unversioned [amd64]) Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following packages will be REMOVED: bar diff --git a/test/integration/test-apt-acquire-additional-files b/test/integration/test-apt-acquire-additional-files new file mode 100755 index 000000000..ee7908a2d --- /dev/null +++ b/test/integration/test-apt-acquire-additional-files @@ -0,0 +1,111 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +# note that in --print-uri we talk about .bz2 because that is the default. +# This doesn't mean it is actually attempt to download it. +configcompression '.' 'gz' + +buildsimplenativepackage 'foo' 'amd64' '1' 'unstable' + +setupaptarchive --no-update +changetowebserver + +testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 +'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 +'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 +'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris + +testsuccessequal "Get:1 http://localhost:8080 unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B] +Get:2 http://localhost:8080 unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B] +Get:3 http://localhost:8080 unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B] +Get:4 http://localhost:8080 unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] +Reading package lists..." aptget update + +testempty find rootdir/var/lib/apt/lists -name '*Contents*' + +cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF +Acquire::IndexTargets::deb::Contents { + MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; + ShortDescription "Contents"; + Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; +}; +EOF + +testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget indextargets --no-release-info --format '$(FILENAME)' 'Created-By: Contents' +testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' +# lets fake the existence of a compressed Contents file +touch ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz +testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' + +testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 +'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 +'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 +'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 +'http://localhost:8080/dists/unstable/main/Contents-amd64.bz2' localhost:8080_dists_unstable_main_Contents-amd64 0 " aptget update --print-uris + +testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease +Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] +Reading package lists..." aptget update + +testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' find rootdir/var/lib/apt/lists -name '*Contents*' +testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' +testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' 'aptarchive/dists/unstable/main/Contents-amd64' + +rm ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64 +testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' + +# if we asked for keeping it compressed, keep it +echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true";' >> rootdir/etc/apt/apt.conf.d/content-target.conf +testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease +Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] +Reading package lists..." aptget update + +testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir/var/lib/apt/lists -name '*Contents*' +testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' +testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz' + +rm ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz +testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' + +# and no automatic uncompress based on the name please, +# only if we downloaded a compressed file, but target was uncompressed +cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF +Acquire::IndexTargets::deb::Contents { + MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz"; + ShortDescription "Contents.gz"; + Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz"; +}; +EOF + +# the last line is utter bogus of course, but how should apt know… +testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 +'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 +'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 +'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 +'http://localhost:8080/dists/unstable/main/Contents-amd64.gz.bz2' localhost:8080_dists_unstable_main_Contents-amd64.gz 0 " aptget update --print-uris + +testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease +Get:2 http://localhost:8080 unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] +Reading package lists..." aptget update + +testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir/var/lib/apt/lists -name '*Contents*' +testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' +testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz' + +rm -f rootdir/etc/apt/apt.conf.d/content-target.conf + +testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 +'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 +'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 +'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris + +testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease +Reading package lists..." aptget update + +testempty find rootdir/var/lib/apt/lists -name '*Contents*' diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index 8300c532c..2229e991d 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -11,8 +11,6 @@ insertpackage 'unstable' 'foo' 'all' '1.0' setupaptarchive --no-update -APTARCHIVE=$(readlink -f ./aptarchive) - # make Packages *only* accessable by-hash for this test mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 (cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 && @@ -26,7 +24,7 @@ mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512 ) # we moved the Packages file away, normal update won't work -testfailure aptget upate +testfailure aptget update # ensure we do not know about "foo" testfailureequal "Reading package lists... @@ -36,14 +34,18 @@ E: Unable to locate package foo" aptget install -q -s foo # ensure we can apt-get update by hash testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none -# ensure it works -testsuccessequal "Inst foo (1.0 unstable [all]) +ensureitworks() { + testsuccessequal "Inst foo (1.0 unstable [all]) Conf foo (1.0 unstable [all])" aptget install -qq -s foo +} +ensureitworks # add magic string to Release file ... MAGIC="Acquire-By-Hash: true" sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release signreleasefiles # ... and verify that it fetches by hash now +rm -rf rootdir/var/lib/apt/lists testsuccess aptget update -o Acquire::Languages=none +ensureitworks diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache index f3db8024f..97d180a74 100755 --- a/test/integration/test-apt-cache +++ b/test/integration/test-apt-cache @@ -16,6 +16,9 @@ Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR" insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar Breaks: foo (<< 1) Replaces: foo (<< 1)' "$DESCR" +insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64 +Breaks: foo:amd64 (<< 1) +Replaces: foo:i386 (<< 1)' "$DESCR" setupaptarchive @@ -44,81 +47,136 @@ testsuccess test -s dump.output testsuccessequal 'dpkg bar +specific fancy foo' aptcache pkgnames testsuccessequal 'bar' aptcache pkgnames bar testsuccessequal 'fancy foo' aptcache pkgnames f -testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo +testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main amd64 Packages + foo | 1 | file:$(readlink -f .)/aptarchive unstable/main i386 Packages" aptcache madison foo ### depends testsuccessequal 'foo Depends: bar - |Recommends: <cool> - Recommends: <cooler> Conflicts: <foobar> - Conflicts: <foobar:i386>' aptcache depends foo + |Recommends: <cool> + Recommends: <cooler>' aptcache depends foo testsuccessequal 'foo Depends: bar - Recommends: <cool> Conflicts: <foobar> - Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 + |Recommends: <cool> + Recommends: <cooler>' aptcache depends foo --implicit testsuccessequal 'foo Depends: bar - |Recommends: <cool> (>= 2) - Recommends: <cooler> (<< 5) Conflicts: <foobar> - Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowVersion=1 + Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 testsuccessequal 'foo Depends: bar Conflicts: <foobar> - Conflicts: <foobar:i386>' aptcache depends foo --no-recommends + Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit testsuccessequal 'foo - Depends: bar' aptcache depends foo --important + Depends: bar + Conflicts: <foobar> + |Recommends: <cool> (>= 2) + Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 testsuccessequal 'foo + Depends: bar Conflicts: <foobar> - Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts + |Recommends: <cool> (>= 2) + Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit testsuccessequal 'foo Depends: bar + Conflicts: <foobar>' aptcache depends foo --no-recommends +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit +testsuccessequal 'foo + Depends: bar' aptcache depends foo --important --implicit +testsuccessequal 'foo + Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts +testsuccessequal 'foo + Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit +testsuccessequal 'foo + Depends: bar + Conflicts: <foobar> |Recommends: <cool> Recommends: <cooler> +bar + Depends: bar + Breaks: foo + Replaces: foo +<foobar> +<cool> +<cooler>' aptcache depends foo --recurse +testsuccessequal 'foo + Depends: bar Conflicts: <foobar> - Conflicts: <foobar:i386> + |Recommends: <cool> + Recommends: <cooler> bar Depends: bar Breaks: foo - Breaks: <foo:i386> Replaces: foo + Breaks: <foo:i386> Replaces: <foo:i386> +<foobar> <cool> <cooler> -<foobar> -<foobar:i386> -<foo:i386>' aptcache depends foo --recurse +<foo:i386>' aptcache depends foo --recurse --implicit +testsuccessequal 'foo + Depends: bar +bar + Depends: bar + Replaces: foo' aptcache depends foo --recurse --important --replaces testsuccessequal 'foo Depends: bar bar Depends: bar Replaces: foo Replaces: <foo:i386> -<foo:i386>' aptcache depends foo --recurse --important --replaces +<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit +testsuccessequal 'bar + Depends: bar + Breaks: foo + Replaces: foo' aptcache depends bar +testsuccessequal 'bar + Depends: bar + Breaks: foo + Replaces: foo + Breaks: <foo:i386> + Replaces: <foo:i386>' aptcache depends bar --implicit +testsuccessequal 'specific + Depends: <bar:i386> + Depends: specific:amd64 + Breaks: foo:amd64 + Replaces: <foo:i386>' aptcache depends specific +testsuccessequal 'specific + Depends: <bar:i386> + Depends: specific:amd64 + Breaks: foo:amd64 + Replaces: <foo:i386>' aptcache depends specific --implicit ## rdpends testsuccessequal 'foo Reverse Depends: bar + specific bar' aptcache rdepends foo testsuccessequal 'foo Reverse Depends: - Replaces: bar - Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 + Breaks: bar + Breaks: specific + Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 testsuccessequal 'foo Reverse Depends: - Replaces: bar (<< 1) - Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 + Breaks: bar (<< 1) + Breaks: specific (<< 1) + Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 testsuccessequal 'foo Reverse Depends: - Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks + Breaks: bar (<< 1) + Breaks: specific (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index 34b35f745..ce31b5934 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -38,7 +38,7 @@ aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; } 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 +Please insert a Disc in the drive and press [Enter] Mounting CD-ROM... Scanning disc for index files..." CDROM_POST="This disc is called: @@ -136,13 +136,15 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected msgmsg "ensure an update doesn't mess with cdrom sources" testsuccess aptget update -testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease +Reading package lists...' mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted testcdromusage msgmsg 'and again to check that it withstands the temptation even if it could mount' testsuccess aptget update -testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...' +testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease +Reading package lists...' testcdromusage msgmsg 'Check that nothing touched our' 'CD-ROM' diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show index 43072cf03..5f4ef1b48 100755 --- a/test/integration/test-apt-cli-show +++ b/test/integration/test-apt-cli-show @@ -32,7 +32,7 @@ Maintainer: Joe Sixpack <joe@example.org> Installed-Size: 43.0 kB Download-Size: unknown APT-Manual-Installed: yes -APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages +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-update b/test/integration/test-apt-cli-update index d68ab25e4..dad365f7e 100755 --- a/test/integration/test-apt-cli-update +++ b/test/integration/test-apt-cli-update @@ -13,9 +13,7 @@ insertinstalledpackage 'foo' 'all' '1.0' setupaptarchive --no-update -APTARCHIVE=$(readlink -f ./aptarchive) - -testfailureequal 'E: The update command takes no arguments' apt update -q arguments +testfailuremsg 'E: The update command takes no arguments' apt update arguments testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress index 65c438e8f..bf6a412ad 100755 --- a/test/integration/test-apt-download-progress +++ b/test/integration/test-apt-download-progress @@ -13,7 +13,7 @@ changetohttpswebserver assertprogress() { T="$1" testsuccess grep "dlstatus:1:0:Retrieving file 1 of 1" "$T" - if ! egrep -q "dlstatus:1:[1-9][0-9](\..*)?:Retrieving file 1 of 1" "$T"; then + if ! grep -E -q "dlstatus:1:[1-9][0-9](\..*)?:Retrieving file 1 of 1" "$T"; then cat "$T" msgfail "Failed to detect download progress" fi @@ -24,18 +24,19 @@ assertprogress() { # actually report progress - but not too big to ensure its not delaying the # test too much TESTFILE=testfile.big -testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 +testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1 OPT='-o APT::Status-Fd=3 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 -o Debug::Acquire::https=1' msgtest 'download progress works via' 'http' exec 3> apt-progress.log -testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=800 +testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" ./downloaded/http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=800 assertprogress apt-progress.log msgtest 'download progress works via' 'https' exec 3> apt-progress.log -testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=800 +testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" ./downloaded/https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=800 +assertprogress apt-progress.log # cleanup rm -f apt-progress*.log diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index a0e4d3c24..454b47976 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -27,6 +27,19 @@ The following packages will be REMOVED: po-debconf 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv po-debconf [1.0.16]' aptget autoremove -s +testequal "Reading package lists... +Building dependency tree... +Reading state information... +The following package was automatically installed and is no longer required: + po-debconf +Use 'apt-get autoremove' to remove it. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s +testequal "Reading package lists... +Building dependency tree... +Reading state information... +1 package was automatically installed and is no longer required. +Use 'apt-get autoremove' to remove it. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testdpkginstalled 'po-debconf' echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove @@ -63,6 +76,19 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Remv debhelper [8.0.0] Remv po-debconf [1.0.16]' aptget autoremove -s +testequal "Reading package lists... +Building dependency tree... +Reading state information... +The following packages were automatically installed and are no longer required: + debhelper po-debconf +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s +testequal "Reading package lists... +Building dependency tree... +Reading state information... +2 packages were automatically installed and are no longer required. +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testsuccess aptmark hold debhelper testsuccessequal 'Reading package lists... diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 7e81c71b6..5fa8543b9 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -5,44 +5,98 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'native' -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +buildsimplenativepackage 'foo' 'all' '1.0' 'stable' +buildsimplenativepackage 'libbar' 'all' '1.0' 'stable' + +getlabelfromsuite() { echo 'Testcases'; } +getoriginfromsuite() { echo 'Debian'; } setupaptarchive --no-update changetowebserver testsuccess aptget update -# simulate normal user with non-existent root-owned directories -rm -rf rootdir/var/cache/apt/archives/ -mkdir rootdir/var/cache/apt/archives/ -addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" -chmod -R -w rootdir/var/cache/apt/archives +testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog +'http://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog" aptget changelog foo libbar --print-uris + +releasechanger() { + # modifying the Release files in lists… bad stuff. Good that this is only a test… + sed -i "s#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release') + rm -f rootdir/var/cache/apt/*.bin +} +releasechanger 'Origin' 'Ubuntu' +testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog +'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris + +releasechanger 'Label' 'Debian' +testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog +'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris + +testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0.changelog' foo.changelog +'http://localhost:8080/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian='http://localhost:8080/CHANGEPATH.changelog' + +sed -i '/^Origin: / a\ +Changelogs: http://example.org/CHANGEPATH-changelog' $(find rootdir/var/lib/apt/lists -name '*Release') +rm -f rootdir/var/cache/apt/*.bin -echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf +testsuccessequal "'http://example.org/main/f/foo/foo_1.0-changelog' foo.changelog +'http://example.org/main/libb/libbar/libbar_1.0-changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian='http://localhost:8080/CHANGEPATH.changelog' -testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0.changelog' foo.changelog +'http://localhost:8080/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Override::Label::Debian='http://localhost:8080/CHANGEPATH.changelog' -testsuccessequal "'http://localhost:8080/pool/apt_1.0/changelog' -'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris +releasechanger 'Changelogs' 'no' +testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0 +' aptget changelog foo -qq -d + +sed -i '/^Changelogs: / d' $(find rootdir/var/lib/apt/lists -name '*Release') +releasechanger 'Label' 'Testcases' + +echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/CHANGEPATH/change.txt";' > rootdir/etc/apt/apt.conf.d/changelog.conf +testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0/change.txt' foo.changelog +'http://localhost:8080/main/libb/libbar/libbar_1.0/change.txt' libbar.changelog" aptget changelog foo libbar --print-uris + +echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/pool/CHANGEPATH/changelog";' > rootdir/etc/apt/apt.conf.d/changelog.conf +testsuccessequal "'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo --print-uris cd downloaded -testsuccess aptget changelog apt -qq -testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)" +testsuccess aptget changelog foo -qq +testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" + +testsuccess aptget changelog foo libbar -qq +testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog) +$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" + +testsuccess aptget changelog foo -d +testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" +testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" +rm -f foo.changelog -testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)" -testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" -rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog +testsuccess aptget changelog libbar foo -d +testfilestats 'libbar.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" +testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" +testfileequal 'libbar.changelog' "$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" +testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" +rm -f libbar.changelog foo.changelog -testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \ - -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' +# as such bogus, but can happen with multiple binaries from the same source +testsuccessequal "'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog +'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo foo --print-uris +testsuccess aptget changelog foo foo -qq +testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog) +$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" +testsuccess aptget changelog foo foo -d +testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" +testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" +rm -f foo.changelog -testsuccess aptget changelog apt -d -testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)" -testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" -rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog +# no CHANGEPATH in the URI +testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0 +' aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases='http://localhost:8080/change.txt' +testfailure test -e foo.changelog -testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/' -testfailure test -e apt.changelog +testequal 'E: Failed to fetch http://localhost:8080/does/not/exist/main/f/foo/foo_1.0/change.txt Changelog unavailable for foo=1.0 (404 Not Found) +' aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases='http://localhost:8080/does/not/exist/CHANGEPATH/change.txt' +testfailure test -e foo.changelog diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 6503bbd1c..fa0b65672 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -38,7 +38,7 @@ testdownload() { APT="${APT}/${3}" fi msgtest "Test download of package file $1 with" "$APT" - testsuccess --nomsg aptget download ${APT} + testsuccess --nomsg aptget download ${APT} -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1 testsuccess test -f "$1" rm -f "$1" } diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb index 0f34692fe..bd720bede 100755 --- a/test/integration/test-apt-get-install-deb +++ b/test/integration/test-apt-get-install-deb @@ -5,23 +5,58 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'amd64' 'i386' # regression test for #754904 testfailureequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null -# and ensure we fail for invalid debs -cat > foo.deb <<EOF +# only consider .deb files +cat > foo.rpm <<EOF I'm not a deb, I'm a teapot. EOF +testfailureequal "E: Unable to locate package ./foo.rpm +E: Couldn't find any package by glob './foo.rpm' +E: Couldn't find any package by regex './foo.rpm'" aptget install -qq ./foo.rpm + +# and ensure we fail for invalid debs +mv foo.rpm foo.deb testfailure aptget install ./foo.deb testsuccess grep '^E: Sub-process Popen returned an error code' rootdir/tmp/testfailure.output -testequal 'E: Encountered a section with no Package: header -E: Problem with MergeLister for ./foo.deb -E: The package lists or status file could not be parsed or opened.' tail -n 3 rootdir/tmp/testfailure.output +testequal "E: Encountered a section with no Package: header +E: Problem with MergeList ${TMPWORKINGDIRECTORY}/foo.deb +E: The package lists or status file could not be parsed or opened." tail -n 3 rootdir/tmp/testfailure.output # fakeroot is currently not found, framwork needs updating -buildsimplenativepackage 'foo' 'all' '1.0' +buildsimplenativepackage 'foo' 'i386,amd64' '1.0' + +testfailureequal "Reading package lists... +Building dependency tree... +Note, selecting 'foo:i386' instead of './incoming/foo_1.0_i386.deb' +Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' +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:i386 : Conflicts: foo but 1.0 is to be installed + foo : Conflicts: foo:i386 but 1.0 is to be installed +E: Unable to correct problems, you have held broken packages." aptget install ./incoming/foo_1.0_i386.deb ./incoming/foo_1.0_amd64.deb -s -q=0 + testdpkgnotinstalled 'foo' -testsuccess aptget install ./incoming/foo_1.0_all.deb +testsuccess aptget install ./incoming/foo_1.0_i386.deb -o Debug::pkgCacheGen=1 testdpkginstalled 'foo' + +testsuccessequal "Reading package lists... +Building dependency tree... +Reading state information... +Note, selecting 'foo' instead of './incoming/foo_1.0_amd64.deb' +The following packages will be REMOVED: + foo:i386 +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv foo:i386 [1.0] +Inst foo (1.0 local-deb [amd64]) +Conf foo (1.0 local-deb [amd64])" aptget install ./incoming/foo_1.0_amd64.deb -s -q=0 diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 9db24370f..22f01b997 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -34,43 +34,40 @@ APTARCHIVE=$(readlink -f ./aptarchive) # normal operation gets highest version number HEADER="Reading package lists... Building dependency tree..." +DOWNLOAD1="Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 MD5Sum:b998e085e36cf162e6a33c2801318fef +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 MD5Sum:d46b9a02af8487cbeb49165540c88184" +DOWNLOAD2="Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 11 MD5Sum:c0de572c6f8aa576c8ff78c81132ed55 +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 14 MD5Sum:e10bb487c375b2b938d27bd31c2d1f5f" testsuccessequal "$HEADER -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 +$DOWNLOAD2" aptget source -q --print-uris foo # select by release: suite testsuccessequal "$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 +$DOWNLOAD1" aptget source -q --print-uris foo/stable testsuccessequal "$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 +$DOWNLOAD2" aptget source -q --print-uris foo/unstable # select by release: codename testsuccessequal "$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 +$DOWNLOAD2" aptget source -q --print-uris foo/sid # select by version testsuccessequal "$HEADER -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=1.0 +$DOWNLOAD1" aptget source -q --print-uris foo=1.0 # select by release with no binary package (Bug#731102) but ensure to get # highest version +DOWNLOAD01="Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 11 MD5Sum:0811a4d85238056c613ea897f49f01af +'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 MD5Sum:fa1ecb7a1a53e8e6f6551ca7db888a61" testsuccessequal "$HEADER Selected version '0.1' (wheezy) for foo -Need to get 0 B of source archives. -'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/wheezy +$DOWNLOAD01" aptget source -q --print-uris foo/wheezy # unavailable one testfailureequal "$HEADER @@ -78,11 +75,12 @@ E: Can not find version '9.9-not-there' of package 'foo' E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there # version and release +DOWNLOAD001="Need to get 0 B/29 B of source archives. +'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 13 MD5Sum:6c819ebf0a21b1a480e1dbf6b8edfebd +'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 16 MD5Sum:a3c7e1ac2159fc0faf522e110d6906fd" testsuccessequal "$HEADER -Need to get 0 B of source archives. -'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris -t unstable foo=0.0.1 +$DOWNLOAD001" aptget source -q --print-uris -t unstable foo=0.0.1 testsuccessequal "$HEADER -Need to get 0 B of source archives. +Need to get 0 B/25 B of source archives. Fetch source foo" aptget source -q -s foo diff --git a/test/integration/test-apt-get-source-arch b/test/integration/test-apt-get-source-arch index c75798209..f54bb6012 100755 --- a/test/integration/test-apt-get-source-arch +++ b/test/integration/test-apt-get-source-arch @@ -28,31 +28,30 @@ APTARCHIVE=$(readlink -f ./aptarchive) HEADER="Reading package lists... Building dependency tree..." +DOWNLOAD10="Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 MD5Sum:b998e085e36cf162e6a33c2801318fef +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 MD5Sum:d46b9a02af8487cbeb49165540c88184" # pick :amd64 testsuccessequal "$HEADER -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:amd64 +$DOWNLOAD10" aptget source -q --print-uris foo:amd64 # pick :i386 testsuccessequal "$HEADER -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:i386 +Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 11 MD5Sum:c0de572c6f8aa576c8ff78c81132ed55 +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 14 MD5Sum:e10bb487c375b2b938d27bd31c2d1f5f" aptget source -q --print-uris foo:i386 # pick :i386 by release testsuccessequal "$HEADER Selected version '0.1' (oldstable) for foo -Need to get 0 B of source archives. -'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo:i386/oldstable +Need to get 0 B/25 B of source archives. +'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 11 MD5Sum:0811a4d85238056c613ea897f49f01af +'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 MD5Sum:fa1ecb7a1a53e8e6f6551ca7db888a61" aptget source -q --print-uris foo:i386/oldstable # pick :i386 by version testsuccessequal "$HEADER -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:i386=1.0 +$DOWNLOAD10" aptget source -q --print-uris foo:i386=1.0 # error on unknown arch testfailureequal "$HEADER diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated index 685bc566b..da63f7cb3 100755 --- a/test/integration/test-apt-get-source-authenticated +++ b/test/integration/test-apt-get-source-authenticated @@ -1,7 +1,7 @@ #!/bin/sh # # Regression test for debian bug #749795. Ensure that we fail with -# a error if apt-get source foo will download a source that comes +# an error if apt-get source foo will download a source that comes # from a unauthenticated repository # set -e diff --git a/test/integration/test-apt-get-source-multisources b/test/integration/test-apt-get-source-multisources index 03d0400a0..887a30685 100755 --- a/test/integration/test-apt-get-source-multisources +++ b/test/integration/test-apt-get-source-multisources @@ -20,11 +20,11 @@ APTARCHIVE=$(readlink -f ./aptarchive) HEADER="Reading package lists... Building dependency tree..." testsuccessequal "$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 +Need to get 0 B/43 B of source archives. +'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 22 MD5Sum:255405ab5af211238ef53b7a1dd8ca4b +'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 MD5Sum:740a9dbf02a295932f15b1415d0dc0df" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11 testsuccessequal "$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 +Need to get 0 B/43 B of source archives. +'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 MD5Sum:740a9dbf02a295932f15b1415d0dc0df +'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 22 MD5Sum:255405ab5af211238ef53b7a1dd8ca4b" aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113 diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index 81c01ba3e..4c45f8f26 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -9,6 +9,7 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" +configcompression '.' 'gz' # a "normal" package with source and binary buildsimplenativepackage 'foo' 'all' '2.0' @@ -19,11 +20,13 @@ APTARCHIVE=$(readlink -f ./aptarchive) rm -f $APTARCHIVE/dists/unstable/*Release* # update without authenticated files leads to warning -testfailureequal "Ign file: unstable InRelease +testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease +Ign:1 file:$APTARCHIVE unstable InRelease File not found -Err file: unstable Release +Get:2 file:$APTARCHIVE unstable Release +Err:2 file:$APTARCHIVE unstable Release File not found -W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. +W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository. E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories # no package foo @@ -31,14 +34,51 @@ testsuccessequal 'Listing...' apt list foo testequal 'lock partial' ls rootdir/var/lib/apt/lists +filesize() { + stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz" +} # allow override -testwarningequal "Ign file: unstable InRelease +#aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1 +#exit +testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease +Ign:1 file:$APTARCHIVE unstable InRelease File not found -Ign file: unstable Release +Get:2 file:$APTARCHIVE unstable Release +Ign:2 file:$APTARCHIVE unstable Release File not found +Get:3 file:$APTARCHIVE unstable/main Sources +Ign:3 file:$APTARCHIVE unstable/main Sources + File not found +Get:4 file:$APTARCHIVE unstable/main i386 Packages +Ign:4 file:$APTARCHIVE unstable/main i386 Packages + File not found +Get:5 file:$APTARCHIVE unstable/main Translation-en +Ign:5 file:$APTARCHIVE unstable/main Translation-en + File not found +Get:3 file:$APTARCHIVE unstable/main Sources +Ign:3 file:$APTARCHIVE unstable/main Sources + File not found +Get:4 file:$APTARCHIVE unstable/main i386 Packages +Ign:4 file:$APTARCHIVE unstable/main i386 Packages + File not found +Get:5 file:$APTARCHIVE unstable/main Translation-en +Ign:5 file:$APTARCHIVE unstable/main Translation-en + File not found +Get:3 file:$APTARCHIVE unstable/main Sources +Ign:3 file:$APTARCHIVE unstable/main Sources + File not found +Get:4 file:$APTARCHIVE unstable/main i386 Packages +Ign:4 file:$APTARCHIVE unstable/main i386 Packages + File not found +Get:5 file:$APTARCHIVE unstable/main Translation-en +Ign:5 file:$APTARCHIVE unstable/main Translation-en + File not found +Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B] +Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B] +Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B] Reading package lists... -W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories +W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories # ensure we can not install the package testfailureequal "WARNING: The following packages cannot be authenticated! foo -E: There are problems and -y was used without --force-yes" aptget install -qq -y foo +E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y foo diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 431210797..00d859ad5 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -14,32 +14,32 @@ test_apt_helper_download() { echo 'bar' > aptarchive/foo2 msgtest 'apt-file download-file md5sum' - testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 - testfileequal foo2 'foo' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 + testfileequal ./downloaded/foo2 'foo' msgtest 'apt-file download-file sha1' - testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 - testfileequal foo1 'foo' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 + testfileequal ./downloaded/foo1 'foo' msgtest 'apt-file download-file sha256' - testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c - testfileequal foo3 'foo' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c + testfileequal ./downloaded/foo3 'foo' msgtest 'apt-file download-file no-hash' - testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo4 - testfileequal foo4 'foo' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo4 + testfileequal ./downloaded/foo4 'foo' msgtest 'apt-file download-file wrong hash' - testfailure --nomsg apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc + testfailure --nomsg apthelper -qq download-file http://localhost:8080/foo ./downloaded/foo5 MD5Sum:aabbcc testfileequal rootdir/tmp/testfailure.output 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch E: Download Failed' - testfileequal foo5.FAILED 'foo' + testfileequal ./downloaded/foo5.FAILED 'foo' msgtest 'apt-file download-file md5sum sha1' - testsuccess --nomsg apthelper download-file http://localhost:8080/foo foo6 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 http://localhost:8080/foo2 foo7 SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f - testfileequal foo6 'foo' - testfileequal foo7 'bar' + testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo6 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 http://localhost:8080/foo2 ./downloaded/foo7 SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f + testfileequal ./downloaded/foo6 'foo' + testfileequal ./downloaded/foo7 'bar' } test_apt_helper_detect_proxy() { diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 486acccc8..a1a0d883d 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -13,11 +13,33 @@ cleanplate() { mkdir rootdir/etc/apt/trusted.gpg.d/ } +createlistofkeys() { + while [ -n "$1" ]; do + # gpg 2.1 has a slightly different output format + if grep -q ' rsa2048/' aptkey.list; then + case "$1" in + *Joe*|*Sixpack*) echo 'pub rsa2048/DBAC8DAE 2010-08-18';; + *Rex*|*Expired*) echo 'pub rsa2048/27CE74F9 2013-07-12 [expired: 2013-07-13]';; + *Marvin*|*Paranoid*) echo 'pub rsa2048/528144E2 2011-01-16';; + *) echo 'UNKNOWN KEY';; + esac + else + case "$1" in + *Joe*|*Sixpack*) echo 'pub 2048R/DBAC8DAE 2010-08-18';; + *Rex*|*Expired*) echo 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]';; + *Marvin*|*Paranoid*) echo 'pub 2048R/528144E2 2011-01-16';; + *) echo 'UNKNOWN KEY';; + esac + fi + shift + done +} + testaptkeys() { if ! aptkey list | grep '^pub' > aptkey.list; then echo -n > aptkey.list fi - testfileequal './aptkey.list' "$1" + testfileequal './aptkey.list' "$(createlistofkeys "$@")" } echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub"; @@ -32,16 +54,15 @@ testrun() { msgtest 'Check that paths in finger output are not' 'double-slashed' aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass - - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'Joe Sixpack' testsuccessequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed gpg: Total number processed: 1 gpg: unchanged: 1' aptkey --fakeroot update - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' - + testaptkeys 'Joe Sixpack' testfailure test -e rootdir/etc/apt/trusted.gpg + testsuccess aptkey --fakeroot add ./keys/rexexpired.pub msgtest 'Check if trusted.gpg is created with permissions set to' '0644' if [ "$(stat -c '%a' rootdir/etc/apt/trusted.gpg )" = '644' ]; then @@ -50,8 +71,7 @@ gpg: unchanged: 1' aptkey --fakeroot update msgfail fi - testaptkeys 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] -pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'Rex Expired' 'Joe Sixpack' msgtest 'Check that Sixpack key can be' 'exported' aptkey export 'Sixpack' > aptkey.export @@ -63,17 +83,17 @@ pub 2048R/DBAC8DAE 2010-08-18' msgtest 'Execute update again to trigger removal of' 'Rex Expired key' testsuccess --nomsg aptkey --fakeroot update - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'Joe Sixpack' msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18' + testaptkeys 'Joe Sixpack' testsuccess aptkey --fakeroot del DBAC8DAE testempty aptkey list - msgtest 'Test key removal with' 'lowercase key ID' #keylength somewher between 8byte and short + msgtest 'Test key removal with' 'lowercase key ID' #keylength somewhere between 8byte and short cleanplate cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess --nomsg aptkey --fakeroot del d141dbac8dae @@ -114,22 +134,21 @@ pub 2048R/DBAC8DAE 2010-08-18' cleanplate testsuccess aptkey --fakeroot add ./keys/joesixpack.pub testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/528144E2 2011-01-16' + testaptkeys 'Joe Sixpack' 'Marvin Paranoid' cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse msgtest 'Test key removal with' 'multi key in real file' cleanplate cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - testaptkeys 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'Marvin Paranoid' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ msgtest 'Test key removal with' 'multi key in softlink' cleanplate ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - testaptkeys 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'Marvin Paranoid' testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ testfailure test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ @@ -139,7 +158,7 @@ pub 2048R/528144E2 2011-01-16' cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg testsuccess --nomsg aptkey --fakeroot del DBAC8DAE - testaptkeys 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'Marvin Paranoid' testfailure test -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ @@ -147,37 +166,66 @@ pub 2048R/528144E2 2011-01-16' cleanplate cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/528144E2 2011-01-16' + testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' msgtest 'Test merge-back of' 'added keys' testsuccess --nomsg aptkey adv --batch --yes --import keys/rexexpired.pub - testaptkeys 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] -pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/528144E2 2011-01-16' + testaptkeys 'Rex Expired' 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' msgtest 'Test merge-back of' 'removed keys' testsuccess --nomsg aptkey adv --batch --yes --delete-keys 27CE74F9 - testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/DBAC8DAE 2010-08-18 -pub 2048R/528144E2 2011-01-16' + testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' msgtest 'Test merge-back of' 'removed duplicate keys' testsuccess --nomsg aptkey adv --batch --yes --delete-keys DBAC8DAE - testaptkeys 'pub 2048R/528144E2 2011-01-16' + testaptkeys 'Marvin Paranoid' + + cleanplate + cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg + msgtest 'Test signing a file' 'with a key' + echo 'Verify me. This is my signature.' > signature + testsuccess --nomsg aptkey --quiet --keyring keys/marvinparanoid.pub --secret-keyring keys/marvinparanoid.sec --readonly \ + adv --batch --yes --default-key 'Marvin' --armor --detach-sign --sign --output signature.gpg signature + + + for GPGV in '' 'gpgv' 'gpgv2'; do + echo "APT::Key::GPGVCommand \"$GPGV\";" > rootdir/etc/apt/apt.conf.d/00gpgvcmd + + msgtest 'Test verify a file' 'with all keys' + testsuccess --nomsg aptkey --quiet --readonly verify signature.gpg signature + + msgtest 'Test verify a file' 'with good keyring' + testsuccess --nomsg aptkey --quiet --readonly --keyring keys/testcase-multikey.pub verify signature.gpg signature + + msgtest 'Test fail verify a file' 'with bad keyring' + testfailure --nomsg aptkey --quiet --readonly --keyring keys/joesixpack.pub verify signature.gpg signature + + msgtest 'Test fail verify a file' 'with non-existing keyring' + testfailure --nomsg aptkey --quiet --readonly --keyring keys/does-not-exist.pub verify signature.gpg signature + testfailure test -e keys/does-not-exist.pub + + # note: this isn't how apts gpgv method implements keyid for verify + msgtest 'Test verify a file' 'with good keyid' + testsuccess --nomsg aptkey --quiet --readonly --keyid 'Paranoid' verify signature.gpg signature + + msgtest 'Test fail verify a file' 'with bad keyid' + testfailure --nomsg aptkey --quiet --readonly --keyid 'Sixpack' verify signature.gpg signature + + msgtest 'Test fail verify a file' 'with non-existing keyid' + testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify signature.gpg signature + + msgtest 'Test verify fails on' 'bad file' + echo 'lalalalala' > signature2 + testfailure --nomsg aptkey --quiet --readonly verify signature.gpg signature2 + done } setupgpgcommand() { echo "APT::Key::GPGCommand \"$1\";" > rootdir/etc/apt/apt.conf.d/00gpgcmd - msgtest 'Test that apt-key uses for the following tests command' "$1" - aptkey adv --version >aptkey.version 2>&1 - if grep -q "^Executing: $1 --" aptkey.version; then - msgpass - else - cat aptkey.version - msgfail - fi + msgmsg 'Force tests to be run with' "$1" + testsuccess aptkey --readonly adv --version + cp rootdir/tmp/testsuccess.output aptkey.version + testsuccess grep "^Executing: $1 --" aptkey.version } # run with default (whatever this is) @@ -187,4 +235,3 @@ setupgpgcommand 'gpg' testrun setupgpgcommand 'gpg2' testrun - diff --git a/test/integration/test-apt-move-and-forget-manual-sections b/test/integration/test-apt-move-and-forget-manual-sections new file mode 100755 index 000000000..845444f53 --- /dev/null +++ b/test/integration/test-apt-move-and-forget-manual-sections @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +aptconfig dump --no-empty --format '%v%n' APT::Move-Autobit-Sections > move-autobit.sections +testsuccess grep '^oldlibs$' move-autobit.sections + +buildsimplenativepackage 'libabc' 'amd64' '1' 'stable' '' '' 'libs' +buildsimplenativepackage 'libabc' 'amd64' '2' 'unstable' 'Depends: libdef' '' 'oldlibs' +buildsimplenativepackage 'libdef' 'amd64' '1' 'unstable' '' '' 'libs' +setupaptarchive + +testmarkedauto +testmarkedmanual + +testsuccess aptget install libabc/stable -y +testdpkginstalled 'libabc' +testdpkgnotinstalled 'libdef' + +testmarkedmanual 'libabc' +testmarkedauto + +testsuccess aptget dist-upgrade -y +testdpkginstalled 'libabc' 'libdef' + +testmarkedauto 'libabc' +testmarkedmanual 'libdef' diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections new file mode 100755 index 000000000..9f490a1bd --- /dev/null +++ b/test/integration/test-apt-never-markauto-sections @@ -0,0 +1,86 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +aptconfig dump --no-empty --format '%v%n' APT::Never-MarkAuto-Sections > nevermarkauto.sections +testsuccess grep '^metapackages$' nevermarkauto.sections + +buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg +Recommends: notavailable' '' 'metapackages' +buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg +Recommends: notavailable +Multi-Arch: foreign' '' 'metapackages' +buildsimplenativepackage 'browser' 'amd64' '41' 'stable' +buildsimplenativepackage 'browser' 'amd64' '42' 'unstable' +buildsimplenativepackage 'texteditor' 'amd64' '1' 'stable' +buildsimplenativepackage 'bad-texteditor' 'amd64' '1' 'stable' 'Depends: texteditor +Conflicts: mydesktop-core' +buildsimplenativepackage 'nosection' 'amd64' '1' 'stable' '' '' '<none>' +buildsimplenativepackage 'foreignpkg' 'i386' '1' 'stable' 'Multi-Arch: foreign' +setupaptarchive + +testsuccess aptcache show nosection +testfailure grep 'Section' rootdir/tmp/testsuccess.output +testequal 'dpkg' aptmark showmanual + +testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 + +testmarkedmanual 'dpkg' 'mydesktop' +testmarkedauto 'mydesktop-core' 'foreignpkg:i386' 'texteditor' 'browser' 'nosection' + +# if the remove is from a user, don't do manual-bit passing +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + browser foreignpkg:i386 mydesktop mydesktop-core nosection texteditor +0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded. +Remv mydesktop [1] +Remv mydesktop-core [1] +Remv browser [42] +Remv foreignpkg:i386 [1] +Remv nosection [1] +Remv texteditor [1]' aptget autoremove mydesktop -s + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + mydesktop mydesktop-core texteditor +0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. +Remv mydesktop [1] +Remv mydesktop-core [1] +Remv texteditor [1]' aptget autoremove texteditor -s #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 +testsuccess aptget autoremove texteditor -y + +testdpkgnotinstalled mydesktop mydesktop-core texteditor +testdpkginstalled browser + +testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' +testmarkedauto + +# test that installed/upgraded auto-pkgs are not set to manual + +testsuccess aptget install browser=41 -y --allow-downgrades + +testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection' +testmarkedauto +testsuccess aptmark auto browser +testmarkedauto 'browser' +testsuccess aptmark auto nosection +testmarkedauto 'browser' 'nosection' +testmarkedmanual 'dpkg' 'foreignpkg:i386' + +# nosection should be auto, not manual, but is marked as such by the resolver +# removing mydesktop-core temporally… the resolver should be figuring out here +# that there is no point of removing mydesktop-core as its an unavoidable +# dependency of the user-requested mydesktop + +testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1 + +testmarkedmanual 'dpkg' 'foreignpkg:i386' 'mydesktop' 'nosection' +testmarkedauto 'browser' 'mydesktop-core' 'texteditor' diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index 0c11aba7e..e30d503cb 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -73,8 +73,6 @@ pmstatus:dpkg-exec:75:Running dpkg' # install non-native and ensure we get proper progress info exec 3> apt-progress.log testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3 - -# and compare testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1 dlstatus:1:20:Retrieving file 1 of 1 pmstatus:dpkg-exec:0:Running dpkg diff --git a/test/integration/test-apt-showlist-orgroup-in-recommends b/test/integration/test-apt-showlist-orgroup-in-recommends new file mode 100755 index 000000000..929f7feb9 --- /dev/null +++ b/test/integration/test-apt-showlist-orgroup-in-recommends @@ -0,0 +1,158 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +# simple case +insertinstalledpackage 'aaa' 'all' '1' +insertinstalledpackage 'ddd' 'all' '1' +insertpackage 'unstable' 'aaa' 'all' '1' +insertpackage 'unstable' 'ddd' 'all' '1' +insertpackage 'unstable' 'yyy' 'all' '1' +insertpackage 'unstable' 'zzz' 'all' '1:1' +insertpackage 'unstable' 'simple' 'all' '1' 'Recommends: aaa, bbb +Suggests: ccc, ddd' +insertpackage 'unstable' 'orgroup' 'all' '1' 'Recommends: aaa | bbb +Suggests: ccc | ddd' +insertpackage 'unstable' 'orgroup2' 'all' '1' 'Recommends: xxx | yyy +Suggests: yyy | zzz' +insertpackage 'unstable' 'orgroup3' 'all' '1' 'Recommends: xxx | yyy +Suggests: yyy | zzz' +insertpackage 'unstable' 'orgroup4' 'all' '1' 'Recommends: xxx +Suggests: zzz' +insertpackage 'unstable' 'versionedor' 'all' '1' 'Recommends: aaa (>> 2) | bbb +Suggests: ccc | ddd (>> 2)' + +setupaptarchive + +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + ccc +Recommended packages: + bbb +The following NEW packages will be installed: + simple +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst simple (1 unstable [all]) +Conf simple (1 unstable [all])' aptget install simple -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + ccc +Recommended packages: + aaa bbb +The following packages will be REMOVED: + aaa +The following NEW packages will be installed: + simple +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv aaa [1] +Inst simple (1 unstable [all]) +Conf simple (1 unstable [all])' aptget install simple aaa- -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + orgroup +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup (1 unstable [all]) +Conf orgroup (1 unstable [all])' aptget install orgroup -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Recommended packages: + aaa | bbb +The following packages will be REMOVED: + aaa +The following NEW packages will be installed: + orgroup +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv aaa [1] +Inst orgroup (1 unstable [all]) +Conf orgroup (1 unstable [all])' aptget install orgroup aaa- -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + yyy | zzz +Recommended packages: + xxx | yyy +The following NEW packages will be installed: + orgroup2 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup2 (1 unstable [all]) +Conf orgroup2 (1 unstable [all])' aptget install orgroup2 -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + yyy | zzz +Recommended packages: + xxx | yyy +The following NEW packages will be installed: + orgroup2 orgroup3 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup2 (1 unstable [all]) +Inst orgroup3 (1 unstable [all]) +Conf orgroup2 (1 unstable [all]) +Conf orgroup3 (1 unstable [all])' aptget install orgroup2 orgroup3 -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + yyy | zzz zzz +Recommended packages: + xxx | yyy xxx +The following NEW packages will be installed: + orgroup2 orgroup4 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup2 (1 unstable [all]) +Inst orgroup4 (1 unstable [all]) +Conf orgroup2 (1 unstable [all]) +Conf orgroup4 (1 unstable [all])' aptget install orgroup2 orgroup4 -s --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + yyy (1) + | zzz (1) + zzz (1) +Recommended packages: + xxx + | yyy (1) + xxx +The following NEW packages will be installed: + orgroup2 (1) + orgroup4 (1) +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup2 (1 unstable [all]) +Inst orgroup4 (1 unstable [all]) +Conf orgroup2 (1 unstable [all]) +Conf orgroup4 (1 unstable [all])' aptget install orgroup2 orgroup4 -s -V --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + zzz (1) +Recommended packages: + xxx +The following NEW packages will be installed: + orgroup2 (1) + orgroup4 (1) + yyy (1) +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst orgroup2 (1 unstable [all]) +Inst orgroup4 (1 unstable [all]) +Inst yyy (1 unstable [all]) +Conf orgroup2 (1 unstable [all]) +Conf orgroup4 (1 unstable [all]) +Conf yyy (1 unstable [all])' aptget install orgroup2 orgroup4 yyy -s -V --no-install-recommends +testsuccessequal 'Reading package lists... +Building dependency tree... +Suggested packages: + ccc | ddd +Recommended packages: + aaa | bbb +The following NEW packages will be installed: + versionedor +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst versionedor (1 unstable [all]) +Conf versionedor (1 unstable [all])' aptget install versionedor -s --no-install-recommends diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index d8b2334ad..adfe0e003 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -7,9 +7,8 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'i386' -echo 'APT::Sources::Use-Deb822 "true";' > rootdir/etc/apt/apt.conf.d/00enabledeb822 - -SOURCES='rootdir/etc/apt/sources.list' +LISTS='rootdir/etc/apt/sources.list.d/test.list' +SOURCES='rootdir/etc/apt/sources.list.d/test.sources' BASE='# some comment # that contains a : as well #Types: meep @@ -17,64 +16,101 @@ BASE='# some comment Types: deb URIs: http://ftp.debian.org/debian Suites: stable -Sections: main +Components: 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 +msgcleantest() { + rm -f $LISTS $SOURCES + msgtest "$@" +} -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 +msgcleantest 'Test sources.list' 'old style' +echo "deb http://ftp.debian.org/debian stable main" > $LISTS +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 " aptget update --print-uris + +msgcleantest 'Test sources.list' 'old style with options' +echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0 +'http://ftp.debian.org/debian/dists/stable/main/binary-powerpc/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-powerpc_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 " aptget update --print-uris + +msgcleantest 'Test sources.list' 'old style with comments' +echo "deb http://ftp.debian.org/debian stable main # non-free" > $LISTS +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 " aptget update --print-uris + +msgcleantest 'Test sources.list' 'old style with option comments' +echo "deb [trusted=yes#yeahreally] http://ftp.debian.org/debian stable main # non-free" > $LISTS +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 " aptget update --print-uris +msgcleantest 'Test sources.list' 'simple deb822' +echo "$BASE" > $SOURCES +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 " aptget update --print-uris -msgtest 'Test deb822 with' 'two entries' +msgcleantest '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 +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_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 +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris # two suite entries -msgtest 'Test deb822 with' 'two Suite entries' +msgcleantest '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 +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.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 +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_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 +'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris -msgtest 'Test deb822' 'architecture option' +msgcleantest '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 +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'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) +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris + +msgcleantest 'Test old-style' 'suite arch variable' +echo 'deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/' > $LISTS +testequal --nomsg "'http://ftp.tlh.debian.org/universe/unstable/binary-i386/InRelease' ftp.tlh.debian.org_universe_unstable_binary-i386_InRelease 0 +'http://ftp.tlh.debian.org/universe/unstable/binary-i386/Packages.bz2' ftp.tlh.debian.org_universe_unstable_binary-i386_Packages 0 +'http://ftp.tlh.debian.org/universe/unstable/binary-i386/en.bz2' ftp.tlh.debian.org_universe_unstable_binary-i386_en 0 " aptget update --print-uris + +msgcleantest 'Test deb822' 'suite arch variable' +echo 'Types: deb +URIs: http://ftp.tlh.debian.org/universe +Suites: stable/binary-$(ARCH)/' > $SOURCES +testequal --nomsg "'http://ftp.tlh.debian.org/universe/stable/binary-i386/InRelease' ftp.tlh.debian.org_universe_stable_binary-i386_InRelease 0 +'http://ftp.tlh.debian.org/universe/stable/binary-i386/Packages.bz2' ftp.tlh.debian.org_universe_stable_binary-i386_Packages 0 +'http://ftp.tlh.debian.org/universe/stable/binary-i386/en.bz2' ftp.tlh.debian.org_universe_stable_binary-i386_en 0 " aptget update --print-uris + +msgcleantest 'Test old-style sources.list file which has' 'malformed dist' +echo "deb http://ftp.debian.org" > $LISTS +testequal --nomsg "E: Malformed entry 1 in list file $TMPWORKINGDIRECTORY/$LISTS (Suite) E: The list of sources could not be read." aptget update --print-uris -msgtest 'Test deb822 sources.list file which has' 'malformed URI' +msgcleantest '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) +testequal --nomsg "E: Malformed entry 1 in sources file $TMPWORKINGDIRECTORY/$SOURCES (URI) E: The list of sources could not be read." aptget update --print-uris # with Enabled: false @@ -83,30 +119,30 @@ echo "Enabled: no" >> $SOURCES testempty aptget update --print-uris # multiple URIs -msgtest 'Test deb822 sources.list file which has' 'Multiple URIs work' +msgcleantest '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 +testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0 +'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/InRelease' ftp.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 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris # multiple Type in one field -msgtest 'Test deb822 sources.list file which has' 'Multiple Types work' +msgcleantest '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 +testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'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 +'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris # a Suite -msgtest 'Test deb822 sources.list file which has' 'a exact path and no sections' +msgcleantest 'Test deb822 sources.list file which has' 'an 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 +testequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 +'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 " aptget update --print-uris diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages index 440fd30cf..ec2e1e43b 100755 --- a/test/integration/test-apt-translation-has-no-packages +++ b/test/integration/test-apt-translation-has-no-packages @@ -37,5 +37,5 @@ testsuccessequal "foo: Installed: (none) Candidate: 1.0 Version table: - 1.0 0 - 500 file:$APTARCHIVE/ unstable/main amd64 Packages" aptcache policy foo + 1.0 500 + 500 file:$APTARCHIVE unstable/main amd64 Packages" aptcache policy foo diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size index 55a5da848..24ca85133 100755 --- a/test/integration/test-apt-update-expected-size +++ b/test/integration/test-apt-update-expected-size @@ -26,7 +26,9 @@ test_inreleasetoobig() { } test_packagestoobig() { - redatereleasefiles '+1hour' + insertpackage 'unstable' 'foo' 'all' '1.0' + buildaptarchivefromfiles '+1 hour' + signreleasefiles # append junk at the end of the Packages.gz/Packages SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" find aptarchive/dists -name 'Packages*' | while read pkg; do @@ -35,7 +37,7 @@ test_packagestoobig() { done NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)" testfailuremsg "W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE) -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::Transaction=0 +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::Transaction=0 } methodtest() { diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file index 1ecf9a38a..94b604f0e 100755 --- a/test/integration/test-apt-update-file +++ b/test/integration/test-apt-update-file @@ -22,14 +22,33 @@ addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;' chmod 550 aptarchive/dists/unstable/main/binary-amd64 testsuccess aptget update + +# the release files aren't an IMS-hit, but the indexes are +redatereleasefiles '+1 hour' + +# we don't download the index if it isn't updated testsuccess aptget update -o Debug::pkgAcquire::Auth=1 +# file:/ isn't shown in the log, so see if it was downloaded anyhow cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output +canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" +testfailure grep -- "$canary" rootdir/tmp/update.output + +testfoo() { + # foo is still available + testsuccess aptget install -s foo + testsuccess aptcache showsrc foo + testsuccess aptget source foo --print-uris +} +testfoo -# ensure that the hash of the uncompressed file was verified even on a local ims hit +# the release file is new again, the index still isn't, but it is somehow gone now from disk +redatereleasefiles '+2 hour' +find rootdir/var/lib/apt/lists -name '*_Packages*' -delete + +testsuccess aptget update -o Debug::pkgAcquire::Auth=1 +# file:/ isn't shown in the log, so see if it was downloaded anyhow +cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')" testsuccess grep -- "$canary" rootdir/tmp/update.output -# foo is still available -testsuccess aptget install -s foo -testsuccess aptcache showsrc foo -testsuccess aptget source foo --print-uris +testfoo diff --git a/test/integration/test-apt-update-filesize-mismatch b/test/integration/test-apt-update-filesize-mismatch index f78b83b5f..a23c03c3f 100755 --- a/test/integration/test-apt-update-filesize-mismatch +++ b/test/integration/test-apt-update-filesize-mismatch @@ -40,7 +40,7 @@ for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver. testfailure aptget update -o Debug::pkgAcquire::Worker=1 cp rootdir/tmp/testfailure.output rootdir/tmp/update.output - testsuccess grep -E "$(basename -s '.gz' "$COMPRESSFILE").*Hash Sum mismatch" rootdir/tmp/update.output + testsuccess grep -E "$(basename "$COMPRESSFILE" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output testfailure aptcache show foo testfailure aptget install foo -s diff --git a/test/integration/test-apt-update-hashsum-mismatch b/test/integration/test-apt-update-hashsum-mismatch index c2c5b3887..4627f7afd 100755 --- a/test/integration/test-apt-update-hashsum-mismatch +++ b/test/integration/test-apt-update-hashsum-mismatch @@ -35,7 +35,7 @@ for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver. testfailure aptget update cp rootdir/tmp/testfailure.output rootdir/tmp/update.output - testsuccess grep -E "$(basename -s '.gz' "$get").*Hash Sum mismatch" rootdir/tmp/update.output + testsuccess grep -E "$(basename "$get" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output testfailure aptcache show foo testfailure aptget install foo -s diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims index 7385e701a..33b4ed1b9 100755 --- a/test/integration/test-apt-update-ims +++ b/test/integration/test-apt-update-ims @@ -43,7 +43,7 @@ runtest() { testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" # ensure that we still do a hash check for other files on ims hit of Release - if grep -q '^Hit .* InRelease$' expected.output || ! grep -q '^Ign .* Release\(\.gpg\)\?$' expected.output; then + if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then $TEST aptget update -o Debug::Acquire::gpgv=1 cp rootdir/tmp/${TEST}.output goodsign.output testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" @@ -55,7 +55,7 @@ runtest() { } msgmsg 'InRelease' -EXPECT='Hit http://localhost:8080 unstable InRelease +EXPECT='Hit:1 http://localhost:8080 unstable InRelease Reading package lists...' echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest @@ -63,9 +63,9 @@ echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest msgmsg 'Release/Release.gpg' -EXPECT='Ign http://localhost:8080 unstable InRelease +EXPECT='Ign:1 http://localhost:8080 unstable InRelease 404 Not Found -Hit http://localhost:8080 unstable Release +Hit:2 http://localhost:8080 unstable Release Reading package lists...' find aptarchive -name 'InRelease' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex @@ -74,10 +74,10 @@ echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest msgmsg 'Release only' -EXPECT="Ign http://localhost:8080 unstable InRelease +EXPECT="Ign:1 http://localhost:8080 unstable InRelease 404 Not Found -Hit http://localhost:8080 unstable Release -Ign http://localhost:8080 unstable Release.gpg +Hit:2 http://localhost:8080 unstable Release +Ign:3 http://localhost:8080 unstable Release.gpg 404 Not Found Reading package lists... W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated." @@ -96,7 +96,7 @@ Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \; signreleasefiles msgmsg 'expired InRelease' -EXPECT='Hit http://localhost:8080 unstable InRelease +EXPECT='Hit:1 http://localhost:8080 unstable InRelease E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied.' echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'failure' @@ -104,9 +104,9 @@ echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'failure' msgmsg 'expired Release/Release.gpg' -EXPECT='Ign http://localhost:8080 unstable InRelease +EXPECT='Ign:1 http://localhost:8080 unstable InRelease 404 Not Found -Hit http://localhost:8080 unstable Release +Hit:2 http://localhost:8080 unstable Release E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied.' find aptarchive -name 'InRelease' -delete echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex @@ -115,10 +115,10 @@ echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex runtest 'failure' msgmsg 'expired Release only' -EXPECT="Ign http://localhost:8080 unstable InRelease +EXPECT="Ign:1 http://localhost:8080 unstable InRelease 404 Not Found -Hit http://localhost:8080 unstable Release -Ign http://localhost:8080 unstable Release.gpg +Hit:2 http://localhost:8080 unstable Release +Ign:3 http://localhost:8080 unstable Release.gpg 404 Not Found W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated. E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." @@ -130,13 +130,31 @@ runtest 'failure' 'warning' msgmsg 'no Release at all' -EXPECT="Ign http://localhost:8080 unstable InRelease +EXPECT="Ign:1 http://localhost:8080 unstable InRelease 404 Not Found -Ign http://localhost:8080 unstable Release +Ign:2 http://localhost:8080 unstable Release 404 Not Found -Hit http://localhost:8080 unstable/main Sources -Hit http://localhost:8080 unstable/main amd64 Packages -Hit http://localhost:8080 unstable/main Translation-en +Ign:3 http://localhost:8080 unstable/main Sources + 404 Not Found +Ign:4 http://localhost:8080 unstable/main amd64 Packages + 404 Not Found +Ign:5 http://localhost:8080 unstable/main Translation-en + 404 Not Found +Ign:3 http://localhost:8080 unstable/main Sources + 404 Not Found +Ign:4 http://localhost:8080 unstable/main amd64 Packages + 404 Not Found +Ign:5 http://localhost:8080 unstable/main Translation-en + 404 Not Found +Ign:3 http://localhost:8080 unstable/main Sources + 404 Not Found +Ign:4 http://localhost:8080 unstable/main amd64 Packages + 404 Not Found +Ign:5 http://localhost:8080 unstable/main Translation-en + 404 Not Found +Hit:3 http://localhost:8080 unstable/main Sources +Hit:4 http://localhost:8080 unstable/main amd64 Packages +Hit:5 http://localhost:8080 unstable/main Translation-en Reading package lists... W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." find aptarchive -name '*Release*' -delete diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index db4430ea3..6e9db2cae 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -28,11 +28,12 @@ Description: an autogenerated evil package EOF # avoid ims hit touch -d '+1hour' aptarchive/dists/unstable/main/binary-i386/Packages + compressfile aptarchive/dists/unstable/main/binary-i386/Packages } assert_update_is_refused_and_last_good_state_used() { - testfailuremsg "E: The repository 'file: unstable Release' is no longer signed." aptget update + testfailuremsg "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update assert_repo_is_intact } @@ -87,20 +88,20 @@ test_from_inrelease_to_unsigned_with_override() { # setup archive with InRelease file setupaptarchive_with_lists_clean - # FIXME: is not what the server reported 4104 4106 - testsuccess aptget update #-o Debug::pkgAcquire::Worker=1 + testsuccess aptget update # simulate moving to a unsigned but otherwise valid repo simulate_mitm_and_inject_evil_package - generatereleasefiles + generatereleasefiles '+2 hours' + find $APTARCHIVE -name '*Packages*' -exec touch -d '+2 hours' {} \; # and ensure we can update to it (with enough force) testwarning aptget update --allow-insecure-repositories \ - -o Acquire::AllowDowngradeToInsecureRepositories=1 + -o Acquire::AllowDowngradeToInsecureRepositories=1 -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1 # but that the individual packages are still considered untrusted testfailureequal "WARNING: The following packages cannot be authenticated! evil -E: There are problems and -y was used without --force-yes" aptget install -qq -y evil +E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y evil } test_cve_2012_0214() @@ -150,9 +151,8 @@ test_subvert_inrelease() # replace InRelease with something else mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease - testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature - -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + testfailuremsg "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update # ensure we keep the repo testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -167,13 +167,11 @@ test_inrelease_to_invalid_inrelease() listcurrentlistsdirectory > lists.before # now remove InRelease and subvert Release do no longer verify - sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease + sed -i 's/^Codename:.*/Codename: evil!/' $APTARCHIVE/dists/unstable/InRelease inject_evil_package - testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> - + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> - W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure we keep the repo @@ -194,10 +192,8 @@ test_release_gpg_to_invalid_release_release_gpg() echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release inject_evil_package - testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> - + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable Release: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> - W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfailure grep 'evil' rootdir/var/lib/apt/lists/*Release diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified index b1d55c156..3f822586a 100755 --- a/test/integration/test-apt-update-not-modified +++ b/test/integration/test-apt-update-not-modified @@ -14,26 +14,47 @@ setupaptarchive --no-update methodtest() { msgmsg 'Test InRelease with' "$1" rm -rf rootdir/var/lib/apt/lists + cp -a aptarchive/dists aptarchive/dists.good # get our cache populated testsuccess aptget update listcurrentlistsdirectory > listsdir.lst # hit again with a good cache - testsuccessequal "Hit $1 unstable InRelease + testsuccessequal "Hit:1 $1 unstable InRelease Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" # drop an architecture, which means the file should be gone now configarchitecture 'i386' sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst - testsuccessequal "Hit $1 unstable InRelease + testsuccessequal "Hit:1 $1 unstable InRelease Reading package lists..." aptget update testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" - # readd arch so its downloaded again + # readd arch so its downloaded again… configarchitecture 'amd64' 'i386' - testsuccessequal "Hit $1 unstable InRelease -Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] + # … but oh noes, hashsum mismatch! + find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete + cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF + +Package: thisisbad +Architecture: amd64 +Version: 1 +EOF + compressfile aptarchive/dists/unstable/main/binary-amd64/Packages + testfailureequal "Hit:1 $1 unstable InRelease +Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Err:2 $1 unstable/main amd64 Packages + Hash Sum mismatch +W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update + testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists + + # … now everything is fine again + testsuccessequal "Hit:1 $1 unstable InRelease +Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" @@ -46,48 +67,89 @@ Reading package lists..." aptget update msgmsg 'Test Release.gpg with' "$1" rm -rf rootdir/var/lib/apt/lists - cp -a aptarchive/dists aptarchive/dists.good find aptarchive/dists -name 'InRelease' -delete # get our cache populated testsuccess aptget update listcurrentlistsdirectory > listsdir.lst # hit again with a good cache - testsuccessequal "Ign $1 unstable InRelease + testsuccessequal "Ign:1 $1 unstable InRelease 404 Not Found -Hit $1 unstable Release +Hit:2 $1 unstable Release Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" # drop an architecture, which means the file should be gone now configarchitecture 'i386' sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst - testsuccessequal "Ign $1 unstable InRelease + testsuccessequal "Ign:1 $1 unstable InRelease 404 Not Found -Hit $1 unstable Release +Hit:2 $1 unstable Release Reading package lists..." aptget update testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" - # readd arch so its downloaded again + # readd arch so its downloaded again… configarchitecture 'amd64' 'i386' - testsuccessequal "Ign $1 unstable InRelease + # … but oh noes, hashsum mismatch! + find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete + cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF + +Package: thisisbad +Architecture: amd64 +Version: 1 +EOF + compressfile aptarchive/dists/unstable/main/binary-amd64/Packages + testfailureequal "Ign:1 $1 unstable InRelease + 404 Not Found +Hit:2 $1 unstable Release +Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Err:4 $1 unstable/main amd64 Packages + Hash Sum mismatch +W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update + testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists + find aptarchive/dists -name 'InRelease' -delete + + # … now everything is fine again + testsuccessequal "Ign:1 $1 unstable InRelease 404 Not Found -Hit $1 unstable Release -Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Hit:2 $1 unstable Release +Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] Reading package lists..." aptget update testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" webserverconfig 'aptwebserver::support::modified-since' 'false' webserverconfig 'aptwebserver::support::last-modified' 'false' - testsuccessequal "Ign $1 unstable InRelease + testsuccessequal "Ign:1 $1 unstable InRelease 404 Not Found -Get:1 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] +Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] Reading package lists..." aptget update webserverconfig 'aptwebserver::support::modified-since' 'true' webserverconfig 'aptwebserver::support::last-modified' 'true' rm -rf aptarchive/dists cp -a aptarchive/dists.good aptarchive/dists + + # new release file, but the indexes are the same + redatereleasefiles '+2 hours' + + rm -rf rootdir/var/lib/apt/lists.good + cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good + testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] +Reading package lists..." aptget update + + rm -rf rootdir/var/lib/apt/lists + cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists + find rootdir/var/lib/apt/lists -name '*_Packages*' -delete + testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] +Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] +Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B] +Reading package lists..." aptget update + + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists } changetowebserver diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback index b464a04a1..503b81985 100755 --- a/test/integration/test-apt-update-rollback +++ b/test/integration/test-apt-update-rollback @@ -60,8 +60,7 @@ test_inrelease_to_broken_hash_reverts_all() { break_repository_sources_index '+1hour' # test the error condition - testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch - + testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources.gz Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure that the Packages file is also rolled back testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -78,7 +77,7 @@ test_inrelease_to_valid_release() { rm $APTARCHIVE/dists/unstable/Release.gpg # update fails - testfailureequal "E: The repository 'file: unstable Release' is no longer signed." aptget update -qq + testfailureequal "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update -qq # test that security downgrade was not successful testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -101,7 +100,7 @@ test_inrelease_to_release_reverts_all() { break_repository_sources_index '+1hour' # ensure error - testfailureequal "E: The repository 'file: unstable Release' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 + testfailureequal "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1 # ensure that the Packages file is also rolled back testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -121,21 +120,20 @@ test_unauthenticated_to_invalid_inrelease() { listcurrentlistsdirectory > lists.before testfailureequal "WARNING: The following packages cannot be authenticated! old -E: There are problems and -y was used without --force-yes" aptget install -qq -y old +E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y old # go to authenticated but not correct add_new_package '+1hour' break_repository_sources_index '+1hour' - testfailureequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch - + testfailureequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources.gz Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfileequal lists.before "$(listcurrentlistsdirectory)" testfailure ls rootdir/var/lib/apt/lists/*_InRelease testfailureequal "WARNING: The following packages cannot be authenticated! old -E: There are problems and -y was used without --force-yes" aptget install -qq -y old +E: There were unauthenticated packages and -y was used without --allow-unauthenticated" aptget install -qq -y old } test_inrelease_to_unauth_inrelease() { @@ -144,10 +142,8 @@ test_inrelease_to_unauth_inrelease() { signreleasefiles 'Marvin Paranoid' - testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 - + testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2 - W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq testfileequal lists.before "$(listcurrentlistsdirectory)" @@ -158,7 +154,10 @@ test_inrelease_to_broken_gzip() { msgmsg "Test InRelease to broken gzip" start_with_good_inrelease - redatereleasefiles '+2hours' + break_repository_sources_index '+1hour' + generatereleasefiles '+2hours' + signreleasefiles + # append junk at the end of the compressed file echo "lala" >> $APTARCHIVE/dists/unstable/main/source/Sources.gz touch -d '+2min' $APTARCHIVE/dists/unstable/main/source/Sources.gz @@ -166,6 +165,7 @@ test_inrelease_to_broken_gzip() { rm $APTARCHIVE/dists/unstable/main/source/Sources testfailure aptget update + testsuccess grep 'Hash Sum mismatch' rootdir/tmp/testfailure.output testfileequal lists.before "$(listcurrentlistsdirectory)" } diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale index 05154641a..8a2703fd1 100755 --- a/test/integration/test-apt-update-stale +++ b/test/integration/test-apt-update-stale @@ -18,7 +18,7 @@ setupaptarchive --no-update changetowebserver echo "Acquire::Languages \"none\";" > rootdir/etc/apt/apt.conf.d/00nolanguages -testsuccess aptget update +testsuccess aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 listcurrentlistsdirectory > lists.before # insert new version @@ -26,7 +26,7 @@ mkdir aptarchive/dists/unstable/main/binary-i386/saved cp -p aptarchive/dists/unstable/main/binary-i386/Packages* \ aptarchive/dists/unstable/main/binary-i386/saved insertpackage 'unstable' 'foo' 'all' '2.0' - +touch -d '+1 hour' aptarchive/dists/unstable/main/binary-i386/Packages compressfile aptarchive/dists/unstable/main/binary-i386/Packages # ensure that we do not get a I-M-S hit for the Release file @@ -39,7 +39,6 @@ cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \ aptarchive/dists/unstable/main/binary-i386/ # ensure this raises an error -testfailureequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch - -E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq +testfailuremsg "W: Failed to fetch copy:$(readlink -f ./rootdir)/var/lib/apt/lists/localhost:8080_dists_unstable_main_binary-i386_Packages Hash Sum mismatch +E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 testfileequal lists.before "$(listcurrentlistsdirectory)" diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions index 63b318056..a5dac1737 100755 --- a/test/integration/test-apt-update-transactions +++ b/test/integration/test-apt-update-transactions @@ -8,6 +8,7 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'i386' +configcompression '.' 'gz' insertpackage 'unstable' 'foo' 'all' '1.0' insertsource 'unstable' 'foo' 'all' '1.0' @@ -15,7 +16,8 @@ insertsource 'unstable' 'foo' 'all' '1.0' setupaptarchive --no-update breakfile() { - mv "$1" "${1}.bak" + mv "${1}" "${1}.bak" + mv "${1}.gz" "${1}.gz.bak" cat > "$1" <<EOF Package: bar EOF @@ -23,9 +25,16 @@ EOF } restorefile() { mv "${1}.bak" "$1" + mv "${1}.gz.bak" "${1}.gz" } testrun() { + rm -rf aptarchive/dists.good + cp -a aptarchive/dists aptarchive/dists.good + insertpackage 'unstable' 'bar' 'all' '1.0' + insertsource 'unstable' 'bar' 'all' '1.0' + buildaptarchivefromfiles '+1 hour' + # produce an unsigned repository find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete testfailure aptget update --no-allow-insecure-repositories @@ -34,29 +43,36 @@ testrun() { # signed but broken signreleasefiles + onehashbroken() { + testfailure aptget update + # each file generates two messages with this string + testequal '2' grep --count 'Hash Sum mismatch' rootdir/tmp/testfailure.output + testfileequal "$1" "$(listcurrentlistsdirectory)" + } + breakfile aptarchive/dists/unstable/main/binary-i386/Packages - testfailure aptget update - testfileequal "$1" "$(listcurrentlistsdirectory)" + onehashbroken "$1" restorefile aptarchive/dists/unstable/main/binary-i386/Packages breakfile aptarchive/dists/unstable/main/source/Sources - testfailure aptget update - testfileequal "$1" "$(listcurrentlistsdirectory)" + onehashbroken "$1" restorefile aptarchive/dists/unstable/main/source/Sources + + rm -rf aptarchive/dists + cp -a aptarchive/dists.good aptarchive/dists } testsetup() { msgmsg 'Test with no initial data over' "$1" - redatereleasefiles 'now' rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists/partial listcurrentlistsdirectory > listsdir.lst testrun 'listsdir.lst' msgmsg 'Test with initial data over' "$1" - testsuccess aptget update + rm -rf rootdir/var/lib/apt/lists + testsuccess aptget update -o Debug::pkgAcquire::Worker=1 listcurrentlistsdirectory > listsdir.lst - redatereleasefiles '+1hour' testrun 'listsdir.lst' } diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing index f5a5b123e..701b10c3e 100755 --- a/test/integration/test-architecture-specification-parsing +++ b/test/integration/test-architecture-specification-parsing @@ -28,7 +28,7 @@ setupaptarchive testsuccessequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: foo pkg-arch-foo @@ -48,7 +48,7 @@ Conf pkg-arch-no-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-no-foo -s testsuccessequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: foo pkg-arch-foo-unrelated-no @@ -60,7 +60,7 @@ Conf pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])" aptget install pkg-arch testsuccessequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: foo pkg-arch-foo-unrelated-no2 diff --git a/test/integration/test-bug-470115-new-and-tighten-recommends b/test/integration/test-bug-470115-new-and-tighten-recommends index 0970e2f23..3c159811d 100755 --- a/test/integration/test-bug-470115-new-and-tighten-recommends +++ b/test/integration/test-bug-470115-new-and-tighten-recommends @@ -49,7 +49,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following packages will be upgraded: cool tighten-cool @@ -61,7 +61,7 @@ Conf tighten-cool (2 unstable [all])' aptget install tighten-cool -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: stuff The following packages will be upgraded: stuff tighten-coolorstuff @@ -73,7 +73,7 @@ Conf tighten-coolorstuff (2 unstable [all])' aptget install tighten-coolorstuff testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following packages will be upgraded: cool tighten-coolorstuff2 @@ -85,7 +85,7 @@ Conf tighten-coolorstuff2 (2 unstable [all])' aptget install tighten-coolorstuff testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following packages will be upgraded: cool newrec-cool @@ -97,7 +97,7 @@ Conf newrec-cool (2 unstable [all])' aptget install newrec-cool -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: super The following NEW packages will be installed: super @@ -111,7 +111,7 @@ Conf super (2 unstable [all])' aptget install newrec-super -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following packages will be upgraded: cool newrec-coolorstuff @@ -123,7 +123,7 @@ Conf newrec-coolorstuff (2 unstable [all])' aptget install newrec-coolorstuff -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: stuff The following packages will be upgraded: cool-gone stuff @@ -135,7 +135,7 @@ Conf stuff (2 unstable [all])' aptget install cool-gone -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: super The following NEW packages will be installed: super @@ -151,7 +151,7 @@ Conf super-overtake (2 unstable [all])' aptget install super-overtake -s # the first option in an or-group should be the preferred one… testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following packages will be upgraded: cool upgrade-over-new @@ -165,6 +165,8 @@ Conf upgrade-over-new (2 unstable [all])' aptget install upgrade-over-new -s # the user doesn't seem to need it so avoid upgrading it testsuccessequal 'Reading package lists... Building dependency tree... +Recommended packages: + cool The following packages will be upgraded: now-satisfiable 1 upgraded, 0 newly installed, 0 to remove and 12 not upgraded. diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin index e59231608..435b6876e 100755 --- a/test/integration/test-bug-543966-downgrade-below-1000-pin +++ b/test/integration/test-bug-543966-downgrade-below-1000-pin @@ -13,15 +13,15 @@ insertinstalledpackage 'base-files' 'all' '5.0.0-1' setupaptarchive STATUS=$(readlink -f rootdir/var/lib/dpkg/status) -APTARCHIVE="$(readlink -f aptarchive)/" +APTARCHIVE="$(readlink -f aptarchive)" testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 Version table: - *** 5.0.0-1 0 + *** 5.0.0-1 100 100 $STATUS - 5.0.0 0 + 5.0.0 500 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=0 writepin() { @@ -33,21 +33,18 @@ Pin-Priority: $2" > rootdir/etc/apt/preferences testpinning() { - local PKGPIN='' - local PKGPINPRIO='0' + local PKGPINPRIO='' local REPPINPRIO='' if [ "$1" != '*' ]; then PKGPINPRIO='' REPPINPRIO=' 500' - PKGPIN='Package pin: 5.0.0 - ' fi writepin "$1" '99' testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - ${PKGPIN}Version table: - *** 5.0.0-1 ${PKGPINPRIO:-99} + Version table: + *** 5.0.0-1 100 100 $STATUS 5.0.0 ${PKGPINPRIO:-99} ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99 @@ -56,8 +53,8 @@ testpinning() { testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - ${PKGPIN}Version table: - *** 5.0.0-1 ${PKGPINPRIO:-100} + Version table: + *** 5.0.0-1 100 100 $STATUS 5.0.0 ${PKGPINPRIO:-100} ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100 @@ -66,8 +63,8 @@ testpinning() { testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0-1 - ${PKGPIN}Version table: - *** 5.0.0-1 ${PKGPINPRIO:-999} + Version table: + *** 5.0.0-1 100 100 $STATUS 5.0.0 ${PKGPINPRIO:-999} ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999 @@ -76,8 +73,8 @@ testpinning() { testsuccessequal "base-files: Installed: 5.0.0-1 Candidate: 5.0.0 - ${PKGPIN}Version table: - *** 5.0.0-1 ${PKGPINPRIO:-1000} + Version table: + *** 5.0.0-1 100 100 $STATUS 5.0.0 ${PKGPINPRIO:-1000} ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000 diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index 3ff4807de..1d969fea2 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -19,6 +19,8 @@ Building dependency tree... MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected Package 'extracoolstuff' is not installed, so not removed +Recommended packages: + extracoolstuff The following NEW packages will be installed: coolstuff 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages index 3bd7d436e..4e2a5142c 100755 --- a/test/integration/test-bug-590041-prefer-non-virtual-packages +++ b/test/integration/test-bug-590041-prefer-non-virtual-packages @@ -45,7 +45,7 @@ EOF setupaptarchive -testshowvirtual libc6:i386 +testnopackage libc6:i386 testsuccessequal "$pkglibc6" aptcache show libc6:armel testsuccessequal "$pkglibc6" aptcache show libc6 testsuccessequal "$pkglibdb1" aptcache show libdb1:i386 diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index bca07268c..0c02aee30 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -12,8 +12,8 @@ setupflataptarchive testaptgetupdate() { rm -rf rootdir/var/lib/apt - aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true - sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff + aptget update >testaptgetupdate.diff 2>&1 || true + sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff GIVEN="$1" shift msgtest "Test for correctness of" "apt-get update with $*" @@ -27,9 +27,6 @@ testaptgetupdate() { createemptyarchive() { find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete - if [ "en" = "$1" ]; then - echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS - fi touch aptarchive/Packages echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS generatereleasefiles @@ -39,9 +36,6 @@ createemptyarchive() { createemptyfile() { find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete - if [ "en" = "$1" ]; then - echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS - fi touch aptarchive/Packages aptarchive/${1}.$COMPRESS generatereleasefiles signreleasefiles @@ -49,24 +43,18 @@ createemptyfile() { } testoverfile() { + local APTARCHIVE="$(readlink -f ./aptarchive)" forcecompressor "$1" - createemptyfile 'en' - testaptgetupdate 'Reading package lists...' "empty file en.$COMPRESS over file" - - createemptyarchive 'en' - testaptgetupdate 'Reading package lists...' "empty archive en.$COMPRESS over file" - createemptyarchive 'Packages' - # FIXME: Why omits the file transport the Packages Get line? - #Get:3 file: Packages [] - testaptgetupdate 'Reading package lists...' "empty archive Packages.$COMPRESS over file" + testaptgetupdate "Get:2 file:$APTARCHIVE Packages [] +Reading package lists..." "empty archive Packages.$COMPRESS over file" createemptyfile 'Packages' - testaptgetupdate "Err file: Packages + testaptgetupdate "Get:2 file:$APTARCHIVE Packages +Err:2 file:$APTARCHIVE Packages Empty files can't be valid archives -W: Failed to fetch ${COMPRESSOR}:$(readlink -f aptarchive/Packages.$COMPRESS) Empty files can't be valid archives - +W: Failed to fetch ${COMPRESSOR}:${APTARCHIVE}/Packages.$COMPRESS Empty files can't be valid archives E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file" } @@ -74,16 +62,15 @@ testoverhttp() { forcecompressor "$1" createemptyarchive 'Packages' - testaptgetupdate "Get: http://localhost:8080 Packages [] + testaptgetupdate "Get:2 http://localhost:8080 Packages [] Reading package lists..." "empty archive Packages.$COMPRESS over http" createemptyfile 'Packages' #FIXME: we should response with a good error message instead - testaptgetupdate "Get: http://localhost:8080 Packages -Err http://localhost:8080 Packages + testaptgetupdate "Get:2 http://localhost:8080 Packages +Err:2 http://localhost:8080 Packages Empty files can't be valid archives W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages.${COMPRESS}) Empty files can't be valid archives - E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http" } diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 4eb77b9a4..94f280b81 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -15,16 +15,20 @@ aptgetupdate() { ${1:-testwarning} aptget update --allow-insecure-repositories } -PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" -DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list' +PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)" +DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)" +PKGTEXT="$(echo "$PKGTEXT" | head -n 7)" +DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-*.list' testsuccessequal "$PKGTEXT +$DOWNLOG Download complete and in download only mode" aptget install cool --assume-no -d testsuccessequal "$PKGTEXT +$DOWNLOG Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated -sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE +sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=no] #' $DEBFILE aptgetupdate 'testsuccess' testfailureequal "$PKGTEXT @@ -33,8 +37,17 @@ WARNING: The following packages cannot be authenticated! Install these packages without verification? [y/N] N E: Some packages could not be authenticated" aptget install cool --assume-no -d +configarchitecture 'amd64' 'i386' +testequal "$(echo "$PKGTEXT" | sed 's#cool$#cool:i386#g') +WARNING: The following packages cannot be authenticated! + cool:i386 +Authentication warning overridden. +$DOWNLOG +Download complete and in download only mode" aptget install cool:i386 --assume-no -d --allow-unauthenticated +configarchitecture 'i386' + find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete -sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE +sed -i -e 's#\(deb\(-src\)\?\) \[trusted=no\] #\1 #' $DEBFILE aptgetupdate testfailureequal "$PKGTEXT @@ -47,10 +60,12 @@ testsuccessequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool Authentication warning overridden. +$DOWNLOG Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated -sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE +sed -i -e 's#\(deb\(-src\)\?\) #\1 [trusted=yes] #' $DEBFILE aptgetupdate testsuccessequal "$PKGTEXT +$DOWNLOG Download complete and in download only mode" aptget install cool --assume-no -d diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index ca2378c19..b9d232f90 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -21,7 +21,7 @@ testrun() { testsuccess --nomsg aptget update # check that I-M-S header is kept in redirections - testsuccessequal "Hit $1 unstable InRelease + testsuccessequal "Hit:1 $1 unstable InRelease Reading package lists..." aptget update msgtest 'Test redirection works in' 'package download' diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index 52992680b..e910c70cb 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -23,13 +23,24 @@ The following NEW packages will be installed: Inst libavcodec52 (4:0.5.2-6 localhost [i386]) Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s +testsuccessequal "Reading package lists... +Building dependency tree... +Reading state information... +1 package was automatically installed and is no longer required. +Use 'apt-get autoremove' to remove it. +The following NEW packages will be installed: + libavcodec52 +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst libavcodec52 (4:0.5.2-6 localhost [i386]) +Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s -o APT::Get::HideAutoRemove=small + testfailureequal "Reading package lists... Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: libvtk5.4 Use 'apt-get autoremove' to remove it. -The following extra packages will be installed: +The following additional packages will be installed: libavcodec52 libopenal-dev libvtk5.4 The following NEW packages will be installed: dummy-archive libavcodec52 libopenal-dev @@ -39,6 +50,21 @@ The following packages will be upgraded: Need to get 0 B/19.4 MB of archives. After this operation, 17.3 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only +testequal "Reading package lists... +Building dependency tree... +Reading state information... +1 package was automatically installed and is no longer required. +Use 'apt-get autoremove' to remove it. +The following additional packages will be installed: + libavcodec52 libopenal-dev libvtk5.4 +The following NEW packages will be installed: + dummy-archive libavcodec52 libopenal-dev +The following packages will be upgraded: + libvtk5.4 +1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Need to get 0 B/19.4 MB of archives. +After this operation, 17.3 MB of additional disk space will be used. +E: Trivial Only specified but this is not a trivial operation." aptget install dummy-archive --trivial-only -o APT::Get::HideAutoRemove=small echo -n > rootdir/var/lib/dpkg/status rm rootdir/var/lib/apt/extended_states @@ -52,7 +78,7 @@ Building dependency tree... MarkKeep libvtk5-dev [ i386 ] < none -> 5.4.2-8 > ( libdevel ) FU=0 MarkKeep libvtk5-dev [ i386 ] < none -> 5.4.2-8 > ( libdevel ) FU=0 MarkDelete libvtk5.4 [ i386 ] < none -> 5.4.2-8 > ( libs ) FU=0 -The following extra packages will be installed: +The following additional packages will be installed: libavcodec52 libopenal-dev The following NEW packages will be installed: dummy-archive libavcodec52 libopenal-dev diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index a7bde393b..31856b2c1 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -37,14 +37,14 @@ testmarkedauto 'b' testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -b is already the newest version. +b is already the newest version (1.0). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade testmarkedauto 'b' testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -b is already the newest version. +b is already the newest version (1.0). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d testmarkedauto 'b' @@ -62,7 +62,7 @@ Reinstall: b:i386 (1.0)' testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -b is already the newest version. +b is already the newest version (1.0). b set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b testmarkedauto diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index 401b521a5..af8391555 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -41,7 +41,7 @@ Conf foobar (1.0 stable [i386])' aptget install foobar -st stable testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libc6:amd64 The following packages will be REMOVED: libc6 @@ -96,7 +96,7 @@ Conf foobar (1.0 stable [i386])' aptget install foobar/stable -st testing testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libc6:amd64 The following packages will be REMOVED: libc6 @@ -145,7 +145,7 @@ Conf foobar-same (1.0 stable [i386])' aptget install foobar-same -st stable testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libc6-same:amd64 The following NEW packages will be installed: foobar-same:amd64 libc6-same:amd64 @@ -206,7 +206,7 @@ Conf foobar-same (1.0 stable [i386])' aptget install foobar-same/stable -st test testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libc6-same:amd64 The following packages will be REMOVED: libc6-same diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade index 552330d81..1709af7f2 100755 --- a/test/integration/test-bug-612557-garbage-upgrade +++ b/test/integration/test-bug-612557-garbage-upgrade @@ -20,7 +20,7 @@ testmarkedauto python-uno openoffice.org-common testfailureequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libreoffice-common The following packages will be REMOVED: openoffice.org-common openoffice.org-emailmerge @@ -38,7 +38,7 @@ testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge testfailureequal 'Reading package lists... Building dependency tree... Reading state information... -The following extra packages will be installed: +The following additional packages will be installed: libreoffice-common The following packages will be REMOVED: openoffice.org-common openoffice.org-emailmerge diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config index 7bf5781e8..9556a5aef 100755 --- a/test/integration/test-bug-612958-use-dpkg-multiarch-config +++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config @@ -5,22 +5,19 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture 'i386' -setupaptarchive - -insertinstalledpackage 'libapt' 'i386' '1.0' -insertinstalledpackage 'libapt' 'amd64' '1.0' -insertinstalledpackage 'libapt' 'armel' '1.0' testpass() { - rm rootdir/var/cache/apt/*.bin - msgtest 'Test architecture handling' "$1 with $2" - testsuccess --nomsg aptcache show libapt:$2 + msgtest 'Test architecture handling success' "$1 with $2" + rm -f archs.conf + aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf + testsuccess --nomsg grep "^$2\$" archs.conf } testfail() { - rm rootdir/var/cache/apt/*.bin - msgtest 'Test architecture handling' "$1 with $2" - testfailure --nomsg aptcache show libapt:$2 + msgtest 'Test architecture handling failure' "$1 with $2" + rm -f archs.conf + aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf + testfailure --nomsg grep "^$2\$" archs.conf } testpass 'no config' 'i386' diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency index 5839f8798..8424b10b7 100755 --- a/test/integration/test-bug-613420-new-garbage-dependency +++ b/test/integration/test-bug-613420-new-garbage-dependency @@ -24,7 +24,7 @@ Reading state information... The following packages were automatically installed and are no longer required: libreoffice-officebean openoffice.org-officebean Use 'apt-get autoremove' to remove them. -The following extra packages will be installed: +The following additional packages will be installed: libreoffice-core libreoffice-officebean openoffice.org-officebean The following packages will be REMOVED: openoffice.org-core @@ -35,3 +35,19 @@ The following packages will be upgraded: 1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. After this operation, 126 MB disk space will be freed. E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only +testequal "Reading package lists... +Building dependency tree... +Reading state information... +2 packages were automatically installed and are no longer required. +Use 'apt-get autoremove' to remove them. +The following additional packages will be installed: + libreoffice-core libreoffice-officebean openoffice.org-officebean +The following packages will be REMOVED: + openoffice.org-core +The following NEW packages will be installed: + libreoffice libreoffice-core libreoffice-officebean +The following packages will be upgraded: + openoffice.org-officebean +1 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. +After this operation, 126 MB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation." aptget install libreoffice --trivial-only -o APT::Get::HideAutoRemove=small diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index 563821173..6444c6110 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -23,7 +23,7 @@ insertpackage 'unstable' 'linux-stuff' 'amd64,armel' '1.0' insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev, arm-stuff [any-armel] | linux-stuff [ linux-any]' -insertsource 'unstable' 'forbidden-none' 'any' '1' 'Build-Depends: amdboot:any' +insertsource 'unstable' 'forbidden-no' 'any' '1' 'Build-Depends: amdboot:any' insertsource 'unstable' 'forbidden-same' 'any' '1' 'Build-Depends: libc6:any' insertsource 'unstable' 'forbidden-foreign' 'any' '1' 'Build-Depends: doxygen:any' @@ -37,7 +37,7 @@ setupaptarchive testfailureequal "Reading package lists... Building dependency tree... -E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel +E: Build-Depends dependency for forbidden-no can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: no' packages" aptget build-dep forbidden-no -s -a armel testfailureequal "Reading package lists... Building dependency tree... E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel @@ -167,17 +167,17 @@ Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot:amd64 cool doxygen foreigner libc6:amd64 libc6 libc6-dev:amd64 - libc6-dev libfwibble-dev:amd64 libfwibble1:amd64 linux-stuff:amd64 + amdboot:amd64 cool doxygen foreigner libc6 libc6:amd64 libc6-dev + libc6-dev:amd64 libfwibble-dev:amd64 libfwibble1:amd64 linux-stuff:amd64 0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded. Inst amdboot:amd64 (1.0 unstable [amd64]) Inst cool (1.0 unstable [armel]) Inst doxygen (1.0 unstable [armel]) Inst foreigner (1.0 unstable [armel]) -Inst libc6:amd64 (1.0 unstable [amd64]) Inst libc6 (1.0 unstable [armel]) -Inst libc6-dev:amd64 (1.0 unstable [amd64]) +Inst libc6:amd64 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [armel]) +Inst libc6-dev:amd64 (1.0 unstable [amd64]) Inst libfwibble1:amd64 (1.0 unstable [amd64]) Inst libfwibble-dev:amd64 (1.0 unstable [amd64]) Inst linux-stuff:amd64 (1.0 unstable [amd64]) @@ -185,10 +185,10 @@ Conf amdboot:amd64 (1.0 unstable [amd64]) Conf cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) Conf foreigner (1.0 unstable [armel]) -Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [armel]) -Conf libc6-dev:amd64 (1.0 unstable [amd64]) +Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [armel]) +Conf libc6-dev:amd64 (1.0 unstable [amd64]) Conf libfwibble1:amd64 (1.0 unstable [amd64]) Conf libfwibble-dev:amd64 (1.0 unstable [amd64]) Conf linux-stuff:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 @@ -275,24 +275,24 @@ Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s testsuccessequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot:amd64 doxygen libc6:amd64 libc6 libc6-dev:amd64 libc6-dev + amdboot:amd64 doxygen libc6 libc6:amd64 libc6-dev libc6-dev:amd64 libfwibble-dev:amd64 libfwibble1:amd64 linux-stuff:amd64 0 upgraded, 9 newly installed, 0 to remove and 2 not upgraded. Inst amdboot:amd64 (1.0 unstable [amd64]) Inst doxygen (1.0 unstable [armel]) -Inst libc6:amd64 (1.0 unstable [amd64]) Inst libc6 (1.0 unstable [armel]) -Inst libc6-dev:amd64 (1.0 unstable [amd64]) +Inst libc6:amd64 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [armel]) +Inst libc6-dev:amd64 (1.0 unstable [amd64]) Inst libfwibble1:amd64 (1.0 unstable [amd64]) Inst libfwibble-dev:amd64 (1.0 unstable [amd64]) Inst linux-stuff:amd64 (1.0 unstable [amd64]) Conf amdboot:amd64 (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [armel]) -Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [armel]) -Conf libc6-dev:amd64 (1.0 unstable [amd64]) +Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [armel]) +Conf libc6-dev:amd64 (1.0 unstable [amd64]) Conf libfwibble1:amd64 (1.0 unstable [amd64]) Conf libfwibble-dev:amd64 (1.0 unstable [amd64]) Conf linux-stuff:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected index f50507532..e62add938 100755 --- a/test/integration/test-bug-675449-essential-are-protected +++ b/test/integration/test-bug-675449-essential-are-protected @@ -87,3 +87,17 @@ Inst pkg-none-native [1] (2 unstable [amd64]) Conf pkg-none-native (2 unstable [amd64]) Inst pkg-none-new (2 unstable [amd64]) Conf pkg-none-new (2 unstable [amd64])' aptget dist-upgrade -s + +insertinstalledpackage 'foo' 'amd64' '1' 'Depends: libfoo +Essential: yes' +insertinstalledpackage 'libfoo' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo* libfoo* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + foo libfoo (due to foo) +0 upgraded, 0 newly installed, 2 to remove and 4 not upgraded. +Purg foo [1] +Purg libfoo [1]' aptget purge libfoo -s diff --git a/test/integration/test-bug-686346-package-missing-architecture b/test/integration/test-bug-686346-package-missing-architecture index d51bbabfe..d9bc0c3f2 100755 --- a/test/integration/test-bug-686346-package-missing-architecture +++ b/test/integration/test-bug-686346-package-missing-architecture @@ -11,7 +11,6 @@ insertinstalledpackage 'pkgd' 'none' '1' insertpackage 'unstable' 'pkga' 'amd64' '2' 'Depends: pkgb' insertpackage 'unstable' 'pkgb' 'amd64' '2' insertpackage 'unstable' 'pkgc' 'amd64' '1' 'Conflicts: pkgb' -insertpackage 'unstable' 'pkge' 'none' '1' setupaptarchive @@ -28,7 +27,7 @@ Conf pkgc (1 unstable [amd64])' aptget install pkgc -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: pkgb The following packages will be REMOVED: pkgb:none @@ -41,13 +40,6 @@ Inst pkga (2 unstable [amd64]) Conf pkgb (2 unstable [amd64]) Conf pkga (2 unstable [amd64])' aptget install pkga -s -# ensure that arch-less stanzas from Packages files are ignored -msgtest 'Package is distributed in the Packages files' 'pkge' -grep -q 'Package: pkge' $(find aptarchive -name 'Packages') && msgpass || msgfail -testnopackage pkge -testnopackage pkge:none -testnopackage pkge:* - # do not automatically change from none-arch to whatever-arch as # this breaks other none packages and dpkg has this ruleset as # this difference seems so important that it has to be maintained … diff --git a/test/integration/test-bug-709560-set-candidate-release b/test/integration/test-bug-709560-set-candidate-release index ab41d8f2a..502ade92c 100755 --- a/test/integration/test-bug-709560-set-candidate-release +++ b/test/integration/test-bug-709560-set-candidate-release @@ -25,7 +25,7 @@ testsuccessequal "Reading package lists... Building dependency tree... Selected version '2.0' (experimental [all]) for 'foo' Selected version '2.1' (experimental [all]) for 'foo-dep' because of 'foo' -The following extra packages will be installed: +The following additional packages will be installed: foo-dep The following NEW packages will be installed: foo foo-dep diff --git a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch index 62355a6b5..93a33d30f 100755 --- a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch +++ b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch @@ -48,7 +48,7 @@ DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt observehook() { rm -f ${hook}-v2.list ${hook}-v3.list msgtest 'Observe hooks while' "$*" - testsuccess --nomsg aptget "$@" -y --force-yes + testsuccess --nomsg aptget "$@" -y --allow-downgrades } testrun() { diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet index 2cad929cc..1fa94de7d 100755 --- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet +++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet @@ -12,6 +12,7 @@ insertpackage 'unstable' 'apt' 'all' '2' insertsource 'unstable' 'apt' 'all' '2' insertsource 'unstable' 'apt2' 'all' '1' +getoriginfromsuite() { echo 'Debian'; } setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) @@ -20,11 +21,11 @@ testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.d testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris -testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt -qq --print-uris -testsuccessequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 MD5Sum:16ff470aaedad0f06fb951ed89ffdd3a +'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 MD5Sum:ab2b546f59ff9e8f5cc7a2d987ff3373" aptget source apt -qq --print-uris +testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris -testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt apt2 -qq --print-uris +testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 MD5Sum:16ff470aaedad0f06fb951ed89ffdd3a +'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 MD5Sum:ab2b546f59ff9e8f5cc7a2d987ff3373 +'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 10 MD5Sum:4c572ce45f1e2bedbb30da7f5e1c241c +'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 13 MD5Sum:2a96fec139f8722d93312a1ff8281232" aptget source apt apt2 -qq --print-uris diff --git a/test/integration/test-bug-723586-any-stripped-in-single-arch b/test/integration/test-bug-723586-any-stripped-in-single-arch index 0cf3362cf..78c4eae64 100755 --- a/test/integration/test-bug-723586-any-stripped-in-single-arch +++ b/test/integration/test-bug-723586-any-stripped-in-single-arch @@ -17,7 +17,7 @@ setupaptarchive INSTALLLOG='Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: python3 The following NEW packages will be installed: python3-gnupg @@ -50,5 +50,5 @@ configarchitecture 'amd64' 'armhf' rm rootdir/var/cache/apt/*.bin testsuccessequal "$INSTALLLOG" aptget install python3-gnupg -s -testsuccessequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3 +testsuccessequal "$(cat showpkg.log)" aptcache showpkg python3 testfailureequal "$FAILLOG" aptget install python-mips -s diff --git a/test/integration/test-bug-723705-tagfile-truncates-fields b/test/integration/test-bug-723705-tagfile-truncates-fields index 29f98550c..21878ebf0 100755 --- a/test/integration/test-bug-723705-tagfile-truncates-fields +++ b/test/integration/test-bug-723705-tagfile-truncates-fields @@ -12,7 +12,7 @@ aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 testfileequal filename.log "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cdebconf-gtk-udeb cdebconf-newt-udeb cdebconf-udeb libc6-udeb libglib2.0-udeb libgtk2.0-0-udeb libvte9-udeb The following NEW packages will be installed: diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable index eb6e1a331..1523b81e0 100755 --- a/test/integration/test-bug-735967-lib32-to-i386-unavailable +++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable @@ -78,7 +78,7 @@ Conf lib32nss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libfoo libfoo-bin:i386 The following NEW packages will be installed: foo libfoo libfoo-bin:i386 diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol index f6336ffe3..e86f28824 100755 --- a/test/integration/test-bug-738785-switch-protocol +++ b/test/integration/test-bug-738785-switch-protocol @@ -10,6 +10,7 @@ configarchitecture "i386" buildsimplenativepackage 'apt' 'all' '1.0' 'stable' # setup http redirecting to https +getlabelfromsuite() { echo 'Testcases'; } setupaptarchive --no-update changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \ -o 'aptwebserver::redirect::replace::/downgrademe/=http://localhost:8080/' \ @@ -20,10 +21,10 @@ sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/so 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 +downloadfile 'http://localhost:8080/pool/main/a/apt/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 -testsuccessequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris +echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/redirectme/pool/CHANGEPATH/changelog";' > rootdir/etc/apt/apt.conf.d/changelog.conf +testsuccessequal "'http://localhost:8080/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt --print-uris cd downloaded testsuccess aptget changelog apt -d @@ -38,18 +39,15 @@ cd - >/dev/null 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 +# install a slowed down file: otherwise its to fast to reproduce combining +NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods" +OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)" +rm $NEWMETHODS +mkdir $NEWMETHODS +for METH in $(find $OLDMETHODS ! -type d); do + ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS done -rm https -cd - >/dev/null -echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf +rm $NEWMETHODS/https cd downloaded testfailureequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. @@ -58,8 +56,7 @@ testfailure test -e apt_1.0_all.deb cd - >/dev/null # revert to all methods -rm -rf rootdir/$COPYMETHODS -mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS} +ln -s $OLDMETHODS/https $NEWMETHODS # check that downgrades from https to http are not allowed webserverconfig 'aptwebserver::support::http' 'true' diff --git a/test/integration/test-bug-758153-versioned-provides-support b/test/integration/test-bug-758153-versioned-provides-support index 30bc921c3..6d43d9943 100755 --- a/test/integration/test-bug-758153-versioned-provides-support +++ b/test/integration/test-bug-758153-versioned-provides-support @@ -30,6 +30,18 @@ insertpackage 'unstable' 'baz' 'i386,amd64' '1' 'Depends: bar' insertpackage 'experimental' 'baz' 'i386,amd64' '2' 'Depends: bar:i386' insertpackage 'experimental' 'baz-broken' 'i386' '2' 'Depends: bar:amd64' +insertpackage 'unstable' 'next' 'amd64' '1' 'Multi-Arch: foreign +Provides: next (= 2)' +insertpackage 'unstable' 'needsrealnext' 'amd64,i386' '2' 'Depends: next (>= 2)' + +insertpackage 'unstable' 'virtualnext2' 'amd64' '1' 'Multi-Arch: foreign +Provides: next2 (= 2)' +insertpackage 'unstable' 'needsnext2' 'amd64,i386' '2' 'Depends: next2 (>= 2)' + +insertpackage 'unstable' 'virtualnext3' 'amd64' '1' 'Multi-Arch: no +Provides: next3 (= 2)' +insertpackage 'unstable' 'needsnext3' 'amd64,i386' '2' 'Depends: next3 (>= 2)' + setupaptarchive testsuccessequal 'Reading package lists... @@ -145,7 +157,7 @@ Conf cool-webapp (4 experimental [all])' aptget install cool-webapp foreign-webs testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: baz:i386 foo @@ -170,7 +182,7 @@ E: Unable to correct problems, you have held broken packages.' aptget install ba testsuccessequal "Reading package lists... Building dependency tree... Selected version '2' (experimental [amd64]) for 'baz' -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: baz foo @@ -183,7 +195,7 @@ Conf baz (2 experimental [amd64])" aptget install baz/experimental -s -q=0 testsuccessequal "Reading package lists... Building dependency tree... Selected version '2' (experimental [i386]) for 'baz:i386' -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: baz:i386 foo @@ -204,3 +216,75 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: baz-broken:i386 : Depends: bar but it is not installable E: Unable to correct problems, you have held broken packages.' aptget install baz-broken -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + next +The following NEW packages will be installed: + needsrealnext next +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst next (1 unstable [amd64]) +Inst needsrealnext (2 unstable [amd64]) +Conf next (1 unstable [amd64]) +Conf needsrealnext (2 unstable [amd64])' aptget install needsrealnext -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + next +The following NEW packages will be installed: + needsrealnext:i386 next +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst next (1 unstable [amd64]) +Inst needsrealnext:i386 (2 unstable [i386]) +Conf next (1 unstable [amd64]) +Conf needsrealnext:i386 (2 unstable [i386])' aptget install needsrealnext:i386 -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + virtualnext2 +The following NEW packages will be installed: + needsnext2 virtualnext2 +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst virtualnext2 (1 unstable [amd64]) +Inst needsnext2 (2 unstable [amd64]) +Conf virtualnext2 (1 unstable [amd64]) +Conf needsnext2 (2 unstable [amd64])' aptget install needsnext2 -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + virtualnext2 +The following NEW packages will be installed: + needsnext2:i386 virtualnext2 +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst virtualnext2 (1 unstable [amd64]) +Inst needsnext2:i386 (2 unstable [i386]) +Conf virtualnext2 (1 unstable [amd64]) +Conf needsnext2:i386 (2 unstable [i386])' aptget install needsnext2:i386 -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + virtualnext3 +The following NEW packages will be installed: + needsnext3 virtualnext3 +0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst virtualnext3 (1 unstable [amd64]) +Inst needsnext3 (2 unstable [amd64]) +Conf virtualnext3 (1 unstable [amd64]) +Conf needsnext3 (2 unstable [amd64])' aptget install needsnext3 -s + +testfailureequal '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: + needsnext3:i386 : Depends: next3:i386 (>= 2) but it is not installable +E: Unable to correct problems, you have held broken packages.' aptget install needsnext3:i386 -s diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade index 56071f184..b8821126f 100755 --- a/test/integration/test-bug-multiarch-upgrade +++ b/test/integration/test-bug-multiarch-upgrade @@ -18,7 +18,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libcups2 The following packages will be upgraded: libcups2 libcups2:i386 diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index c6b292baa..b5d6b8ae4 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -60,7 +60,7 @@ testrun() { msgtest 'Check if package is downloadable' cd downloaded testsuccess --nomsg aptget download testpkg - msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb + msgtest 'deb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb rm -f testpkg_1.0_i386.deb cd - >/dev/null testsuccessequal 'Reading package lists... diff --git a/test/integration/test-cve-2013-1051-InRelease-parsing b/test/integration/test-cve-2013-1051-InRelease-parsing index e38e40cc9..a503ad0fe 100755 --- a/test/integration/test-cve-2013-1051-InRelease-parsing +++ b/test/integration/test-cve-2013-1051-InRelease-parsing @@ -12,7 +12,7 @@ insertpackage 'stable' 'good-pkg' 'all' '1.0' setupaptarchive changetowebserver -ARCHIVE='http://localhost:8080/' +ARCHIVE='http://localhost:8080' msgtest 'Initial apt-get update should work with' 'InRelease' testsuccess --nomsg aptget update @@ -21,7 +21,7 @@ testsuccessequal "good-pkg: Installed: (none) Candidate: 1.0 Version table: - 1.0 0 + 1.0 500 500 ${ARCHIVE} stable/main i386 Packages" aptcache policy good-pkg # now exchange to the Packages file, note that this could be @@ -39,10 +39,15 @@ sed -i '/^-----BEGIN PGP SIGNATURE-----/,/^-----END PGP SIGNATURE-----/ s/^$/ / cat aptarchive/dists/stable/Release >> aptarchive/dists/stable/InRelease touch -d '+1hour' aptarchive/dists/stable/InRelease -# ensure the update fails -# useful for debugging to add "-o Debug::pkgAcquire::auth=true" -msgtest 'apt-get update for should fail with the modified' 'InRelease' -aptget update 2>&1 | grep -E -q '(Writing more data than expected|Hash Sum mismatch)' > /dev/null && msgpass || msgfail +# ensure the update doesn't load bad data as good data +# Note that we will pick up the InRelease itself as we download no other +# indexes which would trigger a hashsum mismatch, but we ignore the 'bad' +# part of the InRelease +listcurrentlistsdirectory | sed '/_InRelease/ d' > listsdir.lst +msgtest 'apt-get update should ignore unsigned data in the' 'InRelease' +testsuccessequal "Get:1 http://localhost:8080 stable InRelease [$(stat -c%s aptarchive/dists/stable/InRelease) B] +Reading package lists..." --nomsg aptget update +testfileequal './listsdir.lst' "$(listcurrentlistsdirectory | sed '/_InRelease/ d')" # ensure there is no package testfailureequal 'Reading package lists... @@ -57,5 +62,5 @@ testsuccessequal "good-pkg: Installed: (none) Candidate: 1.0 Version table: - 1.0 0 + 1.0 500 500 ${ARCHIVE} stable/main i386 Packages" aptcache policy good-pkg diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak index 50c682d43..86a852c32 100755 --- a/test/integration/test-essential-force-loopbreak +++ b/test/integration/test-essential-force-loopbreak @@ -27,7 +27,7 @@ testforcebreak() { rm -f rootdir/var/lib/apt/extended_states testfailureequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: sysvinit The following NEW packages will be installed: systemd-sysv diff --git a/test/integration/test-handle-redirect-as-used-mirror-change b/test/integration/test-handle-redirect-as-used-mirror-change new file mode 100755 index 000000000..08a39a5e6 --- /dev/null +++ b/test/integration/test-handle-redirect-as-used-mirror-change @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' +configcompression '.' 'gz' + +buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' + +setupaptarchive --no-update +changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://0.0.0.0:8080/' +rewritesourceslist 'http://localhost:8080/redirectme' + +testsuccessequal "Get:1 http://0.0.0.0:8080 unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B] +Get:2 http://0.0.0.0:8080 unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] +Get:3 http://0.0.0.0:8080 unstable/main amd64 Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B] +Get:4 http://0.0.0.0:8080 unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] +Reading package lists..." aptget update + +testsuccessequal 'Hit:1 http://0.0.0.0:8080 unstable InRelease +Reading package lists...' aptget update diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups index 149f05fa9..a465e5234 100755 --- a/test/integration/test-handling-broken-orgroups +++ b/test/integration/test-handling-broken-orgroups @@ -25,7 +25,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: cool The following NEW packages will be installed: cool coolstuff @@ -37,7 +37,7 @@ Conf coolstuff (1.0-1 unstable [all])' aptget install coolstuff -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: stuff The following NEW packages will be installed: coolstuff2 stuff @@ -63,7 +63,7 @@ E: Unable to correct problems, you have held broken packages.' aptget install co testsuccessequal 'Reading package lists... Building dependency tree... Recommended packages: - cool2 stuff2 + cool2 | stuff2 The following NEW packages will be installed: coolstuff-brokenrec 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. @@ -72,7 +72,7 @@ Conf coolstuff-brokenrec (1.0-1 unstable [all])' aptget install coolstuff-broken testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: stuff The following NEW packages will be installed: coolstuff-conflict stuff @@ -84,7 +84,7 @@ Conf coolstuff-conflict (1.0-1 unstable [all])' aptget install coolstuff-conflic testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: extrastuff The following NEW packages will be installed: coolstuff-provided extrastuff diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks index 20424b942..a7d9d4054 100755 --- a/test/integration/test-ignore-provides-if-versioned-breaks +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -57,7 +57,7 @@ Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: foo-breaker-3 foo-provider @@ -95,7 +95,7 @@ Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-prov testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo-foreign:amd64 The following NEW packages will be installed: foo-foreign-breaker-3 foo-foreign-provider @@ -133,18 +133,18 @@ Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider f testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: - foo-same:amd64 foo-same +The following additional packages will be installed: + foo-same foo-same:amd64 The following NEW packages will be installed: foo-same-breaker-3 foo-same-provider The following packages will be upgraded: - foo-same:amd64 foo-same + foo-same foo-same:amd64 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]) +Inst foo-same [2.0] (4.0 unstable [i386]) [foo-same:i386 on foo-same:amd64] [foo-same:amd64 on foo-same:i386] [foo-same:amd64 ] +Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) 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 (4.0 unstable [i386]) 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 a781d8e44..f30789ea6 100755 --- a/test/integration/test-ignore-provides-if-versioned-conflicts +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -57,7 +57,7 @@ Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: foo-breaker-3 foo-provider @@ -95,7 +95,7 @@ Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-prov testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo-foreign:amd64 The following NEW packages will be installed: foo-foreign-breaker-3 foo-foreign-provider @@ -133,18 +133,18 @@ Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider f testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: - foo-same:amd64 foo-same +The following additional packages will be installed: + foo-same foo-same:amd64 The following NEW packages will be installed: foo-same-breaker-3 foo-same-provider The following packages will be upgraded: - foo-same:amd64 foo-same + foo-same foo-same:amd64 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]) +Inst foo-same [2.0] (4.0 unstable [i386]) [foo-same:i386 on foo-same:amd64] [foo-same:amd64 on foo-same:i386] [foo-same:amd64 ] +Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) 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 (4.0 unstable [i386]) 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 index c2fc37ee7..2b020ceca 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -58,6 +58,22 @@ testprotected() { testsuccessequal "Reading package lists... Building dependency tree... Reading state information... +The following packages were automatically installed and are no longer required: + 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) +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -sV +testequal "Reading package lists... +Building dependency tree... +Reading state information... +4 packages were automatically installed and are no longer required. +Use 'apt-get autoremove' to remove them. +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small +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) diff --git a/test/integration/test-method-rred b/test/integration/test-method-rred new file mode 100755 index 000000000..a8de3ea28 --- /dev/null +++ b/test/integration/test-method-rred @@ -0,0 +1,194 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +echo 'Package: coolstuff +Version: 0.8.15 +Description: collection of stuff + A lot, too much to iterate all, but at least this: + - stuff + - more stuff + - even more stuff + . + And a cow. + +Package: oldstuff +Version: 0-1 +Description: collection of outdated stuff + A lot, but of no use nowadays, but at least this: + - stuff + - more stuff + - even more stuff + . + And a dog.' > Packages + +testrred() { + msgtest "$1" "$2" + if [ -z "$3" ]; then + echo -n '' > Packages.ed + else + echo "$3" > Packages.ed + fi + rred() { + cat Packages | runapt "${METHODSDIR}/rred" "$@" + } + testsuccessequal "$4" --nomsg rred -f Packages.ed +} + +testrred 'Remove' 'first line' '1d' "$(tail -n +2 ./Packages)" +testrred 'Remove' 'empty line' '10d' "$(head -n 9 ./Packages) +$(tail -n 9 ./Packages)" +testrred 'Remove' 'line in a paragraph' '5d' "$(head -n 4 ./Packages) +$(tail -n 14 ./Packages)" +testrred 'Remove' 'last line' '19d' "$(head -n -1 ./Packages)" +testrred 'Remove' 'multiple single lines' '17d +7d' "$(sed -e '/^ - even more stuff$/ d' ./Packages)" +testrred 'Remove' 'first paragraph' '1,10d' "$(tail -n 9 ./Packages)" +testrred 'Remove' 'a few lines in the middle' '5,14d' "$(head -n 4 ./Packages) +$(tail -n 5 ./Packages)" +testrred 'Remove' 'second paragraph' '10,19d' "$(head -n 9 ./Packages)" +testrred 'Mass Remove' 'all stuff lines' '15,17d +13d +11d +5,7d +3d +1d' "$(sed '/stuff/ d' ./Packages)" + +testrred 'Single line add' 'first line' '0a +Format: 3.0 (native) +.' "Format: 3.0 (native) +$(cat ./Packages)" +testrred 'Single line add' 'last line' '19a +Multi-Arch: foreign +.' "$(cat ./Packages) +Multi-Arch: foreign" +testrred 'Single line add' 'middle' '9a +Multi-Arch: foreign +.' "$(head -n 9 ./Packages) +Multi-Arch: foreign +$(tail -n 10 ./Packages)" + +testrred 'Multi line add' 'first line' '0a +Format: 3.0 (native) +Source: apt +.' "Format: 3.0 (native) +Source: apt +$(cat ./Packages)" +testrred 'Multi line add' 'last line' '19a +Multi-Arch: foreign +Homepage: https://debian.org +.' "$(cat ./Packages) +Multi-Arch: foreign +Homepage: https://debian.org" +testrred 'Multi line add' 'middle' '9a +Multi-Arch: foreign +Homepage: https://debian.org +.' "$(head -n 9 ./Packages) +Multi-Arch: foreign +Homepage: https://debian.org +$(tail -n 10 ./Packages)" + +testrred 'Single line change' 'first line' '1c +Package: supercoolstuff +.' "Package: supercoolstuff +$(tail -n +2 ./Packages)" +testrred 'Single line change' 'in the middle' '9c + And a super cow. +.' "$(head -n 8 ./Packages) + And a super cow. +$(tail -n 10 ./Packages)" +testrred 'Single line change' 'an empty line' '10c + +.' "$(head -n 9 ./Packages) + +$(tail -n 9 ./Packages)" +testrred 'Single line change' 'a spacy line' '10c + +.' "$(head -n 9 ./Packages) + +$(tail -n 9 ./Packages)" +testrred 'Single line change' 'last line' '19c + And a cat. +.' "$(head -n -1 ./Packages) + And a cat." + +testrred 'Multi line change' 'exchange' '5,7c + - good stuff + - more good stuff + - even more good stuff +.' "$(head -n 4 ./Packages) + - good stuff + - more good stuff + - even more good stuff +$(tail -n 12 ./Packages)" +testrred 'Multi line change' 'less' '5,7c + - good stuff + - more good stuff +.' "$(head -n 4 ./Packages) + - good stuff + - more good stuff +$(tail -n 12 ./Packages)" +testrred 'Multi line change' 'more' '5,7c + - good stuff + - more good stuff + - even more good stuff + - bonus good stuff +.' "$(head -n 4 ./Packages) + - good stuff + - more good stuff + - even more good stuff + - bonus good stuff +$(tail -n 12 ./Packages)" + +failrred() { + msgtest 'Failure caused by' "$1" + echo "$2" > Packages.ed + rred() { + cat Packages | runapt "${METHODSDIR}/rred" "$@" + } + testfailure --nomsg rred -f Packages.ed +} + +failrred 'Bogus content' '<html> +</html>' + +# not a problem per-se, but we want our parser to be really strict +failrred 'Empty patch file' '' +failrred 'Empty line patch file' ' +' +failrred 'Empty line before command' ' +1d' +failrred 'Empty line after command' '1d +' +failrred 'Empty line between commands' '17d + +7d' +failrred 'Empty spaces lines before command' ' +1d' +failrred 'Empty spaces lines after command' '1d + ' +failrred 'Empty spaces lines between commands' '17d + +7d' + +# the line before the first one can't be deleted/changed +failrred 'zero line delete' '0d' +failrred 'zero line change' '0c +Package: supercoolstuff +.' +# and this makes no sense at all +failrred 'negative line delete' '-1d' +failrred 'negative line change' '-1c +Package: supercoolstuff +.' +failrred 'negative line add' '-1a +Package: supercoolstuff +.' +failrred 'Wrong order of commands' '7d +17d' +failrred 'End before start' '7,6d' diff --git a/test/integration/test-multiarch-allowed b/test/integration/test-multiarch-allowed new file mode 100755 index 000000000..2eb479c17 --- /dev/null +++ b/test/integration/test-multiarch-allowed @@ -0,0 +1,245 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable' 'foo' 'amd64,i386' '1' 'Multi-Arch: allowed' +insertpackage 'unstable' 'needsfoo' 'amd64,i386' '1' 'Depends: foo' +insertpackage 'unstable' 'needsfooany' 'amd64,i386' '1' 'Depends: foo:any' +insertpackage 'unstable' 'needsfoover1' 'amd64,i386' '1' 'Depends: foo:any (>= 1)' +insertpackage 'unstable' 'needsfoover2' 'amd64,i386' '1' 'Depends: foo:any (>= 2)' +insertpackage 'unstable' 'hatesfoo' 'amd64' '1' 'Conflicts: foo' +insertpackage 'unstable' 'hatesfooany' 'amd64' '1' 'Conflicts: foo:any' # this makes no sense… +insertpackage 'unstable' 'hatesfoonative' 'amd64' '1' 'Conflicts: foo:amd64' + +insertpackage 'unstable' 'coolfoo' 'amd64' '1' 'Multi-Arch:allowed +Provides: coolbar' +insertpackage 'unstable' 'coolfoover' 'amd64' '1' 'Multi-Arch:allowed +Provides: coolbar (= 2)' +insertpackage 'unstable' 'needscoolfoo' 'amd64' '1' 'Depends: coolfoo, coolbar' +insertpackage 'unstable' 'needscoolfooany' 'amd64' '1' 'Depends: coolfoo:any, coolbar:any' +insertpackage 'unstable' 'needscoolfoover0' 'amd64' '1' 'Depends: coolfoo:any (>= 1), coolbar' +insertpackage 'unstable' 'needscoolfoover1' 'amd64' '1' 'Depends: coolfoo:any (>= 1), coolbar (>= 1)' +insertpackage 'unstable' 'needscoolfoover2' 'amd64' '1' 'Depends: coolfoo:any (>= 2), coolbar (>= 1)' +insertpackage 'unstable' 'needscoolfoover3' 'amd64' '1' 'Depends: coolfoo:any (>= 2), coolbar (>= 3)' + +setupaptarchive + +BADPREFIX='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: +' + +solveableinsinglearch0() { + testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + foo +The following NEW packages will be installed: + foo needsfoo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [amd64]) +Inst needsfoo (1 unstable [amd64]) +Conf foo (1 unstable [amd64]) +Conf needsfoo (1 unstable [amd64])' aptget install needsfoo -s +} +solveableinsinglearch0 +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + foo:i386 +The following NEW packages will be installed: + foo:i386 needsfoo:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1 unstable [i386]) +Inst needsfoo:i386 (1 unstable [i386]) +Conf foo:i386 (1 unstable [i386]) +Conf needsfoo:i386 (1 unstable [i386])' aptget install needsfoo:i386 -s +testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needsfoo:i386 : Depends: foo:i386 but it is not going to be installed +E: Unable to correct problems, you have held broken packages." aptget install needsfoo:i386 foo:amd64 -s +testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needsfoo : Depends: foo but it is not going to be installed +E: Unable to correct problems, you have held broken packages." aptget install needsfoo foo:i386 -s + +solveableinsinglearch1() { + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + foo +The following NEW packages will be installed: + foo $1 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [amd64]) +Inst $1 (1 unstable [amd64]) +Conf foo (1 unstable [amd64]) +Conf $1 (1 unstable [amd64])" aptget install $1 -s +} + +testneedsfooallgood() { + solveableinsinglearch1 $1 + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + foo +The following NEW packages will be installed: + foo $1:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [amd64]) +Inst $1:i386 (1 unstable [i386]) +Conf foo (1 unstable [amd64]) +Conf $1:i386 (1 unstable [i386])" aptget install $1:i386 -s + testsuccessequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo:i386 $1:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1 unstable [i386]) +Inst $1:i386 (1 unstable [i386]) +Conf foo:i386 (1 unstable [i386]) +Conf $1:i386 (1 unstable [i386])" aptget install $1:i386 foo:i386 -s + testsuccessequal "Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo:i386 $1 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1 unstable [i386]) +Inst $1 (1 unstable [amd64]) +Conf foo:i386 (1 unstable [i386]) +Conf $1 (1 unstable [amd64])" aptget install $1 foo:i386 -s +} +testneedsfooallgood 'needsfooany' +testneedsfooallgood 'needsfoover1' + +NEEDSFOO2NATIVE="$BADPREFIX +The following packages have unmet dependencies: + needsfoover2 : Depends: foo:any (>= 2) +E: Unable to correct problems, you have held broken packages." +NEEDSFOO2FOREIGN="$BADPREFIX +The following packages have unmet dependencies: + needsfoover2:i386 : Depends: foo:any:i386 (>= 2) +E: Unable to correct problems, you have held broken packages." +testfailureequal "$NEEDSFOO2NATIVE" aptget install needsfoover2 -s +testfailureequal "$NEEDSFOO2FOREIGN" aptget install needsfoover2:i386 -s +testfailureequal "$NEEDSFOO2FOREIGN" aptget install needsfoover2:i386 foo:i386 -s +testfailureequal "$NEEDSFOO2NATIVE" aptget install needsfoover2 foo:i386 -s + +solveableinsinglearch2() { + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hatesfoo : Conflicts: foo but 1 is to be installed +E: Unable to correct problems, you have held broken packages." aptget install foo hatesfoo -s + # the message differs slightly between single and multiarch + testfailuremsg 'E: Unable to correct problems, you have held broken packages.' aptget install foo hatesfooany -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hatesfoonative : Conflicts: foo but 1 is to be installed +E: Unable to correct problems, you have held broken packages." aptget install foo hatesfoonative -s +} +solveableinsinglearch2 +testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hatesfoo : Conflicts: foo:i386 but 1 is to be installed +E: Unable to correct problems, you have held broken packages." aptget install foo:i386 hatesfoo -s +testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hatesfooany : Conflicts: foo:any + Conflicts: foo:any:i386 +E: Unable to correct problems, you have held broken packages." aptget install foo:i386 hatesfooany -s +testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo:i386 hatesfoonative +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1 unstable [i386]) +Inst hatesfoonative (1 unstable [amd64]) +Conf foo:i386 (1 unstable [i386]) +Conf hatesfoonative (1 unstable [amd64])' aptget install foo:i386 hatesfoonative -s + +solveableinsinglearch3() { + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + coolfoo +The following NEW packages will be installed: + coolfoo needscoolfoo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst coolfoo (1 unstable [amd64]) +Inst needscoolfoo (1 unstable [amd64]) +Conf coolfoo (1 unstable [amd64]) +Conf needscoolfoo (1 unstable [amd64])" aptget install needscoolfoo -s + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + coolfoo +The following NEW packages will be installed: + coolfoo coolfoover needscoolfoo +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst coolfoo (1 unstable [amd64]) +Inst coolfoover (1 unstable [amd64]) +Inst needscoolfoo (1 unstable [amd64]) +Conf coolfoo (1 unstable [amd64]) +Conf coolfoover (1 unstable [amd64]) +Conf needscoolfoo (1 unstable [amd64])" aptget install needscoolfoo coolfoover -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needscoolfooany : Depends: coolbar:any but it is not installable +E: Unable to correct problems, you have held broken packages." aptget install needscoolfooany -s + testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + coolfoo +The following NEW packages will be installed: + coolfoo needscoolfoover0 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst coolfoo (1 unstable [amd64]) +Inst needscoolfoover0 (1 unstable [amd64]) +Conf coolfoo (1 unstable [amd64]) +Conf needscoolfoover0 (1 unstable [amd64])' aptget install needscoolfoover0 -s + testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + coolfoo coolfoover +The following NEW packages will be installed: + coolfoo coolfoover needscoolfoover1 +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst coolfoo (1 unstable [amd64]) +Inst coolfoover (1 unstable [amd64]) +Inst needscoolfoover1 (1 unstable [amd64]) +Conf coolfoo (1 unstable [amd64]) +Conf coolfoover (1 unstable [amd64]) +Conf needscoolfoover1 (1 unstable [amd64])' aptget install needscoolfoover1 -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needscoolfoover2 : Depends: coolfoo:any (>= 2) +E: Unable to correct problems, you have held broken packages." aptget install needscoolfoover2 -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needscoolfoover3 : Depends: coolfoo:any (>= 2) + Depends: coolbar (>= 3) +E: Unable to correct problems, you have held broken packages." aptget install needscoolfoover3 -s +} +solveableinsinglearch3 + +msgmsg 'switch to single architecture' +configarchitecture 'amd64' + +solveableinsinglearch0 +testfailureequal 'Reading package lists... +Building dependency tree... +E: Unable to locate package needsfoo' aptget install needsfoo:i386 -s + +solveableinsinglearch1 'needsfooany' +solveableinsinglearch1 'needsfoover1' +testfailureequal "$NEEDSFOO2NATIVE" aptget install needsfoover2 -s +solveableinsinglearch2 +solveableinsinglearch3 diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign index 7870126f5..58e5b462a 100755 --- a/test/integration/test-multiarch-foreign +++ b/test/integration/test-multiarch-foreign @@ -9,11 +9,17 @@ configarchitecture 'amd64' 'i386' 'armel' insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo' insertpackage 'unstable' 'cool-foo-x64' 'amd64' '1.0' 'Depends: foo:amd64' insertpackage 'unstable' 'cool-foo-x32' 'amd64' '1.0' 'Depends: foo:i386' +insertpackage 'unstable' 'hates-foo' 'amd64,i386' '1.0' 'Conflicts: foo' +insertpackage 'unstable' 'hates-foo-x64' 'amd64' '1.0' 'Conflicts: foo:amd64' +insertpackage 'unstable' 'hates-foo-x32' 'amd64' '1.0' 'Conflicts: foo:i386' insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign' insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider' insertpackage 'unstable' 'cool-bar-x64' 'amd64' '1.0' 'Depends: bar-provider:amd64' insertpackage 'unstable' 'cool-bar-x32' 'amd64' '1.0' 'Depends: bar-provider:i386' +insertpackage 'unstable' 'hates-bar' 'amd64,i386' '1.0' 'Conflicts: bar-provider' +insertpackage 'unstable' 'hates-bar-x64' 'amd64' '1.0' 'Conflicts: bar-provider:amd64' +insertpackage 'unstable' 'hates-bar-x32' 'amd64' '1.0' 'Conflicts: bar-provider:i386' insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider Multi-Arch: foreign' @@ -21,7 +27,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: cool-foo:i386 foo @@ -53,7 +59,7 @@ Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:armel -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: bar cool-bar:i386 @@ -97,7 +103,7 @@ Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider:i386 satisfiable_in_singlearch() { testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: cool-foo foo @@ -119,7 +125,7 @@ Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: bar cool-bar @@ -152,7 +158,7 @@ Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: cool-foo-x64 foo @@ -163,10 +169,37 @@ Conf foo (1.0 unstable [amd64]) Conf cool-foo-x64 (1.0 unstable [amd64])' aptget install cool-foo-x64 -s } +hatersgonnahate() { + BADPREFIX='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: +' + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hates-foo : Conflicts: foo + Conflicts: foo:i386 + Conflicts: foo:armel +E: Unable to correct problems, you have held broken packages." aptget install $1 hates-foo -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hates-foo-x64 : Conflicts: foo +E: Unable to correct problems, you have held broken packages." aptget install $1 hates-foo-x64 -s + testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + hates-foo-x32 : Conflicts: foo:i386 +E: Unable to correct problems, you have held broken packages." aptget install $1 hates-foo-x32 -s +} +hatersgonnahate 'foo' +hatersgonnahate 'foo:i386' + #FIXME: do not work in single-arch as i386 isn't known at cache generation time testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: cool-foo-x32 foo @@ -178,7 +211,7 @@ Conf cool-foo-x32 (1.0 unstable [amd64])' aptget install cool-foo-x32 -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: bar cool-bar-x32 @@ -190,7 +223,7 @@ Conf cool-bar-x32 (1.0 unstable [amd64])' aptget install cool-bar-x32 -s -q=0 testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: bar cool-bar-x64 diff --git a/test/integration/test-ordering-ignore-not-matching-breaks b/test/integration/test-ordering-ignore-not-matching-breaks deleted file mode 100755 index 7c1365bdd..000000000 --- a/test/integration/test-ordering-ignore-not-matching-breaks +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -set -e - -TESTDIR=$(readlink -f $(dirname $0)) -. $TESTDIR/framework -setupenvironment -configarchitecture 'amd64' 'i386' - -insertpackage 'unstable-mp' 'crda' 'i386,amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda -Multi-Arch: foreign' -insertpackage 'unstable-m' 'crda' 'i386,amd64' '1.1.1-1ubuntu4m' 'Multi-Arch: foreign' -insertpackage 'unstable-p' 'crda' 'i386,amd64' '1.1.1-1ubuntu4p' 'Provides: wireless-crda' -insertpackage 'unstable' 'wireless-crda' 'i386,amd64' '1.16' - - -insertinstalledpackage 'wireless-crda' 'amd64' '1.14' - -setupaptarchive - -testsuccessequal 'Reading package lists... -Building dependency tree... -The following NEW packages will be installed: - crda -0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. -Inst crda (1.1.1-1ubuntu4m unstable-m [amd64]) -Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m - -testsuccessequal 'Reading package lists... -Building dependency tree... -The following NEW packages will be installed: - crda -0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. -Inst crda (1.1.1-1ubuntu4p unstable-p [amd64]) -Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p - -testsuccessequal 'Reading package lists... -Building dependency tree... -The following NEW packages will be installed: - crda -0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. -Inst crda (1.1.1-1ubuntu4mp unstable-mp [amd64]) -Conf crda (1.1.1-1ubuntu4mp unstable-mp [amd64])' aptget install crda -s -t unstable-mp - -rm rootdir/var/lib/dpkg/status -insertinstalledpackage 'crda' 'amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda -Conflicts: wireless-crda (<< 1.15) -Replaces: wireless-crda ( << 1.15) -Multi-arch: foreign' - -testsuccessequal 'Reading package lists... -Building dependency tree... -The following NEW packages will be installed: - wireless-crda -0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. -Inst wireless-crda (1.16 unstable [amd64]) -Conf wireless-crda (1.16 unstable [amd64])' aptget install wireless-crda -s -t unstable diff --git a/test/integration/test-parse-all-archs-into-cache b/test/integration/test-parse-all-archs-into-cache new file mode 100755 index 000000000..7741563e3 --- /dev/null +++ b/test/integration/test-parse-all-archs-into-cache @@ -0,0 +1,91 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'bar' 'i386' '1' 'Depends: foo' +insertpackage 'unstable' 'foo' 'i386' '1' 'Multi-Arch: foreign +Depends: libfoo1' +insertpackage 'unstable' 'libfoo1' 'i386' '1' 'Multi-Arch: same' +insertpackage 'experimental' 'foo' 'i386' '2' 'Multi-Arch: foreign +Depends: libfoo1 (>= 2)' +insertpackage 'experimental' 'libfoo1' 'i386' '2' 'Multi-Arch: same' + +# note: the system has amd64 not configured! +insertinstalledpackage 'foo' 'amd64' '1' 'Multi-Arch: foreign +Depends: libfoo1' + +setupaptarchive + +testfailureequal "Reading package lists... +Building dependency tree... +You might want to run 'apt-get -f install' to correct these. +The following packages have unmet dependencies: + foo:amd64 : Depends: libfoo1:amd64 but it is not installable +E: Unmet dependencies. Try using -f." aptget check -s + +insertinstalledpackage 'libfoo1' 'amd64' '1' 'Multi-Arch: same' + +testsuccessequal 'Reading package lists... +Building dependency tree...' aptget check -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + libfoo1 +The following packages will be REMOVED: + foo:amd64 +The following NEW packages will be installed: + foo libfoo1 +0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. +Remv foo:amd64 [1] +Inst libfoo1 (1 unstable [i386]) +Inst foo (1 unstable [i386]) +Conf libfoo1 (1 unstable [i386]) +Conf foo (1 unstable [i386])' aptget install foo -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + libfoo1 +The following packages will be REMOVED: + foo:amd64 libfoo1:amd64 +The following NEW packages will be installed: + foo libfoo1 +0 upgraded, 2 newly installed, 2 to remove and 0 not upgraded. +Remv foo:amd64 [1] +Remv libfoo1:amd64 [1] +Inst libfoo1 (2 experimental [i386]) +Inst foo (2 experimental [i386]) +Conf libfoo1 (2 experimental [i386]) +Conf foo (2 experimental [i386])' aptget install foo/experimental -s + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following additional packages will be installed: + foo libfoo1 +The following packages will be REMOVED: + foo:amd64 +The following NEW packages will be installed: + bar foo libfoo1 +0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. +Remv foo:amd64 [1] +Inst libfoo1 (1 unstable [i386]) +Inst foo (1 unstable [i386]) +Inst bar (1 unstable [i386]) +Conf libfoo1 (1 unstable [i386]) +Conf foo (1 unstable [i386]) +Conf bar (1 unstable [i386])' aptget install bar -s + +configarchitecture 'i386' 'amd64' + +testsuccessequal '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 unstable [i386]) +Conf bar (1 unstable [i386])' aptget install bar -s diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 7d72a6944..e5fe21e0f 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -42,6 +42,8 @@ wasmergeused() { testrun() { msgmsg "Testcase: setup the base with: $*" + local DOWNLOADHASH=true + if [ "$1" = 'nohash' ]; then DOWNLOADHASH=false; shift; fi find aptarchive -name 'Packages*' -type f -delete cp ${PKGFILE} aptarchive/Packages compressfile 'aptarchive/Packages' @@ -76,6 +78,15 @@ SHA256-History: SHA256-Patches: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX + if $DOWNLOADHASH; then + echo "SHA1-Download: + 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz + $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz) +SHA256-Download: + d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz + $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX + fi + generatereleasefiles '+1hour' signreleasefiles find aptarchive -name 'Packages*' -type f -delete @@ -87,7 +98,7 @@ SHA256-Patches: msgmsg "Testcase: index is already up-to-date: $*" find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete testsuccess aptget update "$@" - testequal 'Hit http://localhost:8080 InRelease + testequal 'Hit:1 http://localhost:8080 InRelease Reading package lists...' aptget update "$@" -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Diffs=0 testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff @@ -131,6 +142,17 @@ SHA256-Patches: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE) $(sha256sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX + if $DOWNLOADHASH; then + echo "SHA1-Download: + 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz + $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz) + $(sha1sum ${PATCHFILE2}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}.gz) $(basename ${PATCHFILE2}.gz) +SHA256-Download: + d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz + $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz) + $(sha256sum ${PATCHFILE2}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}.gz) $(basename ${PATCHFILE2}.gz)" >> $PATCHINDEX + fi + generatereleasefiles '+2hour' signreleasefiles cp -a aptarchive/Packages Packages-future @@ -150,6 +172,7 @@ SHA256-Patches: 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: @@ -165,11 +188,22 @@ SHA256-History: SHA256-Patches: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX - echo 'I am Mallory and I change files' >> $PATCHFILE + if $DOWNLOADHASH; then + echo "SHA1-Download: + 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz + $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz) +SHA256-Download: + d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz + $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX + fi + # needs to look like a valid command, otherwise the parser will fail before hashes are checked + echo '1d' > $PATCHFILE cat $PATCHFILE | gzip > ${PATCHFILE}.gz generatereleasefiles '+1hour' signreleasefiles testsuccess aptget update "$@" + cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output + testsuccess grep 'Hash Sum mismatch' rootdir/tmp/aptgetupdate.output testnopackage oldstuff testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt newstuff @@ -198,6 +232,14 @@ SHA256-History: SHA256-Patches: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28 $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE)000 $(basename $PATCHFILE)" > $PATCHINDEX + if $DOWNLOADHASH; then + echo "SHA1-Download: + 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz + $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz)000 $(basename ${PATCHFILE}.gz) +SHA256-Download: + d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz + $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz)000 $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX + fi generatereleasefiles '+1hour' signreleasefiles #find aptarchive -name 'Packages*' -type f -delete @@ -212,6 +254,9 @@ echo 'Debug::pkgAcquire::Diffs "true"; Debug::Acquire::Transaction "true"; Debug::pkgAcquire::rred "true";' > rootdir/etc/apt/apt.conf.d/rreddebug.conf +testrun nohash -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1 +testrun nohash -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1 + 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 diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 2675b51bc..ea266e934 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -20,9 +20,9 @@ testequalpolicy() { testsuccessequal "Package files: $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS} release a=now - $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages + $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} Packages release c= -Pinned packages:" aptcache policy $* +Pinned packages:" aptcache policy "$@" } testglobalpolicy() { @@ -89,11 +89,6 @@ testequalpolicycoolstuff() { local AB="$3" local AS="$4" local PB="$5" - local PINVERSION="$6" - if [ -n "$PINVERSION" ]; then - PINVERSION="Package pin: $PINVERSION - " - fi local IS="" local IB="" local SB="" @@ -105,11 +100,12 @@ testequalpolicycoolstuff() { local BPO1ARCHIVE="" local BPO2ARCHIVE="" if [ ! "$7" = "2.0~bpo2" ]; then - BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + BPO1PIN="$AB" + BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages" else BPO2ARCHIVE=" - 2.0~bpo2 $PB - $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + 2.0~bpo2 $AB + $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages" SB="$(echo "$SB" | tail -n 1)" shift fi @@ -117,28 +113,28 @@ testequalpolicycoolstuff() { testsuccessequal "coolstuff: Installed: $INSTALLED Candidate: $CANDIDATE - ${PINVERSION}Version table:${BPO2ARCHIVE} + Version table:${BPO2ARCHIVE} $IB 2.0~bpo1 $PB ${BPO1ARCHIVE}$SB - $IS 1.0 $PB - $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \ + $IS 1.0 $AS + $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} stable/main i386 Packages$SS" \ aptcache policy coolstuff -o Policy=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $* } -testequalpolicycoolstuff "" "2.0~bpo1" 500 500 0 "" -testequalpolicycoolstuff "" "1.0" 500 990 0 "" -t stable -testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -t backports +testequalpolicycoolstuff "" "2.0~bpo1" 500 500 500 "" +testequalpolicycoolstuff "" "1.0" 500 990 500 "" -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 990 "" -t backports echo "Package: * Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=GlobalPin -testequalpolicycoolstuff "" "1.0" 200 990 0 "" -o Test=GlobalPin -t stable -testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=GlobalPin -t backports +testequalpolicycoolstuff "" "1.0" 200 500 200 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 200 990 200 "" -o Test=GlobalPin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 990 "" -o Test=GlobalPin -t backports echo "Package: * Pin: release n=backports Pin-Priority: 600" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=GlobalPin -testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=GlobalPin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 600 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 600 990 600 "" -o Test=GlobalPin -t stable echo "Package: coolstuff Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences @@ -165,18 +161,18 @@ sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" signreleasefiles aptgetupdate -testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic -testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable -testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=NotAutomatic -t backports +testequalpolicycoolstuff "" "1.0" 1 500 1 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 1 990 1 "" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 990 "" -o Test=NotAutomatic -t backports echo "Package: * Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 200 500 200 "" -o Test=NotAutomatic echo "Package: * Pin: release n=backports Pin-Priority: 600" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=NotAutomatic -testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 600 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 600 990 600 "" -o Test=NotAutomatic -t stable echo "Package: coolstuff Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences @@ -193,18 +189,18 @@ sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" signreleasefiles aptgetupdate -testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades -testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable -testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "" "1.0" 100 500 100 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 100 990 100 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 990 "" -o Test=ButAutomaticUpgrades -t backports echo "Package: * Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 200 500 200 "" -o Test=ButAutomaticUpgrades echo "Package: * Pin: release n=backports Pin-Priority: 600" > rootdir/etc/apt/preferences -testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=ButAutomaticUpgrades -testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 600 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 600 990 600 "" -o Test=ButAutomaticUpgrades -t stable echo "Package: coolstuff Pin: release n=backports Pin-Priority: 200" > rootdir/etc/apt/preferences @@ -218,18 +214,18 @@ testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpg rm rootdir/etc/apt/preferences testsuccess aptget install coolstuff -y -testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "1.0" "1.0" 100 500 100 "" -o Test=ButAutomaticUpgrades testsuccess aptget dist-upgrade -y -testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades -testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable -testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "1.0" "1.0" 100 500 100 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "1.0" "1.0" 100 990 100 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 990 "" -o Test=ButAutomaticUpgrades -t backports testsuccess aptget install coolstuff -t backports -y -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 100 "" -o Test=ButAutomaticUpgrades testsuccess aptget dist-upgrade -y -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 100 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 100 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 990 "" -o Test=ButAutomaticUpgrades -t backports rm incoming/backports.main.pkglist incoming/backports.main.srclist buildsimplenativepackage "coolstuff" "all" "2.0~bpo2" "backports" @@ -239,14 +235,74 @@ sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" signreleasefiles aptgetupdate -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=NotAutomatic -t backports +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 100 "" "2.0~bpo2" -o Test=NotAutomatic +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 100 "" "2.0~bpo2" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 100 "" "2.0~bpo2" -o Test=NotAutomatic -t backports sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" signreleasefiles aptgetupdate -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable -testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 100 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 100 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 100 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t backports + + +tmppath=$(readlink -f .) + +# Check 16-bit integers +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 32767 +" > rootdir/etc/apt/preferences + +testsuccess aptget install -s coolstuff -o PinPriority=32767 + +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: -32768 +" > rootdir/etc/apt/preferences +testsuccess aptget install -s coolstuff -o PinPriority=-32768 + + +# Check for 32-bit integers +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 32768 +" > rootdir/etc/apt/preferences + +testfailureequal "Reading package lists... +E: ${tmppath}/rootdir/etc/apt/preferences: Value 32768 is outside the range of valid pin priorities (-32768 to 32767)" \ + aptget install -s coolstuff -o PinPriority=32768 + + +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: -32769 +" > rootdir/etc/apt/preferences + +testfailureequal "Reading package lists... +E: ${tmppath}/rootdir/etc/apt/preferences: Value -32769 is outside the range of valid pin priorities (-32768 to 32767)" \ + aptget install -s coolstuff -o PinPriority=-32769 + +# Check for 64-bit integers + +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 2147483648 +" > rootdir/etc/apt/preferences + +testfailureequal "Reading package lists... +E: Cannot convert 2147483648 to integer - (34: Numerical result out of range) +E: ${tmppath}/rootdir/etc/apt/preferences: Value 2147483648 is outside the range of valid pin priorities (-32768 to 32767)" \ + aptget install -s coolstuff -o PinPriority=2147483648 + +# Check for 0 +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 0 +" > rootdir/etc/apt/preferences + +testfailureequal "Reading package lists... +E: No priority (or zero) specified for pin" \ + aptget install -s coolstuff -o PinPriority=0 diff --git a/test/integration/test-prefer-higher-priority-providers b/test/integration/test-prefer-higher-priority-providers index 85a302fb1..e6da2e151 100755 --- a/test/integration/test-prefer-higher-priority-providers +++ b/test/integration/test-prefer-higher-priority-providers @@ -15,7 +15,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: awesome foo @@ -39,7 +39,7 @@ testsuccessequal "Reading package lists... Building dependency tree... Package 'bar' is not installed, so not removed Package 'baz' is not installed, so not removed -The following extra packages will be installed: +The following additional packages will be installed: foo The following NEW packages will be installed: awesome foo @@ -52,7 +52,7 @@ Conf awesome (1 unstable [all])" aptget install awesome bar- baz- -s testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: awesome bar @@ -66,7 +66,7 @@ testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed Package 'baz' is not installed, so not removed -The following extra packages will be installed: +The following additional packages will be installed: bar The following NEW packages will be installed: awesome bar @@ -80,7 +80,7 @@ testsuccessequal "Reading package lists... Building dependency tree... Package 'foo' is not installed, so not removed Package 'bar' is not installed, so not removed -The following extra packages will be installed: +The following additional packages will be installed: baz The following NEW packages will be installed: awesome baz diff --git a/test/integration/test-prefer-native-architecture-over-higher-priority b/test/integration/test-prefer-native-architecture-over-higher-priority index 7e4f8f34b..e7f8c28e7 100755 --- a/test/integration/test-prefer-native-architecture-over-higher-priority +++ b/test/integration/test-prefer-native-architecture-over-higher-priority @@ -14,7 +14,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: m4 The following NEW packages will be installed: autoconf m4 diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index 5f67c0191..11c120c53 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -83,7 +83,7 @@ E: Unable to correct problems, you have held broken packages.' aptget install de testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libsame3:i386 libsame3 The following NEW packages will be installed: depender3 libsame3 diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index a1a6a6142..1790e8381 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -56,7 +56,7 @@ setupaptarchive testfailureequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.1-1+sid) amarok-utils (2.3.1-1+sid) libc6 (2.11.2-7+sid) @@ -75,7 +75,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testfailureequal "Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -97,7 +97,7 @@ Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -119,7 +119,7 @@ Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -143,7 +143,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -173,7 +173,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-higher' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-higher' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-higher' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-higher' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -197,7 +197,7 @@ Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null2' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null2' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -221,7 +221,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-xine' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -245,7 +245,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine2' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine2' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine2' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -270,7 +270,7 @@ Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine3' because of 'amarok-xine3' Selected version '2.0' (experimental [all]) for 'intermediatepkg' because of 'phonon-backend-xine3' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine3' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) intermediatepkg (2.0) @@ -296,7 +296,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine4' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine4' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine4' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine4' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -320,7 +320,7 @@ Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-broken' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-broken' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-broken' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-broken' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -343,7 +343,7 @@ Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-recommends' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -365,12 +365,12 @@ testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) Recommended packages: amarok-utils (2.3.1-1+sid) phonon-backend-xine (4.6.0really4.4.2-1+sid) - phonon-backend () + | phonon-backend libmtp8 (0.3.1+sid) libc6 (2.11.2-7+sid) The following NEW packages will be installed: @@ -386,7 +386,7 @@ testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends2' Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends2' -The following extra packages will be installed: +The following additional packages will be installed: amarok-common (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index e000abf5d..43574ec3e 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -46,3 +46,12 @@ runtest 'accepted' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' runtest 'rejected' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 + +sed -i -e 's#\(deb\(-src\)\?\) #\1 [check-valid-until=no] #' rootdir/etc/apt/sources.list.d/* +runtest 'accepted' 'bad Until but overriden by sources option' 'now - 7 days' 'now - 4 days' + +sed -i -e 's#\(deb\(-src\)\?\) \[check-valid-until=no\] #\1 [valid-until-max=86400] #' rootdir/etc/apt/sources.list.d/* +runtest 'rejected' 'bad Max-Valid (good Until) via sources option' 'now - 7 days' 'now + 4 days' + +sed -i -e 's#\(deb\(-src\)\?\) \[valid-until-max=86400\] #\1 [valid-until-min=1209600] #' rootdir/etc/apt/sources.list.d/* +runtest 'accepted' 'good Min-Valid (bad Until) via sources option' 'now - 7 days' 'now - 4 days' diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 469ed34d2..c4d1455eb 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -36,12 +36,12 @@ installaptold() { testsuccessequal 'Reading package lists... Building dependency tree... Suggested packages: - aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt + aptitude | synaptic | wajig dpkg-dev apt-doc bzip2 lzma python-apt The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5370 kB of additional disk space will be used. -Get:1 http://localhost:8080/ apt 0.7.25.3 +Get:1 http://localhost:8080 apt 0.7.25.3 Download complete and in download only mode' aptget install apt -dy } @@ -49,12 +49,12 @@ installaptnew() { testsuccessequal 'Reading package lists... Building dependency tree... Suggested packages: - aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt + aptitude | synaptic | wajig dpkg-dev apt-doc bzip2 lzma python-apt The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5808 kB of additional disk space will be used. -Get:1 http://localhost:8080/ apt 0.8.0~pre1 +Get:1 http://localhost:8080 apt 0.8.0~pre1 Download complete and in download only mode' aptget install apt -dy } @@ -62,28 +62,28 @@ failaptold() { testfailureequal 'Reading package lists... Building dependency tree... Suggested packages: - aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt + aptitude | synaptic | wajig dpkg-dev apt-doc bzip2 lzma python-apt The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5370 kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! apt -E: There are problems and -y was used without --force-yes' aptget install apt -dy +E: There were unauthenticated packages and -y was used without --allow-unauthenticated' aptget install apt -dy } failaptnew() { testfailureequal 'Reading package lists... Building dependency tree... Suggested packages: - aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt + aptitude | synaptic | wajig dpkg-dev apt-doc bzip2 lzma python-apt The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5808 kB of additional disk space will be used. WARNING: The following packages cannot be authenticated! apt -E: There are problems and -y was used without --force-yes' aptget install apt -dy +E: There were unauthenticated packages and -y was used without --allow-unauthenticated' aptget install apt -dy } # fake our downloadable file @@ -92,7 +92,7 @@ touch aptarchive/apt.deb PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" updatewithwarnings() { - testwarning aptget update + testwarning aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 testsuccess grep -E "$1" rootdir/tmp/testwarning.output } @@ -139,11 +139,6 @@ runtest() { failaptold prepare ${PKGFILE}-new - # weborf doesn't support If-Range - for release in $(find rootdir/var/lib/apt/lists/partial/ -name '*Release'); do - rm $release - touch $release - done signreleasefiles 'Joe Sixpack' find aptarchive/ -name "$DELETEFILE" -delete msgmsg 'Bad warm archive signed by' 'Joe Sixpack' @@ -191,6 +186,48 @@ runtest() { testsuccessequal "$(cat ${PKGFILE}-new) " aptcache show apt installaptnew + + prepare ${PKGFILE} + rm -rf rootdir/var/lib/apt/lists + signreleasefiles 'Marvin Paranoid' + find aptarchive/ -name "$DELETEFILE" -delete + msgmsg 'Cold archive signed by good keyring' 'Marvin Paranoid' + local MARVIN="$(readlink -f keys/marvinparanoid.pub)" + sed -i "s#^\(deb\(-src\)\?\) #\1 [signed-by=$MARVIN] #" rootdir/etc/apt/sources.list.d/* + testsuccess aptget update -o Debug::pkgAcquire::Worker=1 + testsuccessequal "$(cat ${PKGFILE}) +" aptcache show apt + installaptold + + rm -rf rootdir/var/lib/apt/lists + signreleasefiles 'Joe Sixpack' + find aptarchive/ -name "$DELETEFILE" -delete + msgmsg 'Cold archive signed by bad keyring' 'Joe Sixpack' + updatewithwarnings '^W: .* NO_PUBKEY' + + sed -i "s#^\(deb\(-src\)\?\) \[signed-by=$MARVIN\] #\1 #" rootdir/etc/apt/sources.list.d/* + local MARVIN="$(aptkey --keyring $MARVIN finger | grep 'Key fingerprint' | cut -d'=' -f 2 | tr -d ' ')" + + prepare ${PKGFILE} + rm -rf rootdir/var/lib/apt/lists + signreleasefiles 'Marvin Paranoid' + find aptarchive/ -name "$DELETEFILE" -delete + msgmsg 'Cold archive signed by good keyid' 'Marvin Paranoid' + sed -i "s#^\(deb\(-src\)\?\) #\1 [signed-by=$MARVIN] #" rootdir/etc/apt/sources.list.d/* + cp keys/marvinparanoid.pub rootdir/etc/apt/trusted.gpg.d/marvinparanoid.gpg + testsuccess aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1 + testsuccessequal "$(cat ${PKGFILE}) +" aptcache show apt + installaptold + rm -f rootdir/etc/apt/trusted.gpg.d/marvinparanoid.gpg + + rm -rf rootdir/var/lib/apt/lists + signreleasefiles 'Joe Sixpack' + find aptarchive/ -name "$DELETEFILE" -delete + msgmsg 'Cold archive signed by bad keyid' 'Joe Sixpack' + updatewithwarnings '^W: .* be verified because the public key is not available: .*' + + sed -i "s#^\(deb\(-src\)\?\) \[signed-by=$MARVIN\] #\1 #" rootdir/etc/apt/sources.list.d/* } runtest2() { diff --git a/test/integration/test-sourceslist-lang-plusminus-options b/test/integration/test-sourceslist-lang-plusminus-options new file mode 100755 index 000000000..c61d5a4ca --- /dev/null +++ b/test/integration/test-sourceslist-lang-plusminus-options @@ -0,0 +1,87 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'native' + +testlangs() { + msgtest 'Test acquired languages for' "$1" + local LANGS="$2" + shift 2 + rm -f gotlangs.list + aptget indextargets --no-release-info 'Created-By: Translations' "$@" --format '$(LANGUAGE)' | sort -u > gotlangs.list + if [ -z "$LANGS" ]; then + echo -n | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail + else + echo -n "$LANGS" | tr ',' '\n' | sort | checkdiff - gotlangs.list && msgpass || msgfail + fi +} +echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'default' 'en' + +echo 'Acquire::Languages "environment,en";' > rootdir/etc/apt/apt.conf.d/langs.conf +testlangs 'default config' 'en' + +echo 'Acquire::Languages "en,en,en";' > rootdir/etc/apt/apt.conf.d/langs.conf +testlangs 'duplicated config' 'en' + +echo 'Acquire::Languages "none";' > rootdir/etc/apt/apt.conf.d/langs.conf +testlangs 'none config' '' + +echo 'Acquire::Languages "en,none,de,de_DE";' > rootdir/etc/apt/apt.conf.d/langs.conf +testlangs 'english + german config' 'en,de,de_DE' + +echo 'deb [lang=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang=pt' 'pt' + +echo 'deb [lang=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang=en' 'en' + +echo 'deb [lang=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang=de_DE' 'de_DE' + +echo 'deb [lang=none] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang=none' '' +testequal 'amd64' aptget indextargets --no-release-info 'Created-By: Packages' --format '$(ARCHITECTURE)' + +echo 'deb [lang+=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang+=pt' 'en,de,de_DE,pt' + +echo 'deb [lang+=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang+=en' 'en,de,de_DE' + +echo 'deb [lang+=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang+=de_DE' 'en,de,de_DE' + +echo 'deb [lang-=pt] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang-=pt' 'en,de,de_DE' + +echo 'deb [lang-=en] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang-=en' 'de,de_DE' + +echo 'deb [lang-=de_DE] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testlangs 'lang-=de_DE' 'en,de' + +echo 'deb http://example.org/debian stable rocks +deb http://example.org/debian stable solid' > rootdir/etc/apt/sources.list +testlangs 'english + german config multicomponent' 'en,de,de_DE' + +echo 'deb http://example.org/debian stable rocks +deb [lang=pt] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list +testlangs 'multicomponent one lang= combined' 'en,de,de_DE,pt' +testlangs 'multicomponent one lang= rocks' 'en,de,de_DE' 'Component: rocks' +testlangs 'multicomponent one lang= solid' 'pt' 'Component: solid' + +echo 'deb [lang=pt] http://example.org/debian stable rocks +deb [lang=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list +testlangs 'multicomponent different lang= combined' 'de,pt' +testlangs 'multicomponent different lang= rocks' 'pt' 'Component: rocks' +testlangs 'multicomponent different lang= solid' 'de' 'Component: solid' + +echo 'deb [lang+=pt] http://example.org/debian stable rocks +deb [lang-=de] http://example.org/debian stable solid' > rootdir/etc/apt/sources.list +testlangs 'multicomponent different lang+-= combined' 'en,de,de_DE,pt' +testlangs 'multicomponent different lang+-= rocks' 'en,de,de_DE,pt' 'Component: rocks' +testlangs 'multicomponent different lang+-= solid' 'en,de_DE' 'Component: solid' diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options index 5fe4933ce..86036e242 100755 --- a/test/integration/test-sourceslist-trusted-options +++ b/test/integration/test-sourceslist-trusted-options @@ -199,3 +199,20 @@ insecureaptgetupdate everythingfails everythingfails -t stable everythingfails -t testing + +msgmsg 'Test conflicting trusted options are refused' +testsource() { + echo "$@" > rootdir/etc/apt/sources.list.d/example.list + testfailuremsg 'E: Conflicting values set for option Trusted concerning source http://example.org/bad/ unstable +E: The list of sources could not be read.' aptget update --print-uris +} +for VAL in 'yes' 'no'; do + testsource "deb http://example.org/bad unstable main +deb [trusted=${VAL}] http://example.org/bad unstable non-free" + testsource "deb [trusted=${VAL}] http://example.org/bad unstable main +deb http://example.org/bad unstable non-free" +done +testsource 'deb [trusted=yes] http://example.org/bad unstable main +deb [trusted=no] http://example.org/bad unstable non-free' +testsource 'deb [trusted=no] http://example.org/bad unstable main +deb [trusted=yes] http://example.org/bad unstable non-free' diff --git a/test/integration/test-specific-architecture-dependencies b/test/integration/test-specific-architecture-dependencies index 1c72d7b22..f6635a4d6 100755 --- a/test/integration/test-specific-architecture-dependencies +++ b/test/integration/test-specific-architecture-dependencies @@ -35,7 +35,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6:i386 The following NEW packages will be installed: libc6:i386 pre-depender @@ -47,7 +47,7 @@ Conf pre-depender (1 unstable [all])' aptget install pre-depender -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6:i386 The following NEW packages will be installed: depender libc6:i386 @@ -59,7 +59,7 @@ Conf depender (1 unstable [all])' aptget install depender -s testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6:i386 The following NEW packages will be installed: depender-x32:i386 libc6:i386 @@ -71,7 +71,7 @@ Conf depender-x32:i386 (1 unstable [i386])' aptget install depender-x32:i386 -s testequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6:i386 The following NEW packages will be installed: depender-x32 libc6:i386 @@ -83,7 +83,7 @@ Conf depender-x32 (1 unstable [amd64])' aptget install depender-x32:amd64 -s testequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6 The following NEW packages will be installed: depender-x64 libc6 @@ -95,7 +95,7 @@ Conf depender-x64 (1 unstable [amd64])' aptget install depender-x64:amd64 -s testequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6 The following NEW packages will be installed: depender-x64:i386 libc6 @@ -267,7 +267,7 @@ configarchitecture 'amd64' testequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libc6 The following NEW packages will be installed: depender-x64 libc6 @@ -289,12 +289,14 @@ The following NEW packages will be installed: Inst foo-native-depender (1 unstable [amd64]) Conf foo-native-depender (1 unstable [amd64])' aptget install foo-native-depender -s -# libold:i386 is installed, but we don't see it as i386 isn't configured testequal 'Reading package lists... Building dependency tree... +The following packages will be REMOVED: + libold:i386 The following NEW packages will be installed: breaker-x32 -0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libold:i386 [1] Inst breaker-x32 (1 unstable [amd64]) Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32:amd64 -s diff --git a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum index ec74a750b..48a7f0562 100755 --- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum +++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum @@ -148,8 +148,8 @@ testok() { testsuccessequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] -Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] +Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B] +Get:2 http://localhost:8080 $1 1.0 (tar) [3 B] Download complete and in download only mode" aptget source -d "$@" msgtest 'Files were successfully downloaded for' "$1" testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz @@ -175,8 +175,12 @@ testmismatch() { testfailureequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] -Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] +Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B] +Err:1 http://localhost:8080 $1 1.0 (dsc) + Hash Sum mismatch +Get:2 http://localhost:8080 $1 1.0 (tar) [3 B] +Err:2 http://localhost:8080 $1 1.0 (tar) + Hash Sum mismatch E: Failed to fetch http://localhost:8080/${1}_1.0.dsc Hash Sum mismatch E: Failed to fetch http://localhost:8080/${1}_1.0.tar.gz Hash Sum mismatch @@ -199,8 +203,8 @@ Download complete and in download only mode" aptget source -d "$@" -o Acquire::F testsuccessequal "Reading package lists... Building dependency tree... Need to get 6 B of source archives. -Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B] -Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B] +Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B] +Get:2 http://localhost:8080 $1 1.0 (tar) [3 B] Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26 msgtest 'Files were downloaded unauthenticated as user allowed it' "$1" testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz @@ -236,8 +240,10 @@ testok pkg-mixed-ok testfailureequal 'Reading package lists... Building dependency tree... Need to get 6 B of source archives. -Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) [3 B] -Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) [3 B] +Get:1 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (tar) [3 B] +Get:2 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (dsc) [3 B] +Err:2 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (dsc) + Hash Sum mismatch E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mismatch E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad @@ -246,8 +252,10 @@ testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-ba testfailureequal 'Reading package lists... Building dependency tree... Need to get 6 B of source archives. -Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) [3 B] -Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) [3 B] +Get:1 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (tar) [3 B] +Err:1 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (tar) + Hash Sum mismatch +Get:2 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (dsc) [3 B] E: Failed to fetch http://localhost:8080/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha2-bad diff --git a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings index 192ed5efc..2fc67096e 100755 --- a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings +++ b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings @@ -22,7 +22,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa:i386 The following NEW packages will be installed: libmesa:i386 steam:i386 @@ -33,7 +33,7 @@ Conf libmesa:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa:i386 The following NEW packages will be installed: libmesa:i386 steam:i386 @@ -47,7 +47,7 @@ cp rootdir/var/lib/dpkg/status default-status.dpkg insertinstalledpackage 'libmesa' 'amd64' '1' 'Multi-Arch: same' testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa:i386 The following NEW packages will be installed: libmesa:i386 steam:i386 @@ -58,7 +58,7 @@ Conf libmesa:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa libmesa:i386 The following NEW packages will be installed: libmesa:i386 steam:i386 @@ -78,7 +78,7 @@ Conflicts: libmesa Multi-Arch: same' testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa-lts:i386 The following NEW packages will be installed: libmesa-lts:i386 steam:i386 @@ -89,7 +89,7 @@ Conf libmesa-lts:i386 (1 stable [i386]) Conf steam:i386 (1 stable [i386])' aptget install steam -st stable testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libmesa-lts libmesa-lts:i386 The following NEW packages will be installed: libmesa-lts:i386 steam:i386 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 ea516fc12..8f468b376 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -36,8 +36,8 @@ ensure_n_canary_strings_in_dir() { LISTS='rootdir/var/lib/apt/lists' rm -rf rootdir/var/lib/apt/lists -msgtest 'Got expected failure message' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail +testfailure aptget update +testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 testequal 'lock @@ -48,8 +48,8 @@ for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_${f} done -msgtest 'Got expected failure message in' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail +testfailure aptget update +testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 4 ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 @@ -58,7 +58,8 @@ ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_InRelease rm -f $LISTS/localhost:8080_dists_stable_Release $LISTS/localhost:8080_dists_stable_Release.gpg msgtest 'excpected failure of' 'apt-get update' -aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail +testfailure aptget update +testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 3 ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index 7067713e8..6e0a53025 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -10,7 +10,7 @@ setupaptarchive # test success UPGRADE="Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: libdrm-intel1 libdrm-nouveau1 libmtdev1 libutouch-grail1 libx11-xcb1 libxcb-aux0 libxcb-dri2-0 libxfont1 xserver-common xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-mouse 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 754487a90..dbcb49a41 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -27,8 +27,9 @@ MD5Sum: 1b895931853981ad8204d2439821b999 4144 Packages.gz'; echo; cat ${RELEASE}.old;) > ${RELEASE} done -msgtest 'The unsigned garbage before signed block is' 'ignored' -aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail +testfailure aptget update +testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output + ROOTDIR="$(readlink -f .)" testsuccessequal "Package files: diff --git a/test/integration/test-ubuntu-bug-806274-install-suggests b/test/integration/test-ubuntu-bug-806274-install-suggests index 3f02316f4..2d1cfcd9f 100755 --- a/test/integration/test-ubuntu-bug-806274-install-suggests +++ b/test/integration/test-ubuntu-bug-806274-install-suggests @@ -17,7 +17,7 @@ setupaptarchive testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar foo Suggested packages: baz @@ -34,7 +34,7 @@ Conf bar (1.0 unstable [i386])' aptget install apt -s --install-recommends --no- testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: bar baz foo The following NEW packages will be installed: apt bar baz foo @@ -50,7 +50,7 @@ Conf baz (1.0 unstable [i386])' aptget install apt -s --install-recommends --ins testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: foo Suggested packages: baz @@ -66,7 +66,7 @@ Conf apt (0.8.15 unstable [i386])' aptget install apt -s --no-install-recommends testsuccessequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: baz foo Recommended packages: bar diff --git a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first index 269038d0f..9eab1cbfd 100755 --- a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first +++ b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first @@ -16,7 +16,7 @@ setupaptarchive testequalor2 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: apt:i386 libsame:i386 The following NEW packages will be installed: libsame @@ -30,7 +30,7 @@ Conf libsame (2 unstable [amd64]) [apt:i386 ] Inst apt:i386 [1] (2 unstable [i386]) Conf apt:i386 (2 unstable [i386])' 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: apt:i386 libsame:i386 The following NEW packages will be installed: libsame diff --git a/test/integration/test-unpack-different-version-unpacked b/test/integration/test-unpack-different-version-unpacked index ae121cf4e..cdc187d15 100755 --- a/test/integration/test-unpack-different-version-unpacked +++ b/test/integration/test-unpack-different-version-unpacked @@ -32,7 +32,7 @@ insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4:i386 The following packages will be upgraded: libqtcore4:i386 @@ -48,7 +48,7 @@ insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install o testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4 The following packages will be upgraded: libqtcore4 @@ -64,7 +64,7 @@ insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4:i386 The following packages will be upgraded: libqtcore4:i386 @@ -80,7 +80,7 @@ insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4 The following packages will be upgraded: libqtcore4 @@ -96,7 +96,7 @@ insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4:i386 The following packages will be upgraded: libqtcore4:i386 @@ -111,7 +111,7 @@ insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install o testsuccessequal 'Reading package lists... Building dependency tree... Correcting dependencies... Done -The following extra packages will be installed: +The following additional packages will be installed: libqtcore4 The following packages will be upgraded: libqtcore4 diff --git a/test/integration/test-xorg-break-providers b/test/integration/test-xorg-break-providers index ff1f3b077..57fd0e234 100755 --- a/test/integration/test-xorg-break-providers +++ b/test/integration/test-xorg-break-providers @@ -15,7 +15,7 @@ setupaptarchive testfailureequal 'Reading package lists... Building dependency tree... -The following extra packages will be installed: +The following additional packages will be installed: xserver-xorg-video-intel The following packages will be upgraded: xserver-xorg-core xserver-xorg-video-intel diff --git a/test/interactive-helper/testdeb.cc b/test/interactive-helper/testdeb.cc index 6aae9f563..69e1ffe0b 100644 --- a/test/interactive-helper/testdeb.cc +++ b/test/interactive-helper/testdeb.cc @@ -13,7 +13,7 @@ class NullStream : public pkgDirStream { public: - virtual bool DoItem(Item &/*Itm*/, int &/*Fd*/) {return true;}; + virtual bool DoItem(Item &/*Itm*/, int &/*Fd*/) APT_OVERRIDE {return true;}; }; static bool Test(const char *File) diff --git a/test/libapt/acqprogress_test.cc b/test/libapt/acqprogress_test.cc index 288e05aca..50792528d 100644 --- a/test/libapt/acqprogress_test.cc +++ b/test/libapt/acqprogress_test.cc @@ -1,4 +1,5 @@ #include <config.h> +#include <apt-pkg/hashes.h> #include <apt-pkg/acquire.h> #include <apt-pkg/acquire-item.h> #include <apt-pkg/configuration.h> @@ -10,9 +11,10 @@ class TestItem: public pkgAcquire::Item { public: - TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq, "", NULL) {} + TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq) {} - virtual std::string DescURI() { return ""; } + virtual std::string DescURI() const APT_OVERRIDE { return ""; } + virtual HashStringList GetExpectedHashes() const APT_OVERRIDE { return HashStringList(); } }; @@ -23,21 +25,23 @@ TEST(AcqProgress, IMSHit) AcqTextStatus Stat(out, width, 0); Stat.Start(); + pkgAcquire Acq(&Stat); pkgAcquire::ItemDesc hit; hit.URI = "http://example.org/file"; hit.Description = "Example File from example.org"; hit.ShortDesc = "Example File"; - hit.Owner = NULL; + TestItem hitO(&Acq); + hit.Owner = &hitO; EXPECT_EQ("", out.str()); Stat.IMSHit(hit); - EXPECT_EQ("Hit Example File from example.org\n", out.str()); + EXPECT_EQ("Hit:1 Example File from example.org\n", out.str()); Stat.IMSHit(hit); - EXPECT_EQ("Hit Example File from example.org\n" - "Hit Example File from example.org\n", out.str()); + EXPECT_EQ("Hit:1 Example File from example.org\n" + "Hit:1 Example File from example.org\n", out.str()); Stat.Stop(); - EXPECT_EQ("Hit Example File from example.org\n" - "Hit Example File from example.org\n", out.str()); + EXPECT_EQ("Hit:1 Example File from example.org\n" + "Hit:1 Example File from example.org\n", out.str()); } TEST(AcqProgress, FetchNoFileSize) { @@ -59,10 +63,10 @@ TEST(AcqProgress, FetchNoFileSize) EXPECT_EQ("Get:1 Example File from example.org\n", out.str()); Stat.Fetch(fetch); EXPECT_EQ("Get:1 Example File from example.org\n" - "Get:2 Example File from example.org\n", out.str()); + "Get:1 Example File from example.org\n", out.str()); Stat.Stop(); EXPECT_EQ("Get:1 Example File from example.org\n" - "Get:2 Example File from example.org\n", out.str()); + "Get:1 Example File from example.org\n", out.str()); } TEST(AcqProgress, FetchFileSize) { @@ -86,10 +90,10 @@ TEST(AcqProgress, FetchFileSize) fetchO.FileSize = 42; Stat.Fetch(fetch); EXPECT_EQ("Get:1 Example File from example.org [100 B]\n" - "Get:2 Example File from example.org [42 B]\n", out.str()); + "Get:1 Example File from example.org [42 B]\n", out.str()); Stat.Stop(); EXPECT_EQ("Get:1 Example File from example.org [100 B]\n" - "Get:2 Example File from example.org [42 B]\n", out.str()); + "Get:1 Example File from example.org [42 B]\n", out.str()); } TEST(AcqProgress, Fail) { @@ -110,30 +114,34 @@ TEST(AcqProgress, Fail) EXPECT_EQ("", out.str()); Stat.Fail(fetch); - EXPECT_EQ("", out.str()); + EXPECT_EQ("Ign:1 Example File from example.org\n", out.str()); fetchO.Status = pkgAcquire::Item::StatDone; Stat.Fail(fetch); - EXPECT_EQ("Ign Example File from example.org\n", out.str()); + EXPECT_EQ("Ign:1 Example File from example.org\n" + "Ign:1 Example File from example.org\n", out.str()); fetchO.Status = pkgAcquire::Item::StatError; fetchO.ErrorText = "An error test!"; Stat.Fail(fetch); - EXPECT_EQ("Ign Example File from example.org\n" - "Err Example File from example.org\n" + EXPECT_EQ("Ign:1 Example File from example.org\n" + "Ign:1 Example File from example.org\n" + "Err:1 Example File from example.org\n" " An error test!\n", out.str()); _config->Set("Acquire::Progress::Ignore::ShowErrorText", true); fetchO.Status = pkgAcquire::Item::StatDone; Stat.Fail(fetch); - EXPECT_EQ("Ign Example File from example.org\n" - "Err Example File from example.org\n" + EXPECT_EQ("Ign:1 Example File from example.org\n" + "Ign:1 Example File from example.org\n" + "Err:1 Example File from example.org\n" " An error test!\n" - "Ign Example File from example.org\n" + "Ign:1 Example File from example.org\n" " An error test!\n", out.str()); _config->Set("Acquire::Progress::Ignore::ShowErrorText", true); Stat.Stop(); - EXPECT_EQ("Ign Example File from example.org\n" - "Err Example File from example.org\n" + EXPECT_EQ("Ign:1 Example File from example.org\n" + "Ign:1 Example File from example.org\n" + "Err:1 Example File from example.org\n" " An error test!\n" - "Ign Example File from example.org\n" + "Ign:1 Example File from example.org\n" " An error test!\n", out.str()); } TEST(AcqProgress, Pulse) diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc index 7257eaf1b..b4c51cdb0 100644 --- a/test/libapt/cdrom_test.cc +++ b/test/libapt/cdrom_test.cc @@ -91,7 +91,7 @@ TEST(CDROMTest,ReduceSourcelist) } TEST(CDROMTest, FindMountPointForDevice) { - char * tempfile = NULL; + std::string tempfile; FileFd fd; createTemporaryFile("mountpoints", fd, &tempfile, "rootfs / rootfs rw 0 0\n" @@ -109,7 +109,6 @@ TEST(CDROMTest, FindMountPointForDevice) EXPECT_EQ("/boot/efi", FindMountPointForDevice("/dev/sda1")); EXPECT_EQ("/tmp", FindMountPointForDevice("tmpfs")); - if (tempfile != NULL) - unlink(tempfile); - free(tempfile); + if (tempfile.empty() == false) + unlink(tempfile.c_str()); } diff --git a/test/libapt/file-helpers.cc b/test/libapt/file-helpers.cc index 5edb9a9fe..6811c4158 100644 --- a/test/libapt/file-helpers.cc +++ b/test/libapt/file-helpers.cc @@ -53,20 +53,26 @@ void helperCreateLink(std::string const &dir, std::string const &targetname, std link.append(linkname); ASSERT_EQ(0, symlink(target.c_str(), link.c_str())); } -void helperCreateTemporaryFile(std::string const &id, FileFd &fd, char * * const filename, char const * const content) +void helperCreateTemporaryFile(std::string const &id, FileFd &fd, std::string * const filename, char const * const content) { std::string name("apt-test-"); - name.append(id).append(".XXXXXXXX"); + name.append(id); + size_t const giventmp = name.find(".XXXXXX."); + if (giventmp == std::string::npos) + name.append(".XXXXXX"); char * tempfile = strdup(name.c_str()); - int tempfile_fd = mkstemp(tempfile); + ASSERT_STRNE(NULL, tempfile); + int tempfile_fd; + if (giventmp == std::string::npos) + tempfile_fd = mkstemp(tempfile); + else + tempfile_fd = mkstemps(tempfile, name.length() - (giventmp + 7)); ASSERT_NE(-1, tempfile_fd); if (filename != NULL) *filename = tempfile; else - { unlink(tempfile); - free(tempfile); - } + free(tempfile); EXPECT_TRUE(fd.OpenDescriptor(tempfile_fd, FileFd::ReadWrite)); if (content != NULL) diff --git a/test/libapt/file-helpers.h b/test/libapt/file-helpers.h index e8472d503..f639c1cbc 100644 --- a/test/libapt/file-helpers.h +++ b/test/libapt/file-helpers.h @@ -24,6 +24,6 @@ void helperCreateDirectory(std::string const &dir, std::string const &name); void helperCreateLink(std::string const &dir, std::string const &targetname, std::string const &linkname); #define createTemporaryFile(id, fd, filename, content) \ ASSERT_NO_FATAL_FAILURE(helperCreateTemporaryFile(id, fd, filename, content)) -void helperCreateTemporaryFile(std::string const &id, FileFd &fd, char * * const filename, char const * const content); +void helperCreateTemporaryFile(std::string const &id, FileFd &fd, std::string * const filename, char const * const content); #endif diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index a2c303768..b42261716 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -290,10 +290,10 @@ TEST(FileUtlTest, Popen) TEST(FileUtlTest, flAbsPath) { std::string cwd = SafeGetCWD(); - int res = chdir("/bin/"); + int res = chdir("/etc/"); EXPECT_EQ(res, 0); - std::string p = flAbsPath("ls"); - EXPECT_EQ(p, "/bin/ls"); + std::string p = flAbsPath("passwd"); + EXPECT_EQ(p, "/etc/passwd"); res = chdir(cwd.c_str()); EXPECT_EQ(res, 0); diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index edcd8a11a..63c63ecd3 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -306,6 +306,7 @@ TEST(HashSumsTest, HashStringList) EXPECT_EQ(NULL, list.find(NULL)); EXPECT_EQ(NULL, list.find("")); EXPECT_EQ(NULL, list.find("MD5Sum")); + EXPECT_EQ(0, list.FileSize()); // empty lists aren't equal HashStringList list2; @@ -316,6 +317,8 @@ TEST(HashSumsTest, HashStringList) list.push_back(HashString("Checksum-FileSize", "29")); EXPECT_FALSE(list.empty()); EXPECT_FALSE(list.usable()); + EXPECT_EQ(1, list.size()); + EXPECT_EQ(29, list.FileSize()); Hashes hashes; hashes.Add("The quick brown fox jumps over the lazy dog"); diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc index 1b0427564..2d07dba15 100644 --- a/test/libapt/indexcopytosourcelist_test.cc +++ b/test/libapt/indexcopytosourcelist_test.cc @@ -15,10 +15,10 @@ class NoCopy : public IndexCopy { IndexCopy::ConvertToSourceList(CD, Path); return Path; } - bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; } - bool RewriteEntry(FileFd & /*Target*/, std::string const &/*File*/) { return false; } - const char *GetFileName() { return NULL; } - const char *Type() { return NULL; } + bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) APT_OVERRIDE { return false; } + bool RewriteEntry(FileFd & /*Target*/, std::string const &/*File*/) APT_OVERRIDE { return false; } + const char *GetFileName() APT_OVERRIDE { return NULL; } + const char *Type() APT_OVERRIDE { return NULL; } }; diff --git a/test/libapt/makefile b/test/libapt/makefile index 61a8aaf31..c078cc568 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -33,7 +33,7 @@ GTEST_DIR = /usr/src/gtest # Flags passed to the preprocessor. # Set Google Test's header directory as a system directory, such that # the compiler doesn't generate warnings in Google Test headers. -CPPFLAGS += -isystem $(GTEST_DIR)/include +#CPPFLAGS += -isystem $(GTEST_DIR)/include # Flags passed to the C++ compiler. CXXFLAGS += -pthread @@ -41,6 +41,7 @@ CXXFLAGS += -pthread CXXFLAGS+= -Wno-missing-declarations CXXFLAGS+= -Wno-missing-field-initializers CXXFLAGS+= -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-suggest-attribute=noreturn +CXXFLAGS+= -Wno-undef # All Google Test headers. Usually you shouldn't change this definition. GTEST_HEADERS = /usr/include/gtest/*.h \ diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 747ab4957..83c441092 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -12,32 +12,28 @@ #include "file-helpers.h" -class SourceList : public pkgSourceList { - public: - using pkgSourceList::ParseFileDeb822; -}; - TEST(SourceListTest,ParseFileDeb822) { FileFd fd; - char * tempfile = NULL; - createTemporaryFile("parsefiledeb822", fd, &tempfile, + std::string tempfile; + createTemporaryFile("parsefiledeb822.XXXXXX.sources", fd, &tempfile, "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" "Suites: stable\n" - "Sections: main\n" + "Components: main\n" "Description: short\n" " long description that can be very long\n" "\n" "Types: deb\n" "URIs: http://ftp.debian.org/debian\n" "Suites: unstable\n" - "Sections: main non-free\n"); + "Components: main non-free\n"); fd.Close(); - SourceList sources; - EXPECT_EQ(2, sources.ParseFileDeb822(tempfile)); + pkgSourceList sources; + EXPECT_EQ(true, sources.Read(tempfile)); EXPECT_EQ(2, sources.size()); - unlink(tempfile); + if (tempfile.empty() == false) + unlink(tempfile.c_str()); } diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc index 5d5ae9679..fe6015e65 100644 --- a/test/libapt/uri_test.cc +++ b/test/libapt/uri_test.cc @@ -13,6 +13,9 @@ TEST(URITest, BasicHTTP) EXPECT_EQ("www.debian.org", U.Host); EXPECT_EQ("/temp/test", U.Path); EXPECT_EQ("http://www.debian.org:90/temp/test", (std::string)U); + EXPECT_EQ("http://www.debian.org:90", URI::SiteOnly(U)); + EXPECT_EQ("http://www.debian.org:90/temp/test", URI::ArchiveOnly(U)); + EXPECT_EQ("http://www.debian.org:90/temp/test", URI::NoUserPassword(U)); // Login data U = URI("http://jgg:foo@ualberta.ca/blah"); EXPECT_EQ("http", U.Access); @@ -22,6 +25,9 @@ TEST(URITest, BasicHTTP) EXPECT_EQ("ualberta.ca", U.Host); EXPECT_EQ("/blah", U.Path); EXPECT_EQ("http://jgg:foo@ualberta.ca/blah", (std::string)U); + EXPECT_EQ("http://ualberta.ca", URI::SiteOnly(U)); + EXPECT_EQ("http://ualberta.ca/blah", URI::ArchiveOnly(U)); + EXPECT_EQ("http://ualberta.ca/blah", URI::NoUserPassword(U)); } TEST(URITest, SingeSlashFile) { @@ -33,6 +39,9 @@ TEST(URITest, SingeSlashFile) EXPECT_EQ("", U.Host); EXPECT_EQ("/usr/bin/foo", U.Path); EXPECT_EQ("file:/usr/bin/foo", (std::string)U); + EXPECT_EQ("file:", URI::SiteOnly(U)); + EXPECT_EQ("file:/usr/bin/foo", URI::ArchiveOnly(U)); + EXPECT_EQ("file:/usr/bin/foo", URI::NoUserPassword(U)); } TEST(URITest, BasicCDROM) { @@ -44,6 +53,9 @@ TEST(URITest, BasicCDROM) EXPECT_EQ("Moo Cow Rom", U.Host); EXPECT_EQ("/debian", U.Path); EXPECT_EQ("cdrom://Moo Cow Rom/debian", (std::string)U); + EXPECT_EQ("cdrom://Moo Cow Rom", URI::SiteOnly(U)); + EXPECT_EQ("cdrom://Moo Cow Rom/debian", URI::ArchiveOnly(U)); + EXPECT_EQ("cdrom://Moo Cow Rom/debian", URI::NoUserPassword(U)); } TEST(URITest, RelativeGzip) { @@ -55,6 +67,9 @@ TEST(URITest, RelativeGzip) EXPECT_EQ(".", U.Host); EXPECT_EQ("/bar/cow", U.Path); EXPECT_EQ("gzip://./bar/cow", (std::string)U); + EXPECT_EQ("gzip://.", URI::SiteOnly(U)); + EXPECT_EQ("gzip://./bar/cow", URI::ArchiveOnly(U)); + EXPECT_EQ("gzip://./bar/cow", URI::NoUserPassword(U)); } TEST(URITest, NoSlashFTP) { @@ -66,6 +81,9 @@ TEST(URITest, NoSlashFTP) EXPECT_EQ("ftp.fr.debian.org", U.Host); EXPECT_EQ("/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", U.Path); EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", (std::string)U); + EXPECT_EQ("ftp://ftp.fr.debian.org", URI::SiteOnly(U)); + EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", URI::ArchiveOnly(U)); + EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", URI::NoUserPassword(U)); } TEST(URITest, RFC2732) { @@ -77,6 +95,9 @@ TEST(URITest, RFC2732) EXPECT_EQ("1080::8:800:200C:417A", U.Host); EXPECT_EQ("/foo", U.Path); EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", (std::string)U); + EXPECT_EQ("http://[1080::8:800:200C:417A]", URI::SiteOnly(U)); + EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", URI::ArchiveOnly(U)); + EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", URI::NoUserPassword(U)); // with port U = URI("http://[::FFFF:129.144.52.38]:80/index.html"); EXPECT_EQ("http", U.Access); @@ -86,6 +107,9 @@ TEST(URITest, RFC2732) EXPECT_EQ("::FFFF:129.144.52.38", U.Host); EXPECT_EQ("/index.html", U.Path); EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", (std::string)U); + EXPECT_EQ("http://[::FFFF:129.144.52.38]:80", URI::SiteOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", URI::ArchiveOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", URI::NoUserPassword(U)); // extra colon U = URI("http://[::FFFF:129.144.52.38:]:80/index.html"); EXPECT_EQ("http", U.Access); @@ -95,6 +119,9 @@ TEST(URITest, RFC2732) EXPECT_EQ("::FFFF:129.144.52.38:", U.Host); EXPECT_EQ("/index.html", U.Path); EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", (std::string)U); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80", URI::SiteOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", URI::ArchiveOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", URI::NoUserPassword(U)); // extra colon port U = URI("http://[::FFFF:129.144.52.38:]/index.html"); EXPECT_EQ("http", U.Access); @@ -104,6 +131,9 @@ TEST(URITest, RFC2732) EXPECT_EQ("::FFFF:129.144.52.38:", U.Host); EXPECT_EQ("/index.html", U.Path); EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", (std::string)U); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]", URI::SiteOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", URI::ArchiveOnly(U)); + EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", URI::NoUserPassword(U)); // My Evil Corruption of RFC 2732 to handle CDROM names! // Fun for the whole family! */ U = URI("cdrom:[The Debian 1.2 disk, 1/2 R1:6]/debian/"); @@ -114,6 +144,9 @@ TEST(URITest, RFC2732) EXPECT_EQ("The Debian 1.2 disk, 1/2 R1:6", U.Host); EXPECT_EQ("/debian/", U.Path); EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian/", (std::string)U); + EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]", URI::SiteOnly(U)); + EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian", URI::ArchiveOnly(U)); + EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian/", URI::NoUserPassword(U)); // no brackets U = URI("cdrom:Foo Bar Cow/debian/"); EXPECT_EQ("cdrom", U.Access); @@ -123,9 +156,15 @@ TEST(URITest, RFC2732) EXPECT_EQ("Foo Bar Cow", U.Host); EXPECT_EQ("/debian/", U.Path); EXPECT_EQ("cdrom://Foo Bar Cow/debian/", (std::string)U); + EXPECT_EQ("cdrom://Foo Bar Cow", URI::SiteOnly(U)); + EXPECT_EQ("cdrom://Foo Bar Cow/debian", URI::ArchiveOnly(U)); + EXPECT_EQ("cdrom://Foo Bar Cow/debian/", URI::NoUserPassword(U)); // percent encoded U = URI("ftp://foo:b%40r@example.org"); EXPECT_EQ("foo", U.User); EXPECT_EQ("b@r", U.Password); EXPECT_EQ("ftp://foo:b%40r@example.org/", (std::string) U); + EXPECT_EQ("ftp://example.org", URI::SiteOnly(U)); + EXPECT_EQ("ftp://example.org", URI::ArchiveOnly(U)); + EXPECT_EQ("ftp://example.org/", URI::NoUserPassword(U)); } |