diff options
author | Steve Langasek <steve.langasek@canonical.com> | 2012-06-11 15:13:24 -0700 |
---|---|---|
committer | Steve Langasek <steve.langasek@canonical.com> | 2012-06-11 15:13:24 -0700 |
commit | 825098c2740b2d5ebea0c16c43685f55da201315 (patch) | |
tree | b3a43f792cca021a79f541a9454e0223e4dca9cb /apt-pkg | |
parent | 310ed3c13d5cfd2a3c46741539f652d69bda5d30 (diff) | |
parent | e08c5854bb9b5f352b0856533f95c12e858728ca (diff) |
Merge version 0.9.6 from Debian
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/algorithms.cc | 35 | ||||
-rw-r--r-- | apt-pkg/aptconfiguration.cc | 26 | ||||
-rw-r--r-- | apt-pkg/cacheiterators.h | 4 | ||||
-rw-r--r-- | apt-pkg/cdrom.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/cmndline.cc | 8 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 31 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 1 | ||||
-rw-r--r-- | apt-pkg/edsp.cc | 12 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 29 |
9 files changed, 109 insertions, 39 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 2d710097a..2f5fcc7ab 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -362,11 +362,36 @@ bool pkgDistUpgrade(pkgDepCache &Cache) if (I->CurrentVer != 0) Cache.MarkInstall(I, true, 0, false); - /* Now, auto upgrade all essential packages - this ensures that - the essential packages are present and working */ - for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) - if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) - Cache.MarkInstall(I, true, 0, false); + /* Now, install each essential package which is not installed + (and not provided by another package in the same name group) */ + std::string essential = _config->Find("pkgCacheGen::Essential", "all"); + if (essential == "all") + { + for (pkgCache::GrpIterator G = Cache.GrpBegin(); G.end() == false; ++G) + { + bool isEssential = false; + bool instEssential = false; + for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P)) + { + if ((P->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential) + continue; + isEssential = true; + if (Cache[P].Install() == true) + { + instEssential = true; + break; + } + } + if (isEssential == false || instEssential == true) + continue; + pkgCache::PkgIterator P = G.FindPreferredPkg(); + Cache.MarkInstall(P, true, 0, false); + } + } + else if (essential != "none") + for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) + if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) + Cache.MarkInstall(I, true, 0, false); /* We do it again over all previously installed packages to force conflict resolution on them all. */ diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index d763546f8..d31ccb642 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -234,17 +234,21 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, // override the configuration settings vector of languages. string const forceLang = _config->Find("Acquire::Languages",""); if (forceLang.empty() == false) { - if (forceLang == "environment") { - codes = environment; - } else if (forceLang != "none") - codes.push_back(forceLang); - else //if (forceLang == "none") - builtin.clear(); - allCodes = codes; - for (std::vector<string>::const_iterator b = builtin.begin(); - b != builtin.end(); ++b) - if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) - allCodes.push_back(*b); + if (forceLang == "none") { + codes.clear(); + allCodes.clear(); + allCodes.push_back("none"); + } else { + if (forceLang == "environment") + codes = environment; + else + codes.push_back(forceLang); + allCodes = codes; + for (std::vector<string>::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + } if (All == true) return allCodes; else diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index d5e018be9..dcd353119 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -285,6 +285,7 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> { bool IsNegative() const; bool IsIgnorable(PrvIterator const &Prv) const; bool IsIgnorable(PkgIterator const &Pkg) const; + bool IsMultiArchImplicit() const; void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; @@ -329,8 +330,9 @@ class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> { inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}; inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}; - inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {}; + bool IsMultiArchImplicit() const; + inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {}; inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) { if (S == 0) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index c10ca6bd1..8462e8286 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -409,7 +409,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf) /* Write out all of the configuration directives by walking the configuration tree */ - _config->Dump(Out, NULL, "%f \"%v\";\n", false); + Cnf.Dump(Out, NULL, "%f \"%v\";\n", false); Out.close(); diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 159f330a1..75d02cad4 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -92,8 +92,9 @@ bool CommandLine::Parse(int argc,const char **argv) // Match up to a = against the list Args *A; const char *OptEnd = strchrnul(Opt, '='); - for (A = ArgList; A->end() == false && - stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++); + for (A = ArgList; A->end() == false && + (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0); + ++A); // Failed, look for a word after the first - (no-foo) bool PreceedMatch = false; @@ -105,7 +106,8 @@ bool CommandLine::Parse(int argc,const char **argv) Opt++; for (A = ArgList; A->end() == false && - stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++); + (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0); + ++A); // Failed again.. if (A->end() == true && OptEnd - Opt != 1) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 7bef6772c..4948c9be4 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -243,13 +243,12 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg, if (Pkg->Section == 0) Pkg->Section = UniqFindTagWrite("Section"); - // Packages which are not from the "native" arch doesn't get the essential flag - // in the default "native" mode - it is also possible to mark "all" or "none". - // The "installed" mode is handled by ParseStatus(), See #544481 and friends. string const static myArch = _config->Find("APT::Architecture"); - string const static essential = _config->Find("pkgCacheGen::Essential", "native"); - if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) || - essential == "all") + // Possible values are: "all", "native", "installed" and "none" + // The "installed" mode is handled by ParseStatus(), See #544481 and friends. + string const static essential = _config->Find("pkgCacheGen::Essential", "all"); + if (essential == "all" || + (essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch())) if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) return false; if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false) @@ -638,16 +637,18 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, if (Section.Find(Tag,Start,Stop) == false) return true; - string Package; string const pkgArch = Ver.Arch(); - string Version; - unsigned int Op; while (1) { + string Package; + string Version; + unsigned int Op; + Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); + size_t const found = Package.rfind(':'); if (MultiArchEnabled == true && (Type == pkgCache::Dep::Conflicts || @@ -659,6 +660,18 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, if (NewDepends(Ver,Package,*a,Version,Op,Type) == false) return false; } + else if (MultiArchEnabled == true && found != string::npos && + strcmp(Package.c_str() + found, ":any") != 0) + { + string Arch = Package.substr(found+1, string::npos); + Package = Package.substr(0, found); + // Such dependencies are not supposed to be accepted … + // … but this is probably the best thing to do. + if (Arch == "native") + Arch = _config->Find("APT::Architecture"); + if (NewDepends(Ver,Package,Arch,Version,Op,Type) == false) + return false; + } else if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false) return false; if (Start == Stop) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 56194e244..2656e9b42 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -871,7 +871,6 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, if (FromUser == false && Pkg->CurrentVer == 0) { StateCache &P = PkgState[Pkg->ID]; - // Status == 2 means this applies for new installs only if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto) { if (DebugMarker == true) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 791aac72f..adb8788b3 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -118,8 +118,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P bool orGroup = false; for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep) { - // Ignore implicit dependencies for multiarch here - if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0) + if (Dep.IsMultiArchImplicit() == true) continue; if (orGroup == false) dependencies[Dep->Type].append(", "); @@ -140,8 +139,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P string provides; for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv) { - // Ignore implicit provides for multiarch here - if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0) + if (Prv.IsMultiArchImplicit() == true) continue; provides.append(", ").append(Prv.Name()); } @@ -159,8 +157,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output, bool orGroup = false; for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep) { - // Ignore implicit dependencies for multiarch here - if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0) + if (Dep.IsMultiArchImplicit() == true) continue; if (orGroup == false) { @@ -193,8 +190,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output, string provides; for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv) { - // Ignore implicit provides for multiarch here - if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0) + if (Prv.IsMultiArchImplicit() == true) continue; if (pkgset.find(Prv.ParentPkg()) == pkgset.end()) continue; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 997c70768..f694a237e 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -708,6 +708,21 @@ bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const return false; } /*}}}*/ +// DepIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/ +// --------------------------------------------------------------------- +/* MultiArch can be translated to SingleArch for an resolver and we did so, + by adding dependencies to help the resolver understand the problem, but + sometimes it is needed to identify these to ignore them… */ +bool pkgCache::DepIterator::IsMultiArchImplicit() const +{ + if (ParentPkg()->Arch != TargetPkg()->Arch && + (S->Type == pkgCache::Dep::Replaces || + S->Type == pkgCache::Dep::DpkgBreaks || + S->Type == pkgCache::Dep::Conflicts)) + return true; + return false; +} + /*}}}*/ // ostream operator to handle string representation of a dependecy /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -946,3 +961,17 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const }; /*}}}*/ +// PrvIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/ +// --------------------------------------------------------------------- +/* MultiArch can be translated to SingleArch for an resolver and we did so, + by adding provides to help the resolver understand the problem, but + sometimes it is needed to identify these to ignore them… */ +bool pkgCache::PrvIterator::IsMultiArchImplicit() const +{ + pkgCache::PkgIterator const Owner = OwnerPkg(); + pkgCache::PkgIterator const Parent = ParentPkg(); + if (Owner->Arch != Parent->Arch || Owner->Name == Parent->Name) + return true; + return false; +} + /*}}}*/ |