summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-08-10 00:08:39 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-08-10 00:08:39 +0200
commitbe615841e27068522c467899c96c541b74e4c349 (patch)
tree3ff2b44d5707bccb8d23a3248e7020947a389f79 /apt-pkg/depcache.cc
parentc8d80b1d346c9c24f897813d5793e69bb59e465b (diff)
parent1b1c2224f5777956f345471b600ed56203c2d400 (diff)
* merged the apt--install-recommends branch
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc56
1 files changed, 45 insertions, 11 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 369eae70b..27b6134b4 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -778,7 +778,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
installed */
StateCache &P = PkgState[Pkg->ID];
P.iFlags &= ~AutoKept;
- if (P.InstBroken() == false && (P.Mode == ModeInstall ||
+ if ((P.InstPolicyBroken() == false && P.InstBroken() == false) &&
+ (P.Mode == ModeInstall ||
P.CandidateVer == (Version *)Pkg.CurrentVer()))
{
if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0)
@@ -789,11 +790,9 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
// See if there is even any possible instalation candidate
if (P.CandidateVer == 0)
return;
-
// We dont even try to install virtual packages..
if (Pkg->VersionList == 0)
return;
-
/* Target the candidate version and remove the autoflag. We reset the
autoflag below if this was called recursively. Otherwise the user
should have the ability to de-auto a package by changing its state */
@@ -850,7 +849,33 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
it will be installed. Otherwise we only worry about critical deps */
if (IsImportantDep(Start) == false)
continue;
- if (Pkg->CurrentVer != 0 && Start.IsCritical() == false)
+
+ /* check if any ImportantDep() (but not Critial) where added
+ * since we installed the thing
+ */
+ bool isNewImportantDep = false;
+ if(IsImportantDep(Start) && !Start.IsCritical())
+ {
+ bool found=false;
+ VerIterator instVer = Pkg.CurrentVer();
+ for (DepIterator D = instVer.DependsList(); !D.end(); D++)
+ {
+ //FIXME: deal better with or-groups(?)
+ DepIterator LocalStart = D;
+
+ if(IsImportantDep(Dep) && Start.TargetPkg() == D.TargetPkg())
+ found=true;
+ }
+ // this is a new dep if it was not found to be already
+ // a important dep of the installed pacakge
+ isNewImportantDep = !found;
+ }
+ if(isNewImportantDep)
+ if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true)
+ std::clog << "new important dependency: "
+ << Start.TargetPkg().Name() << std::endl;
+
+ if (Pkg->CurrentVer != 0 && Start.IsCritical() == false && !isNewImportantDep)
continue;
/* If we are in an or group locate the first or that can
@@ -1055,13 +1080,6 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
return Last;
}
/*}}}*/
-// Policy::IsImportantDep - True if the dependency is important /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
-{
- return Dep.IsCritical();
-}
/*}}}*/
pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc()
@@ -1276,3 +1294,19 @@ bool pkgDepCache::Sweep()
return true;
}
+
+// Policy::IsImportantDep - True if the dependency is important /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
+{
+ if(Dep.IsCritical())
+ return true;
+ else if(Dep->Type == pkgCache::Dep::Recommends)
+ return _config->FindB("APT::Install-Recommends", false);
+ else if(Dep->Type == pkgCache::Dep::Suggests)
+ return _config->FindB("APT::Install-Suggests", false);
+
+ return false;
+}
+ /*}}}*/