summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc26
-rw-r--r--apt-pkg/depcache.h5
2 files changed, 20 insertions, 11 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 6296892ba..bfcb8e0eb 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -239,9 +239,11 @@ void pkgDepCache::AddStates(const PkgIterator &Pkg,int Add)
{
StateCache &State = PkgState[Pkg->ID];
- // The Package is broken
+ // The Package is broken (either minimal dep or policy dep)
if ((State.DepState & DepInstMin) != DepInstMin)
iBrokenCount += Add;
+ if ((State.DepState & DepInstPolicy) != DepInstPolicy)
+ iPolicyBrokenCount += Add;
// Bad state
if (Pkg.State() != PkgIterator::NeedsNothing)
@@ -596,7 +598,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge)
// ---------------------------------------------------------------------
/* */
void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
- unsigned long Depth)
+ unsigned long Depth, bool ForceImportantDeps)
{
if (Depth > 100)
return;
@@ -664,24 +666,26 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
/* Check if this dep should be consider for install. If it is a user
defined important dep and we are installed a new package then
- it will be installed. Otherwise we only worry about critical deps */
+ it will be installed. Otherwise we only check for important
+ deps that have changed from the installed version
+ */
if (IsImportantDep(Start) == false)
continue;
-
+
/* check if any ImportantDep() (but not Critial) where added
- * since we installed the thing
+ * since we installed the package
*/
bool isNewImportantDep = false;
- if(IsImportantDep(Start) && !Start.IsCritical())
+ if(!ForceImportantDeps && !Start.IsCritical())
{
bool found=false;
VerIterator instVer = Pkg.CurrentVer();
- for (DepIterator D = instVer.DependsList(); !D.end(); D++)
+ for (DepIterator D = instVer.DependsList(); D.end() != true; D++)
{
//FIXME: deal better with or-groups(?)
DepIterator LocalStart = D;
- if(IsImportantDep(Dep) && Start.TargetPkg() == D.TargetPkg())
+ if(IsImportantDep(D) && Start.TargetPkg() == D.TargetPkg())
found=true;
}
// this is a new dep if it was not found to be already
@@ -693,7 +697,9 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
std::clog << "new important dependency: "
<< Start.TargetPkg().Name() << std::endl;
- if (Pkg->CurrentVer != 0 && Start.IsCritical() == false && !isNewImportantDep)
+ // skip important deps if the package is already installed
+ if (Pkg->CurrentVer != 0 && Start.IsCritical() == false
+ && !isNewImportantDep && !ForceImportantDeps)
continue;
/* If we are in an or group locate the first or that can
@@ -741,7 +747,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
std::clog << "Installing " << InstPkg.Name()
<< " as dep of " << Pkg.Name()
<< std::endl;
- MarkInstall(InstPkg,true,Depth + 1);
+ MarkInstall(InstPkg,true,Depth + 1, ForceImportantDeps);
// Set the autoflag, after MarkInstall because MarkInstall unsets it
if (P->CurrentVer == 0)
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 3f9f67140..042abb5cc 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -97,6 +97,7 @@ class pkgDepCache : protected pkgCache::Namespace
inline bool Downgrade() const {return Status < 0 && Mode == ModeInstall;};
inline bool Held() const {return Status != 0 && Keep();};
inline bool NowBroken() const {return (DepState & DepNowMin) != DepNowMin;};
+ inline bool NowPolicyBroken() const {return (DepState & DepNowPolicy) != DepNowPolicy;};
inline bool InstBroken() const {return (DepState & DepInstMin) != DepInstMin;};
inline bool InstPolicyBroken() const {return (DepState & DepInstPolicy) != DepInstPolicy;};
inline bool Install() const {return Mode == ModeInstall;};
@@ -134,6 +135,7 @@ class pkgDepCache : protected pkgCache::Namespace
unsigned long iDelCount;
unsigned long iKeepCount;
unsigned long iBrokenCount;
+ unsigned long iPolicyBrokenCount;
unsigned long iBadCount;
Policy *delLocalPolicy; // For memory clean up..
@@ -187,7 +189,7 @@ class pkgDepCache : protected pkgCache::Namespace
void MarkKeep(PkgIterator const &Pkg,bool Soft = false);
void MarkDelete(PkgIterator const &Pkg,bool Purge = false);
void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
- unsigned long Depth = 0);
+ unsigned long Depth = 0, bool ForceImportantDeps = false);
void SetReInstall(PkgIterator const &Pkg,bool To);
void SetCandidateVersion(VerIterator TargetVer);
@@ -201,6 +203,7 @@ class pkgDepCache : protected pkgCache::Namespace
inline unsigned long KeepCount() {return iKeepCount;};
inline unsigned long InstCount() {return iInstCount;};
inline unsigned long BrokenCount() {return iBrokenCount;};
+ inline unsigned long PolicyBrokenCount() {return iPolicyBrokenCount;};
inline unsigned long BadCount() {return iBadCount;};
bool Init(OpProgress *Prog);