* apt-pkg/cacheiterators.h:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 19 Jan 2012 17:42:57 +0000 (18:42 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 19 Jan 2012 17:42:57 +0000 (18:42 +0100)
  - 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
apt-pkg/deb/dpkgpm.cc
apt-pkg/packagemanager.cc
cmdline/apt-get.cc
debian/changelog
test/integration/framework
test/integration/test-dpkg-assert-multi-arch

index e6a0fdd..d5e018b 100644 (file)
@@ -207,7 +207,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
        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;
        };
index 99c28d2..2b04f0e 100644 (file)
@@ -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);
index c9d7a30..349adbe 100644 (file)
@@ -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.
index ca11694..85ae1cd 100644 (file)
@@ -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);
index d8316ab..838b14e 100644 (file)
@@ -4,7 +4,11 @@ apt (0.8.16~exp12) experimental; urgency=low
   * apt-pkg/deb/dpkgpm.cc:
     - fix segfault on pkg removal
 
- -- Michael Vogt <michael.vogt@ubuntu.com>  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 <kalnischkies@gmail.com>  Thu, 19 Jan 2012 18:38:33 +0100
 
 apt (0.8.16~exp11) experimental; urgency=low
 
index 2ea1844..d7526a1 100644 (file)
@@ -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; }
index 532cfd2..177d748 100755 (executable)
@@ -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'