From d4b4e5ea2ceb02699e746d52256b3a8ac2d9bda2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 30 Aug 2012 12:21:32 +0200 Subject: * apt-pkg/packagemanager.cc: - unpack versions in case a different version from the package is currently in unpack state to recover from broken system states (like different file in M-A:same package and other dpkg errors) --- test/integration/framework | 3 +- .../test-unpack-different-version-unpacked | 121 +++++++++++++++++++++ 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100755 test/integration/test-unpack-different-version-unpacked (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index da85d2332..05878d0a4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -523,11 +523,12 @@ insertinstalledpackage() { local VERSION="$3" local DEPENDENCIES="$4" local PRIORITY="${5:-optional}" + local STATUS="${6:-install ok installed}" local FILE='rootdir/var/lib/dpkg/status' local INFO='rootdir/var/lib/dpkg/info' for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do echo "Package: $NAME -Status: install ok installed +Status: $STATUS Priority: $PRIORITY Section: other Installed-Size: 42 diff --git a/test/integration/test-unpack-different-version-unpacked b/test/integration/test-unpack-different-version-unpacked new file mode 100755 index 000000000..952f6e6b2 --- /dev/null +++ b/test/integration/test-unpack-different-version-unpacked @@ -0,0 +1,121 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable' 'libqtcore4' 'i386,amd64' '2' 'Multi-Arch: same' +setupaptarchive + +DPKGSTATUS='rootdir/var/lib/dpkg/status' +cp $DPKGSTATUS dpkg.status + +cleanstatus() { + cp dpkg.status $DPKGSTATUS + rm rootdir/var/cache/apt/*.bin +} + +#FIXME: the reported version is wrong, it should be 1, not 2 +insertinstalledpackage 'libqtcore4' 'i386,amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' +testequal 'Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. +2 not fully installed or removed. +Conf libqtcore4 (2 unstable [amd64]) +Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked' +insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4:i386 +The following packages will be upgraded: + libqtcore4:i386 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +2 not fully installed or removed. +Inst libqtcore4:i386 [1] (2 unstable [i386]) +Conf libqtcore4:i386 (2 unstable [i386]) +Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked' +insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4 +The following packages will be upgraded: + libqtcore4 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +2 not fully installed or removed. +Inst libqtcore4 [1] (2 unstable [amd64]) +Conf libqtcore4 (2 unstable [amd64]) +Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked' +insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4:i386 +The following packages will be upgraded: + libqtcore4:i386 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst libqtcore4:i386 [1] (2 unstable [i386]) +Conf libqtcore4:i386 (2 unstable [i386]) +Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked' +insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4 +The following packages will be upgraded: + libqtcore4 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst libqtcore4 [1] (2 unstable [amd64]) +Conf libqtcore4 (2 unstable [amd64]) +Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' +insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4:i386 +The following packages will be upgraded: + libqtcore4:i386 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst libqtcore4:i386 [1] (2 unstable [i386]) +Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f + +cleanstatus +insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' +insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked' +testequal 'Reading package lists... +Building dependency tree... +Correcting dependencies... Done +The following extra packages will be installed: + libqtcore4 +The following packages will be upgraded: + libqtcore4 +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst libqtcore4 [1] (2 unstable [amd64]) +Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f -- cgit v1.2.3 From c45233eaf6d08bb6bb6e2dbb57c90a1d52ca9a43 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Sep 2012 12:28:19 +0200 Subject: * apt-pkg/cdrom.cc: - copy only configured translation files from a CD-ROM and not all available translation files preventing new installs with d-i from being initialized with all translations (Closes: #678227) - handle Components in the reduction for the source.list as multi-arch CDs otherwise create duplicated source entries (e.g. "wheezy main main") --- test/integration/framework | 16 +++++++ test/integration/test-apt-cdrom | 104 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100755 test/integration/test-apt-cdrom (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 05878d0a4..57bf555af 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -91,6 +91,7 @@ runapt() { } aptconfig() { runapt apt-config $*; } aptcache() { runapt apt-cache $*; } +aptcdrom() { runapt apt-cdrom $*; } aptget() { runapt apt-get $*; } aptftparchive() { runapt apt-ftparchive $*; } aptkey() { runapt apt-key $*; } @@ -715,6 +716,21 @@ server.stat-cache-engine = \"disable\"" > lighttpd.conf return 0 } +changetocdrom() { + mkdir -p rootdir/media/cdrom/.disk + local CD="$(readlink -f rootdir/media/cdrom)" + echo "acquire::cdrom::mount \"${CD}\";" > rootdir/etc/apt/apt.conf.d/00cdrom + echo 'acquire::cdrom::autodetect 0;' >> rootdir/etc/apt/apt.conf.d/00cdrom + echo -n "$1" > ${CD}/.disk/info + if [ ! -d aptarchive/dists ]; then + msgdie 'Flat file archive cdroms can not be created currently' + return 1 + fi + mv aptarchive/dists $CD + ln -s "$(readlink -f ./incoming)" $CD/pool + find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete +} + checkdiff() { local DIFFTEXT="$($(which diff) -u $* | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom new file mode 100755 index 000000000..f24c99b36 --- /dev/null +++ b/test/integration/test-apt-cdrom @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' +setupaptarchive + +changetocdrom 'Debian APT Testdisk 0.8.15' + +# -de is not in the Release file, but picked up anyway for compatibility +cd rootdir/media/cdrom/dists/stable/main/i18n +sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de +echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable + Diese Pakete sind nur für das testen von APT gedacht, + sie erfüllen keinen Zweck auf einem normalen System… +' >> Translation-de +cat Translation-de | gzip > Translation-de.gz +cat Translation-de | bzip2 > Translation-de.bz2 +cat Translation-de | xz --format=lzma > Translation-de.lzma +cat Translation-de | xz > Translation-de.xz +rm Translation-en Translation-de +cd - > /dev/null + +aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 +sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log +testfileequal apt-cdrom.log "Scanning disc for index files.. +Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures +Found label 'Debian APT Testdisk 0.8.15' +This disc is called: +'Debian APT Testdisk 0.8.15' +Writing new source list +Source list entries for this disc are: +deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main +deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Repeat this process for the rest of the CDs in your set." + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + testing +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst testing (0.8.15 stable [amd64]) +Conf testing (0.8.15 stable [amd64])' aptget install testing -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + testing:i386 +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst testing:i386 (0.8.15 stable [i386]) +Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s + +# check Idempotence of apt-cdrom (and disabling of Translation dropping) +aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1 +sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log +testfileequal apt-cdrom.log "Scanning disc for index files.. +Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures +This disc is called: +'Debian APT Testdisk 0.8.15' +Writing new source list +Source list entries for this disc are: +deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main +deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Repeat this process for the rest of the CDs in your set." + +# take Translations from previous runs as needed +aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 +sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log +testfileequal apt-cdrom.log "Scanning disc for index files.. +Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures +This disc is called: +'Debian APT Testdisk 0.8.15' +Writing new source list +Source list entries for this disc are: +deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main +deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Repeat this process for the rest of the CDs in your set." +msgtest 'Test for the german description translation of' 'testing' +aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail +rm -rf rootdir/var/lib/apt/lists +mkdir -p rootdir/var/lib/apt/lists/partial +aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 +sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log +testfileequal apt-cdrom.log "Scanning disc for index files.. +Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures +This disc is called: +'Debian APT Testdisk 0.8.15' +Writing new source list +Source list entries for this disc are: +deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main +deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Repeat this process for the rest of the CDs in your set." +msgtest 'Test for the english description translation of' 'testing' +aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail + + +# check that we really can install from a 'cdrom' +testdpkgnotinstalled testing +aptget install testing -y > /dev/null 2>&1 +testdpkginstalled testing -- cgit v1.2.3