Commit 0329b6ee authored by Lorenzo "Palinuro" Faletra's avatar Lorenzo "Palinuro" Faletra Committed by Lorenzo "Palinuro" Faletra

Import Debian version 2.1.7+parrot1

apt (2.1.7+parrot1) rolling-testing; urgency=medium

  * Import new Debian version.
  * Re-enable https-to-http redirects.

apt (2.1.7) unstable; urgency=medium

  [ David Kalnischkies ]
  * Do not hardcode (wrong) group and mode in setup warning (Closes: #962310)
  * Do not sent our filename-provides trick to EDSP solvers (Closes: #962741)
  * Tell EDSP solvers about all installed pkgs ignoring arch
  * Deduplicate EDSP Provides line of M-A:foreign packages
  * Delay removals due to Conflicts until Depends are resolved
  * Filter out impossible solutions for protected propagation
  * Add dependency points in the resolver also to providers
  * Reorder config check before checking systemd for non-interactive http
  * Reorder config check before result looping for SRV parsing debug
  * Fix test due to display change in ls (coreutils 8.32)
  * Detect pkg-config-dpkghook failure in tests to avoid fallback (Closes: #964475)

  [ Américo Monteiro ]
  * Portuguese manpages translation update (Closes: #962483)

  [ Julian Andres Klode ]
  * Replace some magic 64*1024 with APT_BUFFER_SIZE
  * Add basic support for the Protected field

  [ Sergio Oller Moreno ]
  * Minor Catalan grammar typo

  [ Frans Spiesschaert ]
  * Dutch program translation update (Closes: #963008)

apt (2.1.6) unstable; urgency=medium

  [ David Kalnischkies ]
  * Fix small memory leak in MethodConfig
  * Consider protected packages for removal if they are marked as such
  * Consider if a fix is successful before claiming it is
  * Allow 20 instead of 10 loops for pkgProblemResolver
  * Deal with duplicates in the solution space of a dep

apt (2.1.5) unstable; urgency=medium

  [ David Kalnischkies ]
  * Reset candidate version explicitly for internal state-keeping
    (Closes: #961266)
  * Known-bad candidate versions are not an upgrade option
  * Keep status number if candidate is discarded for kept back display
  * Allow pkgDepCache to be asked to check internal consistency
  * Don't update candidate provides map if the same as current
  * Ensure EDSP doesn't use a dangling architecture string
  * Allow FMV SSE4.2 detection to succeed on clang
  * Mark PatternTreeParser::Node destructor as virtual

  [ Frans Spiesschaert ]
  * Dutch manpages translation update (Closes: #961431)

apt (2.1.4) unstable; urgency=medium

  [ David Kalnischkies ]
  * Check satisfiability for versioned provides, not providing version

apt (2.1.3) unstable; urgency=medium

  [ David Kalnischkies ]
  * Prefer use of O_TMPFILE in GetTempFile if available
  * Allow prefix to be a complete filename for GetTempFile
  * Properly handle interrupted write() call in ExtractTar
  * Skip reading data from tar members if nobody will look at it
  * Keep going if a dep is bad for user requests to improve errors
  * Support negative dependencies in VCI::FromDependency
  * Deal with protected solution providers first
  * Propagate protected to already satisfied conflicts (Closes: #960705)
  * Propagate protected to already satisfied dependencies
  * Recognize propagated protected in pkgProblemResolver

  [ Julian Andres Klode ]
  * private-search: Only use V.TranslatedDescription() if good (LP: #1877987)

apt (2.1.2) unstable; urgency=critical

  [ Julian Andres Klode ]
  * SECURITY UPDATE: Out of bounds read in ar, tar implementations (LP: #1878177)
    - apt-pkg/contrib/arfile.cc: Fix out-of-bounds read in member name
    - apt-pkg/contrib/arfile.cc: Fix out-of-bounds read on unterminated
      member names in error path
    - apt-pkg/contrib/extracttar.cc: Fix out-of-bounds read on unterminated
      member names in error path
    - CVE-2020-3810

  [ Frans Spiesschaert ]
  * Dutch program translation update (Closes: #960186)
parent e725fd69
Pipeline #648 failed with stages
...@@ -25,11 +25,12 @@ ...@@ -25,11 +25,12 @@
# SOFTWARE. # SOFTWARE.
include(CheckCXXSourceCompiles)
function(check_cxx_target var target code) function(check_cxx_target var target code)
check_cxx_source_compiles( check_cxx_source_compiles(
" "
__attribute__((target(\"${target}\"))) static int foo() { ${code} return 1; } __attribute__((target(\"${target}\"))) static int foo(int i) { return ${code}; }
__attribute__((target(\"default\"))) static int foo() { ${code} return 0; } __attribute__((target(\"default\"))) static int foo(int i) { return i; }
int main() { return foo(); } int main(int i, char **) { return foo(i); }
" ${var}) " ${var})
endfunction() endfunction()
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
/* Internationalization macros for apt. This header should be included last /* Internationalization macros for apt. This header should be included last
in each C file. */ in each C file. */
#ifndef APT_I18N_H
#define APT_I18N_H
// Set by autoconf // Set by autoconf
#cmakedefine USE_NLS #cmakedefine USE_NLS
...@@ -19,11 +22,13 @@ ...@@ -19,11 +22,13 @@
# define N_(x) x # define N_(x) x
#else #else
// apt will not use any gettext // apt will not use any gettext
# define setlocale(a, b) extern "C" inline char* setlocale(int, const char*) throw() { return nullptr; }
# define textdomain(a) extern "C" inline char* textdomain(const char*) throw() { return nullptr; }
# define bindtextdomain(a, b) extern "C" inline char* bindtextdomain(const char*, const char*) throw() { return nullptr; }
extern "C" inline char* dgettext(const char*, const char* msg) throw() { return const_cast<char*>(msg); }
# define _(x) x # define _(x) x
# define P_(msg,plural,n) (n == 1 ? msg : plural) # define P_(msg,plural,n) (n == 1 ? msg : plural)
# define N_(x) x # define N_(x) x
# define dgettext(d, m) m #endif
#endif #endif
...@@ -198,13 +198,13 @@ endif() ...@@ -198,13 +198,13 @@ endif()
# Check multiversioning # Check multiversioning
include(CheckCxxTarget) include(CheckCxxTarget)
check_cxx_target(HAVE_FMV_SSE42_AND_CRC32 "sse4.2" "__builtin_ia32_crc32si(0, 1llu);") check_cxx_target(HAVE_FMV_SSE42_AND_CRC32 "sse4.2" "__builtin_ia32_crc32si(0,i)|__builtin_ia32_crc32hi(0,i)|__builtin_ia32_crc32qi(0,i)")
check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0, 1llu);") check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0,i)")
# Configure some variables like package, version and architecture. # Configure some variables like package, version and architecture.
set(PACKAGE ${PROJECT_NAME}) set(PACKAGE ${PROJECT_NAME})
set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>") set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")
set(PACKAGE_VERSION "2.1.1") set(PACKAGE_VERSION "2.1.7")
string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION}) string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION})
if (NOT DEFINED DPKG_DATADIR) if (NOT DEFINED DPKG_DATADIR)
......
...@@ -105,18 +105,18 @@ static bool SetupAPTPartialDirectory(std::string const &grand, std::string const ...@@ -105,18 +105,18 @@ static bool SetupAPTPartialDirectory(std::string const &grand, std::string const
{ {
// chown the partial dir // chown the partial dir
if(chown(partial.c_str(), pw->pw_uid, gr->gr_gid) != 0) if(chown(partial.c_str(), pw->pw_uid, gr->gr_gid) != 0)
_error->WarningE("SetupAPTPartialDirectory", "chown to %s:root of directory %s failed", SandboxUser.c_str(), partial.c_str()); _error->WarningE("SetupAPTPartialDirectory", "chown to %s:%s of directory %s failed", SandboxUser.c_str(), ROOT_GROUP, partial.c_str());
} }
} }
if (chmod(partial.c_str(), mode) != 0) if (chmod(partial.c_str(), mode) != 0)
_error->WarningE("SetupAPTPartialDirectory", "chmod 0700 of directory %s failed", partial.c_str()); _error->WarningE("SetupAPTPartialDirectory", "chmod 0%03o of directory %s failed", mode, partial.c_str());
} }
else if (chmod(partial.c_str(), mode) != 0) else if (chmod(partial.c_str(), mode) != 0)
{ {
// if we haven't created the dir and aren't root, it is kinda expected that chmod doesn't work // if we haven't created the dir and aren't root, it is kinda expected that chmod doesn't work
if (partialExists == false) if (partialExists == false)
_error->WarningE("SetupAPTPartialDirectory", "chmod 0700 of directory %s failed", partial.c_str()); _error->WarningE("SetupAPTPartialDirectory", "chmod 0%03o of directory %s failed", mode, partial.c_str());
} }
_error->PushToStack(); _error->PushToStack();
...@@ -1474,5 +1474,5 @@ pkgAcquire::UriIterator::UriIterator(pkgAcquire::Queue *Q) : d(NULL), CurQ(Q), C ...@@ -1474,5 +1474,5 @@ pkgAcquire::UriIterator::UriIterator(pkgAcquire::Queue *Q) : d(NULL), CurQ(Q), C
} }
pkgAcquire::UriIterator::~UriIterator() {} pkgAcquire::UriIterator::~UriIterator() {}
pkgAcquire::MethodConfig::~MethodConfig() {} pkgAcquire::MethodConfig::~MethodConfig() { delete d; }
pkgAcquireStatus::~pkgAcquireStatus() {} pkgAcquireStatus::~pkgAcquireStatus() {}
...@@ -58,6 +58,8 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache), ...@@ -58,6 +58,8 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
string Jnk = "SIMULATE"; string Jnk = "SIMULATE";
for (decltype(PackageCount) I = 0; I != PackageCount; ++I) for (decltype(PackageCount) I = 0; I != PackageCount; ++I)
FileNames[I] = Jnk; FileNames[I] = Jnk;
Cache->CheckConsistency("simulate");
} }
/*}}}*/ /*}}}*/
// Simulate::~Simulate - Destructor /*{{{*/ // Simulate::~Simulate - Destructor /*{{{*/
...@@ -515,18 +517,37 @@ void pkgProblemResolver::MakeScores() ...@@ -515,18 +517,37 @@ void pkgProblemResolver::MakeScores()
Score += PrioInstalledAndNotObsolete; Score += PrioInstalledAndNotObsolete;
// propagate score points along dependencies // propagate score points along dependencies
for (pkgCache::DepIterator D = InstVer.DependsList(); D.end() == false; ++D) for (pkgCache::DepIterator D = InstVer.DependsList(); not D.end(); ++D)
{ {
if (DepMap[D->Type] == 0) if (DepMap[D->Type] == 0)
continue; continue;
pkgCache::PkgIterator const T = D.TargetPkg(); pkgCache::PkgIterator const T = D.TargetPkg();
if (D->Version != 0) if (not D.IsIgnorable(T))
{
if (D->Version != 0)
{
pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache);
if (IV.end() || not D.IsSatisfied(IV))
continue;
}
Scores[T->ID] += DepMap[D->Type];
}
std::vector<map_id_t> providers;
for (auto Prv = T.ProvidesList(); not Prv.end(); ++Prv)
{ {
pkgCache::VerIterator const IV = Cache[T].InstVerIter(Cache); if (D.IsIgnorable(Prv))
if (IV.end() == true || D.IsSatisfied(IV) == false)
continue; continue;
auto const PV = Prv.OwnerVer();
auto const PP = PV.ParentPkg();
if (PV != Cache[PP].InstVerIter(Cache) || not D.IsSatisfied(Prv))
continue;
providers.push_back(PP->ID);
} }
Scores[T->ID] += DepMap[D->Type]; std::sort(providers.begin(), providers.end());
providers.erase(std::unique(providers.begin(), providers.end()), providers.end());
for (auto const prv : providers)
Scores[prv] += DepMap[D->Type];
} }
} }
...@@ -562,13 +583,25 @@ void pkgProblemResolver::MakeScores() ...@@ -562,13 +583,25 @@ void pkgProblemResolver::MakeScores()
provide important packages extremely important */ provide important packages extremely important */
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I) for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
{ {
for (pkgCache::PrvIterator P = I.ProvidesList(); P.end() == false; ++P) auto const transfer = abs(Scores[I->ID] - OldScores[I->ID]);
if (transfer == 0)
continue;
std::vector<map_id_t> providers;
for (auto Prv = I.ProvidesList(); not Prv.end(); ++Prv)
{ {
// Only do it once per package if (Prv.IsMultiArchImplicit())
if ((pkgCache::Version *)P.OwnerVer() != Cache[P.OwnerPkg()].InstallVer) continue;
auto const PV = Prv.OwnerVer();
auto const PP = PV.ParentPkg();
if (PV != Cache[PP].InstVerIter(Cache))
continue; continue;
Scores[P.OwnerPkg()->ID] += abs(Scores[I->ID] - OldScores[I->ID]); providers.push_back(PP->ID);
} }
std::sort(providers.begin(), providers.end());
providers.erase(std::unique(providers.begin(), providers.end()), providers.end());
for (auto const prv : providers)
Scores[prv] += transfer;
} }
/* Protected things are pushed really high up. This number should put them /* Protected things are pushed really high up. This number should put them
...@@ -599,7 +632,8 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) ...@@ -599,7 +632,8 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
Flags[Pkg->ID] &= ~Upgradable; Flags[Pkg->ID] &= ~Upgradable;
bool WasKept = Cache[Pkg].Keep(); bool WasKept = Cache[Pkg].Keep();
Cache.MarkInstall(Pkg, false, 0, false); if (not Cache.MarkInstall(Pkg, false, 0, false))
return false;
// This must be a virtual package or something like that. // This must be a virtual package or something like that.
if (Cache[Pkg].InstVerIter(Cache).end() == true) if (Cache[Pkg].InstVerIter(Cache).end() == true)
...@@ -633,7 +667,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) ...@@ -633,7 +667,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
// Do not change protected packages // Do not change protected packages
PkgIterator P = Start.SmartTargetPkg(); PkgIterator P = Start.SmartTargetPkg();
if ((Flags[P->ID] & Protected) == Protected) if (Cache[P].Protect())
{ {
if (Debug == true) if (Debug == true)
clog << " Reinst Failed because of protected " << P.FullName(false) << endl; clog << " Reinst Failed because of protected " << P.FullName(false) << endl;
...@@ -720,6 +754,9 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -720,6 +754,9 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{ {
pkgDepCache::ActionGroup group(Cache); pkgDepCache::ActionGroup group(Cache);
if (Debug)
Cache.CheckConsistency("resolve start");
// Record which packages are marked for install // Record which packages are marked for install
bool Again = false; bool Again = false;
do do
...@@ -787,8 +824,9 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -787,8 +824,9 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
changing a breaks c) */ changing a breaks c) */
bool Change = true; bool Change = true;
bool const TryFixByInstall = _config->FindB("pkgProblemResolver::FixByInstall", true); bool const TryFixByInstall = _config->FindB("pkgProblemResolver::FixByInstall", true);
int const MaxCounter = _config->FindI("pkgProblemResolver::MaxCounter", 20);
std::vector<PackageKill> KillList; std::vector<PackageKill> KillList;
for (int Counter = 0; Counter != 10 && Change == true; Counter++) for (int Counter = 0; Counter < MaxCounter && Change; ++Counter)
{ {
Change = false; Change = false;
for (pkgCache::Package **K = PList.get(); K != PEnd; K++) for (pkgCache::Package **K = PList.get(); K != PEnd; K++)
...@@ -800,7 +838,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -800,7 +838,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
if (Cache[I].CandidateVer != Cache[I].InstallVer && if (Cache[I].CandidateVer != Cache[I].InstallVer &&
I->CurrentVer != 0 && Cache[I].InstallVer != 0 && I->CurrentVer != 0 && Cache[I].InstallVer != 0 &&
(Flags[I->ID] & PreInstalled) != 0 && (Flags[I->ID] & PreInstalled) != 0 &&
(Flags[I->ID] & Protected) == 0 && not Cache[I].Protect() &&
(Flags[I->ID] & ReInstateTried) == 0) (Flags[I->ID] & ReInstateTried) == 0)
{ {
if (Debug == true) if (Debug == true)
...@@ -835,7 +873,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -835,7 +873,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
pkgCache::DepIterator End; pkgCache::DepIterator End;
size_t OldSize = 0; size_t OldSize = 0;
KillList.resize(0); KillList.clear();
enum {OrRemove,OrKeep} OrOp = OrRemove; enum {OrRemove,OrKeep} OrOp = OrRemove;
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
...@@ -849,7 +887,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -849,7 +887,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{ {
if (OrOp == OrRemove) if (OrOp == OrRemove)
{ {
if ((Flags[I->ID] & Protected) != Protected) if (not Cache[I].Protect())
{ {
if (Debug == true) if (Debug == true)
clog << " Or group remove for " << I.FullName(false) << endl; clog << " Or group remove for " << I.FullName(false) << endl;
...@@ -903,7 +941,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -903,7 +941,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
targets then we keep the package and bail. This is necessary targets then we keep the package and bail. This is necessary
if a package has a dep on another package that can't be found */ if a package has a dep on another package that can't be found */
std::unique_ptr<pkgCache::Version *[]> VList(Start.AllTargets()); std::unique_ptr<pkgCache::Version *[]> VList(Start.AllTargets());
if (VList[0] == 0 && (Flags[I->ID] & Protected) != Protected && if (VList[0] == 0 && not Cache[I].Protect() &&
Start.IsNegative() == false && Start.IsNegative() == false &&
Cache[I].NowBroken() == false) Cache[I].NowBroken() == false)
{ {
...@@ -950,7 +988,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -950,7 +988,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
End.IsNegative() == false)) End.IsNegative() == false))
{ {
// Try a little harder to fix protected packages.. // Try a little harder to fix protected packages..
if ((Flags[I->ID] & Protected) == Protected) if (Cache[I].Protect())
{ {
if (DoUpgrade(Pkg) == true) if (DoUpgrade(Pkg) == true)
{ {
...@@ -1037,7 +1075,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -1037,7 +1075,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
} }
// Skip adding to the kill list if it is protected // Skip adding to the kill list if it is protected
if ((Flags[Pkg->ID] & Protected) != 0) if (Cache[Pkg].Protect() && Cache[Pkg].Mode != pkgDepCache::ModeDelete)
continue; continue;
if (Debug == true) if (Debug == true)
...@@ -1053,7 +1091,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -1053,7 +1091,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
// Hm, nothing can possibly satisfy this dep. Nuke it. // Hm, nothing can possibly satisfy this dep. Nuke it.
if (VList[0] == 0 && if (VList[0] == 0 &&
Start.IsNegative() == false && Start.IsNegative() == false &&
(Flags[I->ID] & Protected) != Protected) not Cache[I].Protect())
{ {
bool Installed = Cache[I].Install(); bool Installed = Cache[I].Install();
Cache.MarkKeep(I); Cache.MarkKeep(I);
...@@ -1093,33 +1131,38 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -1093,33 +1131,38 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
// Apply the kill list now // Apply the kill list now
if (Cache[I].InstallVer != 0) if (Cache[I].InstallVer != 0)
{ {
for (auto J = KillList.begin(); J != KillList.end(); J++) for (auto const &J : KillList)
{ {
Change = true; bool foundSomething = false;
if ((Cache[J->Dep] & pkgDepCache::DepGNow) == 0) if ((Cache[J.Dep] & pkgDepCache::DepGNow) == 0)
{ {
if (J->Dep.IsNegative() == true) if (J.Dep.IsNegative() && Cache.MarkDelete(J.Pkg, false, 0, false))
{ {
if (Debug == true) if (Debug)
clog << " Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl; std::clog << " Fixing " << I.FullName(false) << " via remove of " << J.Pkg.FullName(false) << '\n';
Cache.MarkDelete(J->Pkg, false, 0, false); foundSomething = true;
} }
} }
else else if (Cache.MarkKeep(J.Pkg, false, false))
{ {
if (Debug == true) if (Debug)
clog << " Fixing " << I.FullName(false) << " via keep of " << J->Pkg.FullName(false) << endl; std::clog << " Fixing " << I.FullName(false) << " via keep of " << J.Pkg.FullName(false) << '\n';
Cache.MarkKeep(J->Pkg, false, false); foundSomething = true;
} }
if (Counter > 1) if (not foundSomething || Counter > 1)
{ {
if (Scores[I->ID] > Scores[J->Pkg->ID]) if (Scores[I->ID] > Scores[J.Pkg->ID])
Scores[J->Pkg->ID] = Scores[I->ID]; {
} Scores[J.Pkg->ID] = Scores[I->ID];
} Change = true;
}
}
if (foundSomething)
Change = true;
}
} }
} }
} }
if (Debug == true) if (Debug == true)
...@@ -1133,7 +1176,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -1133,7 +1176,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
{ {
if (Cache[I].InstBroken() == false) if (Cache[I].InstBroken() == false)
continue; continue;
if ((Flags[I->ID] & Protected) != Protected) if (not Cache[I].Protect())
return _error->Error(_("Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.")); return _error->Error(_("Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages."));
} }
return _error->Error(_("Unable to correct problems, you have held broken packages.")); return _error->Error(_("Unable to correct problems, you have held broken packages."));
...@@ -1151,6 +1194,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix) ...@@ -1151,6 +1194,8 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
} }
} }
if (Debug)
Cache.CheckConsistency("resolve done");
return true; return true;
} }
...@@ -1210,6 +1255,9 @@ bool pkgProblemResolver::ResolveByKeepInternal() ...@@ -1210,6 +1255,9 @@ bool pkgProblemResolver::ResolveByKeepInternal()
{ {
pkgDepCache::ActionGroup group(Cache); pkgDepCache::ActionGroup group(Cache);
if (Debug)
Cache.CheckConsistency("keep start");
MakeScores(); MakeScores();
/* We have to order the packages so that the broken fixing pass /* We have to order the packages so that the broken fixing pass
...@@ -1253,7 +1301,7 @@ bool pkgProblemResolver::ResolveByKeepInternal() ...@@ -1253,7 +1301,7 @@ bool pkgProblemResolver::ResolveByKeepInternal()
/* Keep the package. If this works then great, otherwise we have /* Keep the package. If this works then great, otherwise we have
to be significantly more aggressive and manipulate its dependencies */ to be significantly more aggressive and manipulate its dependencies */
if ((Flags[I->ID] & Protected) == 0) if (not Cache[I].Protect())
{ {
if (Debug == true) if (Debug == true)
clog << "Keeping package " << I.FullName(false) << endl; clog << "Keeping package " << I.FullName(false) << endl;
...@@ -1301,7 +1349,7 @@ bool pkgProblemResolver::ResolveByKeepInternal() ...@@ -1301,7 +1349,7 @@ bool pkgProblemResolver::ResolveByKeepInternal()
Pkg->CurrentVer == 0) Pkg->CurrentVer == 0)
continue; continue;
if ((Flags[I->ID] & Protected) == 0) if (not Cache[I].Protect())
{ {
if (Debug == true) if (Debug == true)
clog << " Keeping Package " << Pkg.FullName(false) << " due to " << Start.DepType() << endl; clog << " Keeping Package " << Pkg.FullName(false) << " due to " << Start.DepType() << endl;
...@@ -1340,6 +1388,10 @@ bool pkgProblemResolver::ResolveByKeepInternal() ...@@ -1340,6 +1388,10 @@ bool pkgProblemResolver::ResolveByKeepInternal()
} }
delete[] PList; delete[] PList;
if (Debug)
Cache.CheckConsistency("keep done");
return true; return true;
} }
/*}}}*/ /*}}}*/
......
...@@ -48,6 +48,7 @@ struct APT_PUBLIC PatternTreeParser ...@@ -48,6 +48,7 @@ struct APT_PUBLIC PatternTreeParser
virtual std::ostream &render(std::ostream &os) { return os; }; virtual std::ostream &render(std::ostream &os) { return os; };
std::nullptr_t error(std::string message); std::nullptr_t error(std::string message);
virtual ~Node() = default;
}; };
struct Error : public std::exception struct Error : public std::exception
......
...@@ -583,74 +583,54 @@ bool VersionContainerInterface::FromDependency(VersionContainerInterface * const ...@@ -583,74 +583,54 @@ bool VersionContainerInterface::FromDependency(VersionContainerInterface * const
CacheSetHelper &helper) CacheSetHelper &helper)
{ {
bool found = false; bool found = false;
switch(selector) { auto const insertVersion = [&](pkgCache::PkgIterator const &TP, pkgCache::VerIterator const &TV) {
case CacheSetHelper::ALL: if (not TV.end() && not D.IsIgnorable(TP) && D.IsSatisfied(TV))
{
pkgCache::PkgIterator const T = D.TargetPkg();
for (pkgCache::VerIterator Ver = T.VersionList(); Ver.end() == false; ++Ver)
{ {
if (D.IsSatisfied(Ver) == true) vci->insert(TV);
{ found = true;
vci->insert(Ver); }
found = true; };
} pkgCache::PkgIterator const T = D.TargetPkg();
for (pkgCache::PrvIterator Prv = T.ProvidesList(); Prv.end() != true; ++Prv) auto const insertAllTargetVersions = [&](auto const &getTargetVersion) {
insertVersion(T, getTargetVersion(T));
for (auto