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') 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