diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/apt-pkg/algorithms.cc apt-0.8.16~exp5ubuntu13.3/apt-pkg/algorithms.cc --- apt-0.8.16~exp5ubuntu13.2/apt-pkg/algorithms.cc 2011-08-15 14:13:10.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/apt-pkg/algorithms.cc 2012-04-17 14:40:21.000000000 +0200 @@ -470,7 +470,7 @@ { // Allocate memory unsigned long Size = Cache.Head().PackageCount; - Scores = new signed short[Size]; + Scores = new int[Size]; Flags = new unsigned char[Size]; memset(Flags,0,sizeof(*Flags)*Size); @@ -510,20 +510,20 @@ memset(Scores,0,sizeof(*Scores)*Size); // Important Required Standard Optional Extra - signed short PrioMap[] = { + int PrioMap[] = { 0, - (signed short) _config->FindI("pkgProblemResolver::Scores::Important",3), - (signed short) _config->FindI("pkgProblemResolver::Scores::Required",2), - (signed short) _config->FindI("pkgProblemResolver::Scores::Standard",1), - (signed short) _config->FindI("pkgProblemResolver::Scores::Optional",-1), - (signed short) _config->FindI("pkgProblemResolver::Scores::Extra",-2) + _config->FindI("pkgProblemResolver::Scores::Important",3), + _config->FindI("pkgProblemResolver::Scores::Required",2), + _config->FindI("pkgProblemResolver::Scores::Standard",1), + _config->FindI("pkgProblemResolver::Scores::Optional",-1), + _config->FindI("pkgProblemResolver::Scores::Extra",-2) }; - signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100); - signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1); - signed short PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1); - signed short PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1); - signed short AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000); - signed short AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000); + int PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100); + int PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1); + int PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1); + int PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1); + int AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000); + int AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000); if (_config->FindB("Debug::pkgProblemResolver::ShowScores",false) == true) clog << "Settings used to calculate pkgProblemResolver::Scores::" << endl @@ -545,7 +545,7 @@ if (Cache[I].InstallVer == 0) continue; - signed short &Score = Scores[I->ID]; + int &Score = Scores[I->ID]; /* This is arbitrary, it should be high enough to elevate an essantial package above most other packages but low enough @@ -583,7 +583,7 @@ } // Copy the scores to advoid additive looping - SPtrArray OldScores = new signed short[Size]; + SPtrArray OldScores = new int[Size]; memcpy(OldScores,Scores,sizeof(*Scores)*Size); /* Now we cause 1 level of dependency inheritance, that is we add the @@ -1093,8 +1093,7 @@ LEnd->Dep = End; LEnd++; - if (Start->Type != pkgCache::Dep::Conflicts && - Start->Type != pkgCache::Dep::Obsoletes) + if (Start.IsNegative() == false) break; } } diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/apt-pkg/algorithms.h apt-0.8.16~exp5ubuntu13.3/apt-pkg/algorithms.h --- apt-0.8.16~exp5ubuntu13.2/apt-pkg/algorithms.h 2011-08-08 14:29:27.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/apt-pkg/algorithms.h 2012-04-17 14:40:21.000000000 +0200 @@ -92,7 +92,7 @@ enum Flags {Protected = (1 << 0), PreInstalled = (1 << 1), Upgradable = (1 << 2), ReInstateTried = (1 << 3), ToRemove = (1 << 4)}; - signed short *Scores; + int *Scores; unsigned char *Flags; bool Debug; diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/apt-pkg/deb/deblistparser.cc apt-0.8.16~exp5ubuntu13.3/apt-pkg/deb/deblistparser.cc --- apt-0.8.16~exp5ubuntu13.2/apt-pkg/deb/deblistparser.cc 2011-09-26 13:30:25.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/apt-pkg/deb/deblistparser.cc 2012-04-14 11:26:18.000000000 +0200 @@ -673,6 +673,9 @@ return _error->Error("Problem parsing Provides line"); if (Op != pkgCache::Dep::NoOp) { _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str()); + } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) { + if (NewProvidesAllArch(Ver, Package, Version) == false) + return false; } else { if (NewProvides(Ver, Package, Arch, Version) == false) return false; diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/apt-pkg/depcache.cc apt-0.8.16~exp5ubuntu13.3/apt-pkg/depcache.cc --- apt-0.8.16~exp5ubuntu13.2/apt-pkg/depcache.cc 2011-08-15 14:51:29.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/apt-pkg/depcache.cc 2012-04-14 00:22:30.000000000 +0200 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,7 @@ #include #include +#include #include #include #include @@ -936,6 +938,51 @@ // DepCache::MarkInstall - Put the package in the install state /*{{{*/ // --------------------------------------------------------------------- /* */ +struct CompareProviders { + pkgCache::PkgIterator const Pkg; + CompareProviders(pkgCache::DepIterator const &Dep) : Pkg(Dep.TargetPkg()) {}; + //bool operator() (APT::VersionList::iterator const &AV, APT::VersionList::iterator const &BV) + bool operator() (pkgCache::VerIterator const &AV, pkgCache::VerIterator const &BV) + { + pkgCache::PkgIterator const A = AV.ParentPkg(); + pkgCache::PkgIterator const B = BV.ParentPkg(); + // Prefer packages in the same group as the target; e.g. foo:i386, foo:amd64 + if (A->Group != B->Group) + { + if (A->Group == Pkg->Group && B->Group != Pkg->Group) + return false; + else if (B->Group == Pkg->Group && A->Group != Pkg->Group) + return true; + } + // we like essentials + if ((A->Flags & pkgCache::Flag::Essential) != (B->Flags & pkgCache::Flag::Essential)) + { + if ((A->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) + return false; + else if ((B->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) + return true; + } + // higher priority seems like a good idea + if (AV->Priority != BV->Priority) + return AV->Priority < BV->Priority; + // prefer native architecture + if (strcmp(A.Arch(), B.Arch()) != 0) + { + if (strcmp(A.Arch(), A.Cache()->NativeArch()) == 0) + return false; + else if (strcmp(B.Arch(), B.Cache()->NativeArch()) == 0) + return true; + std::vector archs = APT::Configuration::getArchitectures(); + for (std::vector::const_iterator a = archs.begin(); a != archs.end(); ++a) + if (*a == A.Arch()) + return false; + else if (*a == B.Arch()) + return true; + } + // unable to decide… + return A->ID < B->ID; + } +}; bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser, bool ForceImportantDeps) @@ -1098,41 +1145,28 @@ /* This bit is for processing the possibilty of an install/upgrade fixing the problem */ - SPtrArray List = Start.AllTargets(); if (Start->Type != Dep::DpkgBreaks && (DepState[Start->ID] & DepCVer) == DepCVer) { - // Right, find the best version to install.. - Version **Cur = List; - PkgIterator P = Start.TargetPkg(); - PkgIterator InstPkg(*Cache,0); - - // See if there are direct matches (at the start of the list) - for (; *Cur != 0 && (*Cur)->ParentPkg == P.Index(); Cur++) + APT::VersionSet verlist; + pkgCache::VerIterator Cand = PkgState[Start.TargetPkg()->ID].CandidateVerIter(*this); + if (Cand.end() == false && VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == true) + verlist.insert(Cand); + for (PrvIterator Prv = Start.TargetPkg().ProvidesList(); Prv.end() != true; ++Prv) { - PkgIterator Pkg(*Cache,Cache->PkgP + (*Cur)->ParentPkg); - if (PkgState[Pkg->ID].CandidateVer != *Cur) + pkgCache::VerIterator V = Prv.OwnerVer(); + pkgCache::VerIterator Cand = PkgState[Prv.OwnerPkg()->ID].CandidateVerIter(*this); + if (Cand.end() == true || V != Cand || + VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == false) continue; - InstPkg = Pkg; - break; + verlist.insert(Cand); } + CompareProviders comp(Start); + APT::VersionSet::iterator InstVer = std::max_element(verlist.begin(), verlist.end(), comp); - // Select the highest priority providing package - if (InstPkg.end() == true) - { - pkgPrioSortList(*Cache,Cur); - for (; *Cur != 0; Cur++) - { - PkgIterator Pkg(*Cache,Cache->PkgP + (*Cur)->ParentPkg); - if (PkgState[Pkg->ID].CandidateVer != *Cur) - continue; - InstPkg = Pkg; - break; - } - } - - if (InstPkg.end() == false) + if (InstVer != verlist.end()) { + pkgCache::PkgIterator InstPkg = InstVer.ParentPkg(); if(DebugAutoInstall == true) std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name() << " as " << Start.DepType() << " of " << Pkg.Name() @@ -1150,7 +1184,7 @@ // mark automatic dependency MarkInstall(InstPkg,true,Depth + 1, false, ForceImportantDeps); // Set the autoflag, after MarkInstall because MarkInstall unsets it - if (P->CurrentVer == 0) + if (InstPkg->CurrentVer == 0) PkgState[InstPkg->ID].Flags |= Flag::Auto; } } @@ -1162,6 +1196,7 @@ upgrade the package. */ if (Start.IsNegative() == true) { + SPtrArray List = Start.AllTargets(); for (Version **I = List; *I != 0; I++) { VerIterator Ver(*this,*I); diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/apt-pkg/pkgcache.h apt-0.8.16~exp5ubuntu13.3/apt-pkg/pkgcache.h --- apt-0.8.16~exp5ubuntu13.2/apt-pkg/pkgcache.h 2011-08-08 14:29:27.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/apt-pkg/pkgcache.h 2012-04-13 21:03:44.000000000 +0200 @@ -200,6 +200,7 @@ inline PkgFileIterator FileEnd(); inline bool MultiArchCache() const { return MultiArchEnabled; }; + inline char const * const NativeArch() const; // Make me a function pkgVersioningSystem *VS; @@ -215,7 +216,6 @@ private: bool MultiArchEnabled; PkgIterator SingleArchFindPkg(const string &Name); - inline char const * const NativeArch() const; }; /*}}}*/ // Header structure /*{{{*/ diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/cmdline/apt-get.cc apt-0.8.16~exp5ubuntu13.3/cmdline/apt-get.cc --- apt-0.8.16~exp5ubuntu13.2/cmdline/apt-get.cc 2011-09-16 09:15:30.000000000 +0200 +++ apt-0.8.16~exp5ubuntu13.3/cmdline/apt-get.cc 2012-04-14 10:42:59.000000000 +0200 @@ -744,6 +744,19 @@ Prov = PPkg; found_one = true; } else if (PPkg != Prov) { + // same group, so it's a foreign package + if (PPkg->Group == Prov->Group) { + // do we already have the requested arch? + if (strcmp(Pkg.Arch(), Prov.Arch()) == 0 || + strcmp(Prov.Arch(), "all") == 0 || + unlikely(strcmp(PPkg.Arch(), Prov.Arch()) == 0)) // packages have only on candidate, but just to be sure + continue; + // see which architecture we prefer more and switch to it + std::vector archs = APT::Configuration::getArchitectures(); + if (std::find(archs.begin(), archs.end(), PPkg.Arch()) < std::find(archs.begin(), archs.end(), Prov.Arch())) + Prov = PPkg; + continue; + } found_one = false; // we found at least two break; } diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/debian/changelog apt-0.8.16~exp5ubuntu13.3/debian/changelog --- apt-0.8.16~exp5ubuntu13.2/debian/changelog 2012-03-05 17:28:19.000000000 +0100 +++ apt-0.8.16~exp5ubuntu13.3/debian/changelog 2012-04-17 14:44:42.000000000 +0200 @@ -1,3 +1,27 @@ +apt (0.8.16~exp5ubuntu13.3) oneiric-proposed; urgency=low + + [ Jean-Louis Dupond ] + * Backport fixes from precise verison of apt, to fix multiarch upgrades + from oneiric. + * apt-pkg/depcache.cc: + - prefer native providers over foreigns even if the chain is foreign. + (LP: #850264) + * cmdline/apt-get.cc: + - ignore foreign architectures if we check if a provides has only one + resolver as it's basically the same for the user, so no need to choose. + * apt-pkg/deb/deblistparser.cc: + - M-A: foreign packages provide for other archs, too + + [ Colin Watson ] + * Include 0.8.16~exp5ubuntu13.1 patches. + * apt-pkg/algorithms.cc: Iterate Breaks the same way as Conflicts, so that + we resolve virtual package Breaks more effectively (LP: #922485). + * apt-pkg/algorithms.{cc,h}: Use an int to represent resolver scores, not + a signed short, because large upgrades can result in an overflow for + core packages (LP: #917173). + + -- Jean-Louis Dupond Tue, 17 Apr 2012 14:43:00 +0200 + apt (0.8.16~exp5ubuntu13.2) oneiric-security; urgency=low * SECURITY UPDATE: trust bypass via stale InRelease file (LP: #947108) diff -Nru --exclude '*.po' --exclude '*.pot' --exclude autom4te.cache --exclude 'configure*' apt-0.8.16~exp5ubuntu13.2/test/integration/test-multiarch-foreign apt-0.8.16~exp5ubuntu13.3/test/integration/test-multiarch-foreign --- apt-0.8.16~exp5ubuntu13.2/test/integration/test-multiarch-foreign 1970-01-01 01:00:00.000000000 +0100 +++ apt-0.8.16~exp5ubuntu13.3/test/integration/test-multiarch-foreign 2012-04-14 08:01:29.000000000 +0200 @@ -0,0 +1,150 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo' +insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign' + +insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider' +insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider +Multi-Arch: foreign' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + cool-foo:i386 foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 Testcases:unstable [amd64]) +Inst cool-foo:i386 (1.0 Testcases:unstable [i386]) +Conf foo (1.0 Testcases:unstable [amd64]) +Conf cool-foo:i386 (1.0 Testcases:unstable [i386])' aptget install cool-foo:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 Testcases:unstable [amd64]) +Inst cool-foo (1.0 Testcases:unstable [amd64]) +Conf foo (1.0 Testcases:unstable [amd64]) +Conf cool-foo (1.0 Testcases:unstable [amd64])' aptget install cool-foo:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 Testcases:unstable [amd64]) +Inst cool-foo (1.0 Testcases:unstable [amd64]) +Conf foo (1.0 Testcases:unstable [amd64]) +Conf cool-foo (1.0 Testcases:unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1.0 Testcases:unstable [i386]) +Inst cool-foo (1.0 Testcases:unstable [amd64]) +Conf foo:i386 (1.0 Testcases:unstable [i386]) +Conf cool-foo (1.0 Testcases:unstable [amd64])' aptget install cool-foo:amd64 foo:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:armel (1.0 Testcases:unstable [armel]) +Inst cool-foo (1.0 Testcases:unstable [amd64]) +Conf foo:armel (1.0 Testcases:unstable [armel]) +Conf cool-foo (1.0 Testcases:unstable [amd64])' aptget install cool-foo:amd64 foo:armel -s + + + + + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar +The following NEW packages will be installed: + bar cool-bar:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 Testcases:unstable [amd64]) +Inst cool-bar:i386 (1.0 Testcases:unstable [i386]) +Conf bar (1.0 Testcases:unstable [amd64]) +Conf cool-bar:i386 (1.0 Testcases:unstable [i386])' aptget install cool-bar:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 Testcases:unstable [amd64]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar (1.0 Testcases:unstable [amd64]) +Conf cool-bar (1.0 Testcases:unstable [amd64])' aptget install cool-bar:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 Testcases:unstable [amd64]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar (1.0 Testcases:unstable [amd64]) +Conf cool-bar (1.0 Testcases:unstable [amd64])' aptget install cool-bar:amd64 bar:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 Testcases:unstable [i386]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar:i386 (1.0 Testcases:unstable [i386]) +Conf cool-bar (1.0 Testcases:unstable [amd64])' aptget install cool-bar:amd64 bar:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar:armel cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:armel (1.0 Testcases:unstable [armel]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar:armel (1.0 Testcases:unstable [armel]) +Conf cool-bar (1.0 Testcases:unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar' instead of 'bar-provider' +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 Testcases:unstable [amd64]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar (1.0 Testcases:unstable [amd64]) +Conf cool-bar (1.0 Testcases:unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar:i386' instead of 'bar-provider:i386' +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 Testcases:unstable [i386]) +Inst cool-bar (1.0 Testcases:unstable [amd64]) +Conf bar:i386 (1.0 Testcases:unstable [i386]) +Conf cool-bar (1.0 Testcases:unstable [amd64])" aptget install cool-bar bar-provider:i386 -s -q=0