70 virtual bool InRootSet(
const pkgCache::PkgIterator &) {
return false;};
104 enum DepFlags {DepNow = (1 << 0),DepInstall = (1 << 1),DepCVer = (1 << 2),
105 DepGNow = (1 << 3),DepGInstall = (1 << 4),DepGCVer = (1 << 5)};
108 enum DepStateFlags {DepNowPolicy = (1 << 0), DepNowMin = (1 << 1),
109 DepInstPolicy = (1 << 2), DepInstMin = (1 << 3),
110 DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)};
113 enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2), Protected = (1 << 3)};
115 enum VersionTypes {NowVersion, InstallVersion, CandidateVersion};
116 enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2, ModeGarbage = 3};
184 bool InRootSet(
const pkgCache::PkgIterator &pkg)
override {
return pkg.end() ==
false && Match(pkg.Name()); };
190 const char *CandVersion;
191 const char *CurVersion;
200 unsigned short Flags;
201 unsigned short iFlags;
217 unsigned char DepState;
220 void Update(PkgIterator Pkg,
pkgCache &Cache);
223 inline bool NewInstall()
const {
return Status == 2 && Mode == ModeInstall;};
224 inline bool Delete()
const {
return Mode == ModeDelete;};
225 inline bool Purge()
const {
return Delete() ==
true && (iFlags & pkgDepCache::Purge) == pkgDepCache::Purge; };
226 inline bool Keep()
const {
return Mode == ModeKeep;};
227 inline bool Protect()
const {
return (iFlags & Protected) == Protected;};
228 inline bool Upgrade()
const {
return Status > 0 && Mode == ModeInstall;};
229 inline bool Upgradable()
const {
return Status >= 1 && CandidateVer != NULL;};
230 inline bool Downgrade()
const {
return Status < 0 && Mode == ModeInstall;};
231 inline bool Held()
const {
return Status != 0 && Keep();};
232 inline bool NowBroken()
const {
return (DepState & DepNowMin) != DepNowMin;};
233 inline bool NowPolicyBroken()
const {
return (DepState & DepNowPolicy) != DepNowPolicy;};
234 inline bool InstBroken()
const {
return (DepState & DepInstMin) != DepInstMin;};
235 inline bool InstPolicyBroken()
const {
return (DepState & DepInstPolicy) != DepInstPolicy;};
236 inline bool Install()
const {
return Mode == ModeInstall;};
237 inline bool ReInstall()
const {
return Delete() ==
false && (iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall;};
238 inline VerIterator InstVerIter(
pkgCache &Cache)
239 {
return VerIterator(Cache,InstallVer);};
240 inline VerIterator CandidateVerIter(
pkgCache &Cache)
241 {
return VerIterator(Cache,CandidateVer);};
245 void BuildGroupOrs(VerIterator
const &V);
246 void UpdateVerState(PkgIterator
const &Pkg);
253 InstallRecommends = _config->FindB(
"APT::Install-Recommends",
false);
254 InstallSuggests = _config->FindB(
"APT::Install-Suggests",
false);
257 virtual VerIterator GetCandidateVer(PkgIterator
const &Pkg);
258 virtual bool IsImportantDep(DepIterator
const &
Dep)
const;
259 virtual signed short GetPriority(PkgIterator
const &Pkg);
260 virtual signed short GetPriority(VerIterator
const &Ver,
bool ConsiderFiles=
true);
261 virtual signed short GetPriority(PkgFileIterator
const &File);
266 bool InstallRecommends;
267 bool InstallSuggests;
280 std::unique_ptr<Private> d;
301 void temporaryRollback();
316 int IncreaseActionGroupLevel();
317 int DecreaseActionGroupLevel();
324 unsigned char *DepState;
330 unsigned long iInstCount;
331 unsigned long iDelCount;
332 unsigned long iKeepCount;
333 unsigned long iBrokenCount;
334 unsigned long iPolicyBrokenCount;
335 unsigned long iBadCount;
338 bool DebugAutoInstall;
344 bool CheckDep(DepIterator
const &
Dep,
int const Type,PkgIterator &Res);
345 inline bool CheckDep(DepIterator
const &
Dep,
int const Type)
347 PkgIterator Res(*
this,0);
348 return CheckDep(
Dep,Type,Res);
352 unsigned char DependencyState(DepIterator
const &D);
353 unsigned char VersionState(DepIterator D,
unsigned char const Check,
354 unsigned char const SetMin,
355 unsigned char const SetPolicy)
const;
358 void Update(DepIterator Dep);
359 void Update(PkgIterator
const &P);
362 void AddSizes(
const PkgIterator &Pkg,
bool const Invert =
false);
363 inline void RemoveSizes(
const PkgIterator &Pkg) {AddSizes(Pkg,
true);};
364 void AddStates(
const PkgIterator &Pkg,
bool const Invert =
false);
365 inline void RemoveStates(
const PkgIterator &Pkg) {AddStates(Pkg,
true);};
370 inline operator pkgCache &() {
return *Cache;};
371 inline Header &Head() {
return *Cache->HeaderP;};
372 inline GrpIterator GrpBegin() {
return Cache->GrpBegin();};
373 inline PkgIterator PkgBegin() {
return Cache->PkgBegin();};
374 inline GrpIterator FindGrp(std::string_view Name) {
return Cache->FindGrp(Name);};
375 inline PkgIterator FindPkg(std::string_view Name) {
return Cache->FindPkg(Name);};
376 inline PkgIterator FindPkg(std::string_view Name, std::string_view Arch) {
return Cache->FindPkg(Name, Arch);};
378 inline pkgCache &GetCache() {
return *Cache;};
381 inline bool IsImportantDep(DepIterator Dep)
const {
return LocalPolicy->
IsImportantDep(Dep);};
382 inline Policy &GetPolicy() {
return *LocalPolicy;};
385 inline StateCache &operator [](PkgIterator
const &I) {
return PkgState[I->ID];};
386 inline StateCache &operator [](PkgIterator
const &I)
const {
return PkgState[I->ID];};
387 inline unsigned char &operator [](DepIterator
const &I) {
return DepState[I->ID];};
388 inline unsigned char const &operator [](DepIterator
const &I)
const {
return DepState[I->ID];};
398 virtual InRootSetFunc *GetRootSetFunc();
401 InRootSetFunc *GetCachedRootSetFunc() APT_HIDDEN;
405 virtual
bool MarkFollowsRecommends();
409 virtual
bool MarkFollowsSuggests();
420 bool MarkAndSweep(InRootSetFunc &rootFunc);
427 bool PhasingApplied(PkgIterator Pkg) const;
432 bool MarkKeep(PkgIterator const &Pkg,
bool Soft = false,
433 bool FromUser = true,
unsigned long Depth = 0);
434 bool MarkDelete(PkgIterator const &Pkg,
bool MarkPurge = false,
435 unsigned long Depth = 0,
bool FromUser = true);
436 bool MarkInstall(PkgIterator const &Pkg,
bool AutoInst = true,
437 unsigned long Depth = 0,
bool FromUser = true,
438 bool ForceImportantDeps = false);
439 void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; };
441 void SetReInstall(PkgIterator
const &Pkg,
bool To);
451 pkgCache::VerIterator GetCandidateVersion(pkgCache::PkgIterator
const &Pkg);
452 void SetCandidateVersion(VerIterator TargetVer);
453 bool SetCandidateRelease(pkgCache::VerIterator TargetVer,
454 std::string
const &TargetRel);
469 bool SetCandidateRelease(pkgCache::VerIterator TargetVer,
470 std::string
const &TargetRel,
471 std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > &Changed);
474 void MarkAuto(
const PkgIterator &Pkg,
bool Auto);
492 virtual bool IsInstallOk(
const PkgIterator &Pkg,
bool AutoInst =
true,
493 unsigned long Depth = 0,
bool FromUser =
true);
507 virtual bool IsDeleteOk(
const PkgIterator &Pkg,
bool MarkPurge =
false,
508 unsigned long Depth = 0,
bool FromUser =
true);
512 bool writeStateFile(
OpProgress *
const prog,
bool const InstalledOnly=
true);
515 inline signed long long UsrSize() {
return iUsrSize;};
516 inline unsigned long long DebSize() {
return iDownloadSize;};
517 inline unsigned long DelCount() {
return iDelCount;};
518 inline unsigned long KeepCount() {
return iKeepCount;};
519 inline unsigned long InstCount() {
return iInstCount;};
520 unsigned long UpgradeCount();
521 inline unsigned long BrokenCount() {
return iBrokenCount;};
522 inline unsigned long PolicyBrokenCount() {
return iPolicyBrokenCount;};
523 inline unsigned long BadCount() {
return iBadCount;};
532 bool CheckConsistency(
char const *
const msgtag =
"");
533#ifdef APT_COMPILING_APT
534 unsigned long long BootSize(
bool initrdOnly);
538 bool IsInstallOkMultiArchSameVersionSynced(PkgIterator
const &Pkg,
539 bool const AutoInst,
unsigned long const Depth,
bool const FromUser);
540 bool IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator
const &Pkg,
541 bool const AutoInst,
unsigned long const Depth,
bool const FromUser);
544 bool IsDeleteOkProtectInstallRequests(PkgIterator
const &Pkg,
545 bool const rPurge,
unsigned long const Depth,
bool const FromUser);
551 APT_HIDDEN
bool MarkInstall_StateChange(PkgIterator
const &Pkg,
bool AutoInst,
bool FromUser);
552 APT_HIDDEN
bool MarkInstall_DiscardInstall(PkgIterator
const &Pkg);
554 APT_HIDDEN
void PerformDependencyPass(
OpProgress *
const Prog);