#include <apt-pkg/depcache.h>
#include <apt-pkg/versionmatch.h>
#include <apt-pkg/error.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/prettyprinters.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/macros.h>
State.iFlags = 0;
// Figure out the install version
- State.CandidateVer = GetCandidateVer(I);
+ State.CandidateVer = LocalPolicy->GetCandidateVer(I);
State.InstallVer = I.CurrentVer();
State.Mode = ModeKeep;
return false;
}
}
+ if (StateFile.Failed())
+ {
+ OutFile.OpFail();
+ return false;
+ }
if (OutFile.Close() == false)
return false;
chmod(state.c_str(), 0644);
#endif
if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "MarkKeep " << Pkg << " FU=" << FromUser << std::endl;
+ std::clog << OutputInDepth(Depth) << "MarkKeep " << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl;
RemoveSizes(Pkg);
RemoveStates(Pkg);
}
if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl;
+ std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl;
RemoveSizes(Pkg);
RemoveStates(Pkg);
if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto)
{
if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << Pkg << std::endl;
+ std::clog << OutputInDepth(Depth) << "Manual install request prevents MarkDelete of " << APT::PrettyPkg(this, Pkg) << std::endl;
return false;
}
}
{
if (unlikely(DebugMarker == true))
std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode)
- << " of " << Pkg << " as its mode (" << PrintMode(P.Mode)
+ << " of " << APT::PrettyPkg(this, Pkg) << " as its mode (" << PrintMode(P.Mode)
<< ") is protected" << std::endl;
return false;
}
{
if (unlikely(DebugMarker == true))
std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode)
- << " of " << Pkg << std::endl;
+ << " of " << APT::PrettyPkg(this, Pkg) << std::endl;
return false;
}
if (instA != instB)
return instA == false;
}
+ if ((A->CurrentVer == 0 || B->CurrentVer == 0) && A->CurrentVer != B->CurrentVer)
+ return A->CurrentVer == 0;
// Prefer packages in the same group as the target; e.g. foo:i386, foo:amd64
if (A->Group != B->Group)
{
return true;
if (DebugMarker == true)
- std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << " FU=" << FromUser << std::endl;
+ std::clog << OutputInDepth(Depth) << "MarkInstall " << APT::PrettyPkg(this, Pkg) << " FU=" << FromUser << std::endl;
bool MoveAutoBitToDependencies = false;
VerIterator const PV = P.InstVerIter(*this);
/* unsatisfiable dependency: IsInstallOkDependenciesSatisfiableByCandidates
would have prevented us to get here if not overridden, so just skip
- over the problem here as the frontend will know what it is doing */
+ over the problem here as the front-end will know what it is doing */
if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer && Start.IsNegative() == false)
continue;
// not having a candidate or being in sync
// (simple string-compare as stuff like '1' == '0:1-0' can't happen here)
VerIterator CV = PkgState[P->ID].CandidateVerIter(*this);
- if (CV.end() == true || strcmp(Pkg.CandVersion(), CV.VerStr()) == 0)
+ if (CV.end() == true || strcmp(CandVer.VerStr(), CV.VerStr()) == 0)
continue;
// packages losing M-A:same can be out-of-sync
PkgState[Pkg->ID].iFlags |= AutoKept;
if (unlikely(DebugMarker == true))
- std::clog << OutputInDepth(Depth) << "Ignore MarkInstall of " << Pkg
- << " as it is not in sync with its M-A:same sibling " << P
- << " (" << Pkg.CandVersion() << " != " << CV.VerStr() << ")" << std::endl;
+ std::clog << OutputInDepth(Depth) << "Ignore MarkInstall of " << APT::PrettyPkg(this, Pkg)
+ << " as it is not in sync with its M-A:same sibling " << APT::PrettyPkg(this, P)
+ << " (" << CandVer.VerStr() << " != " << CV.VerStr() << ")" << std::endl;
return false;
}
if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer)
{
if (DebugAutoInstall == true)
- std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl;
+ std::clog << OutputInDepth(Depth) << APT::PrettyDep(this, Start) << " can't be satisfied!" << std::endl;
// the dependency is critical, but can't be installed, so discard the candidate
// as the problemresolver will trip over it otherwise trying to install it (#735967)
if (Pkg->CurrentVer != 0 && (PkgState[Pkg->ID].iFlags & Protected) != Protected)
+ {
SetCandidateVersion(Pkg.CurrentVer());
+ StateCache &State = PkgState[Pkg->ID];
+ if (State.Mode != ModeDelete)
+ {
+ State.Mode = ModeKeep;
+ State.Update(Pkg, *this);
+ }
+ }
return false;
}
}
}
}
/*}}}*/
+pkgCache::VerIterator pkgDepCache::GetCandidateVersion(PkgIterator const &Pkg)/*{{{*/
+{
+ return PkgState[Pkg->ID].CandidateVerIter(*this);
+}
+ /*}}}*/
// DepCache::SetCandidateVersion - Change the candidate version /*{{{*/
// ---------------------------------------------------------------------
/* */
CurVersion = "";
if (Pkg->CurrentVer != 0)
CurVersion = Pkg.CurrentVer().VerStr();
-
- // Strip off the epochs for display
- CurVersion = StripEpoch(CurVersion);
- CandVersion = StripEpoch(CandVersion);
-
+
// Figure out if its up or down or equal
Status = Ver.CompareVer(Pkg.CurrentVer());
if (Pkg->CurrentVer == 0 || Pkg->VersionList == 0 || CandidateVer == 0)
// Policy::GetPriority - Get the priority of the package pin /*{{{*/
APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/)
{ return 0; }
+APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::VerIterator const &/*Ver*/, bool /*ConsiderFiles*/)
+{ return 0; }
APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/)
{ return 0; }
/*}}}*/
bool const follow_suggests = MarkFollowsSuggests();
// do the mark part, this is the core bit of the algorithm
- for(PkgIterator p = PkgBegin(); !p.end(); ++p)
+ for (PkgIterator P = PkgBegin(); !P.end(); ++P)
{
- if(!(PkgState[p->ID].Flags & Flag::Auto) ||
- (p->Flags & Flag::Essential) ||
- (p->Flags & Flag::Important) ||
- userFunc.InRootSet(p) ||
- // be nice even then a required package violates the policy (#583517)
- // and do the full mark process also for required packages
- (p.CurrentVer().end() != true &&
- p.CurrentVer()->Priority == pkgCache::State::Required) ||
- // packages which can't be changed (like holds) can't be garbage
- (IsModeChangeOk(ModeGarbage, p, 0, false) == false))
+ if (P->CurrentVer == 0)
+ {
+ if (PkgState[P->ID].Keep())
+ continue;
+ }
+ else
{
- // the package is installed (and set to keep)
- if(PkgState[p->ID].Keep() && !p.CurrentVer().end())
- MarkPackage(p, p.CurrentVer(),
- follow_recommends, follow_suggests);
- // the package is to be installed
- else if(PkgState[p->ID].Install())
- MarkPackage(p, PkgState[p->ID].InstVerIter(*this),
- follow_recommends, follow_suggests);
+ if (PkgState[P->ID].Delete())
+ continue;
}
+
+ if ((PkgState[P->ID].Flags & Flag::Auto) == 0)
+ ;
+ else if ((P->Flags & Flag::Essential) || (P->Flags & Flag::Important))
+ ;
+ // be nice even then a required package violates the policy (#583517)
+ // and do the full mark process also for required packages
+ else if (P->CurrentVer != 0 && P.CurrentVer()->Priority == pkgCache::State::Required)
+ ;
+ else if (userFunc.InRootSet(P))
+ ;
+ // packages which can't be changed (like holds) can't be garbage
+ else if (IsModeChangeOk(ModeGarbage, P, 0, false) == false)
+ ;
+ else
+ continue;
+
+ if (PkgState[P->ID].Install())
+ MarkPackage(P, PkgState[P->ID].InstVerIter(*this),
+ follow_recommends, follow_suggests);
+ else
+ MarkPackage(P, P.CurrentVer(),
+ follow_recommends, follow_suggests);
}
return true;