From 2a2a7ef4dfa9d8fb8118c2e318555438098cdf34 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 19 Jan 2012 18:42:57 +0100 Subject: * apt-pkg/cacheiterators.h: - return the correct version arch for all+foreign, too The flag is interpreted at a few other places in different styles so this commit ensures that the flag check is consistent everywhere (checking for Same in flag style is a bit too much as it isn't used in combination with others anyway, but who knows and just for consistency) --- apt-pkg/cacheiterators.h | 2 +- apt-pkg/deb/dpkgpm.cc | 4 ++-- apt-pkg/packagemanager.cc | 2 +- cmdline/apt-get.cc | 4 ++-- debian/changelog | 6 +++++- test/integration/framework | 9 ++++++++- test/integration/test-dpkg-assert-multi-arch | 22 +++++++++++++++++----- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index e6a0fddb0..d5e018be9 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -207,7 +207,7 @@ class pkgCache::VerIterator : public Iterator { inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; inline const char *Arch() const { - if (S->MultiArch == pkgCache::Version::All) + if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All) return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 99c28d201..2b04f0e71 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1093,9 +1093,9 @@ bool pkgDPkgPM::Go(int OutStatusFd) pkgCache::VerIterator PkgVer; std::string name = I->Pkg.Name(); if (Op == Item::Remove || Op == Item::Purge) - PkgVer = I->Pkg.CurrentVer(); + PkgVer = I->Pkg.CurrentVer(); else - PkgVer = Cache[I->Pkg].InstVerIter(Cache); + PkgVer = Cache[I->Pkg].InstVerIter(Cache); name.append(":").append(PkgVer.Arch()); char * const fullname = strdup(name.c_str()); Packages.push_back(fullname); diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index c9d7a3024..349adbe40 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -733,7 +733,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same) + if (Immediate == true && (instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) { /* Do lockstep M-A:same unpacking in two phases: First unpack all installed architectures, then the not installed. diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index ca1169401..85ae1cd7e 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2872,12 +2872,12 @@ bool DoBuildDep(CommandLine &CmdL) forbidden = "Multi-Arch: same"; // :native gets the buildArch } - else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign) + else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) { if (colon != string::npos) forbidden = "Multi-Arch: foreign"; } - else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) + else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) { if (colon == string::npos) Pkg = Ver.ParentPkg().Group().FindPkg(hostArch); diff --git a/debian/changelog b/debian/changelog index d8316abf6..838b14ef1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,11 @@ apt (0.8.16~exp12) experimental; urgency=low * apt-pkg/deb/dpkgpm.cc: - fix segfault on pkg removal - -- Michael Vogt Thu, 19 Jan 2012 16:28:03 +0100 + [ David Kalnischkies ] + * apt-pkg/cacheiterators.h: + - return the correct version arch for all+foreign, too + + -- David Kalnischkies Thu, 19 Jan 2012 18:38:33 +0100 apt (0.8.16~exp11) experimental; urgency=low diff --git a/test/integration/framework b/test/integration/framework index 2ea1844f0..d7526a100 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -25,7 +25,14 @@ msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; } msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; } msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; } msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; } -msgtest() { echo -n "${CINFO}$1 ${CCMD}$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} …${CNORMAL} " >&2; } +msgtest() { + while [ -n "$1" ]; do + echo -n "${CINFO}$1${CCMD} " >&2; + echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2; + shift 2 + done + echo -n "…${CNORMAL} " >&2; +} msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; } msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; } diff --git a/test/integration/test-dpkg-assert-multi-arch b/test/integration/test-dpkg-assert-multi-arch index 532cfd26a..177d7489b 100755 --- a/test/integration/test-dpkg-assert-multi-arch +++ b/test/integration/test-dpkg-assert-multi-arch @@ -10,13 +10,13 @@ buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable' buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign' buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same' buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable' -buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' +buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign' setupaptarchive testqualifier() { - msgtest 'Test for correct qualifier mode' $2 - GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -e '--configure' -e '^dpkg:' | sed -e 's/^.*--configure \([^ ]*\).*$/\1/')" + msgtest 'Test with' $1 'for correct qualifier mode' $2 + GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')" if [ "$GIVEN" = "$2" ]; then msgpass else @@ -49,11 +49,17 @@ testqualifier 'all-pkg:amd64' 'all-pkg' testqualifier 'all-foreign-pkg' 'all-foreign-pkg' testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg' insertinstalledpackage 'all-pkg' 'amd64' '1.0' -insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' +insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign' testqualifier 'all-pkg' 'all-pkg' testqualifier 'all-pkg:amd64' 'all-pkg' testqualifier 'all-foreign-pkg' 'all-foreign-pkg' testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg' +insertinstalledpackage 'always-all-pkg' 'all' '1.0' +insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg-' 'all-pkg' +testqualifier 'all-foreign-pkg-' 'all-foreign-pkg' +testqualifier 'always-all-pkg-' 'always-all-pkg' +testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg' # multiarch dpkg (new interface version) @@ -78,8 +84,14 @@ testqualifier 'all-pkg:amd64' 'all-pkg:all' testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all' testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all' insertinstalledpackage 'all-pkg' 'amd64' '1.0' -insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' +insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign' testqualifier 'all-pkg' 'all-pkg:all' testqualifier 'all-pkg:amd64' 'all-pkg:all' testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all' testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all' +insertinstalledpackage 'always-all-pkg' 'all' '1.0' +insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg-' 'all-pkg:amd64' +testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64' +testqualifier 'always-all-pkg-' 'always-all-pkg:all' +testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all' -- cgit v1.2.3