Hi, On Mon, Nov 24, 2014 at 11:52:50PM +0000, James Youngman wrote: > The plasma-widget-networkmanagement is in "rc" state but when I try to > purge it, dpkg claims it is not installed. Thanks for the report! > $ sudo dpkg --purge plasma-widget-networkmanagement The problem is that the code for working out which architecture we have to use is flawed, so that it uses the wrong one in this case (= in this case p-w-n is switching from 'all' to 'any' architecture). So apt calls e.g. dpkg --purge p-w-n:amd64 while it should call dpkg --purge p-w-n:all here. (APT has to provide the architecture in general as apt and dpkg have a slight disagreement on what "packagename without explicit architecture" means, so that this gets really messy if M-A != none) The attached patch fixes this. It is small, but the problem relatively esoteric, so I am not sure if I will push that for jessie. Maybe if there is other stuff which absolutely has to … Best regards David Kalnischkies
commit bfa3233a4d24d9b71e96a82ba17ce07c0fab20e4 Author: David Kalnischkies <david@kalnischkies.de> Date: Tue Nov 25 12:10:15 2014 +0100 correct architecture detection for 'rc' packages for purge We were already considering these cases, but the code was flawed, so that packages changing architectures are incorrectly handled and hence the wrong architecture is used to call dpkg with, so that dpkg says the package isn't installed (which it isn't for the requested architecture). Closes: 770898 diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 56e9d75..79120f6 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -201,18 +201,10 @@ pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg) { pkgCache::VerIterator Ver; for (Ver = Pkg.VersionList(); Ver.end() == false; ++Ver) - { - pkgCache::VerFileIterator Vf = Ver.FileList(); - pkgCache::PkgFileIterator F = Vf.File(); - for (F = Vf.File(); F.end() == false; ++F) - { - if (F && F.Archive()) - { - if (strcmp(F.Archive(), "now")) - return Ver; - } - } - } + for (pkgCache::VerFileIterator Vf = Ver.FileList(); Vf.end() == false; ++Vf) + for (pkgCache::PkgFileIterator F = Vf.File(); F.end() == false; ++F) + if (F->Archive != 0 && strcmp(F.Archive(), "now") == 0) + return Ver; return Ver; } /*}}}*/ diff --git a/test/integration/framework b/test/integration/framework index 36deccf..930ab93 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -635,12 +635,8 @@ buildaptarchive() { createaptftparchiveconfig() { local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')" - COMPRESSORS="${COMPRESSORS%* }" - local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')" - if [ -z "$ARCHS" ]; then - # the pool is empty, so we will operate on faked packages - let us use the configured archs - ARCHS="$(getarchitectures)" - fi + local COMPRESSORS="${COMPRESSORS%* }" + local ARCHS="$(getarchitectures)" echo -n 'Dir { ArchiveDir "' >> ftparchive.conf echo -n $(readlink -f .) >> ftparchive.conf @@ -1488,3 +1484,19 @@ aptautotest_aptget_update() { done } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } + +testaptautotestnodpkgwarning() { + local TESTCALL="$1" + while [ -n "$2" ]; do + if [ "$2" = '-s' ]; then return; fi + shift + done + testfailure grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" +} + +aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } +aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } +aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } +aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index 14648e9..0b5a912 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -4,33 +4,53 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'native' - -setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable' -BUILDDIR='incoming/compiz-core-1.0' -mkdir -p ${BUILDDIR}/debian/compiz-core/etc -echo 'foo=bar;' > ${BUILDDIR}/compiz.conf -echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install -buildpackage "$BUILDDIR" 'unstable' 'main' 'native' -rm -rf "$BUILDDIR" +configarchitecture 'amd64' 'i386' + +buildcompizpkg() { + setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4" + BUILDDIR="incoming/compiz-core-$1-$3" + mkdir -p ${BUILDDIR}/debian/compiz-core/etc + echo 'foo=bar;' > ${BUILDDIR}/compiz.conf + echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install + buildpackage "$BUILDDIR" "$4" 'main' "$2" + rm -rf "$BUILDDIR" +} +buildcompizpkg 'native' 'all' '1.0' 'stable' +buildcompizpkg 'all' 'native' '1.0' 'stable' +buildcompizpkg 'native' 'native' '2.0' 'unstable' +buildcompizpkg 'all' 'all' '2.0' 'unstable' setupaptarchive +runtests() { + testdpkgnotinstalled compiz-core-$1 + testsuccess aptget install compiz-core-$1 -t "${2:-unstable}" + testdpkginstalled compiz-core-$1 -testdpkgnotinstalled compiz-core -testsuccess aptget install compiz-core -testdpkginstalled compiz-core - -testsuccess aptget remove compiz-core -y -testdpkgnotinstalled compiz-core - -msgtest 'Check that conffiles are still around for' 'compiz-core' -dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail + testsuccess aptget remove compiz-core-$1 -y + testdpkgnotinstalled compiz-core-$1 + testdpkgstatus 'rc' '1' "compiz-core-$1" -testequal 'Reading package lists... + testequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - compiz-core* + compiz-core-$1* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. -Purg compiz-core' aptget purge compiz-core -s +Purg compiz-core-$1" aptget purge compiz-core-$1 -s + testsuccess aptget purge compiz-core-$1 -y + testequal "dpkg-query: no packages found matching compiz-core-$1" dpkg -l compiz-core-$1 +} + +msgmsg 'Test in multi arch environment' +runtests 'native' +runtests 'all' +runtests 'native' 'stable' +runtests 'all' 'stable' + +msgmsg 'Test in single arch environment' +configarchitecture 'amd64' +runtests 'native' +runtests 'all' +runtests 'native' 'stable' +runtests 'all' 'stable'
Attachment:
signature.asc
Description: Digital signature