summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-07-26 10:45:18 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-07-26 10:45:18 +0200
commit54c3559f961675e15d0c27cff260eca009bec92c (patch)
treea73661c12a76be7570ace67ff7d5fe3813f4ccc0
parent0fbb494b343342af795a17a56d4b915499c52ed9 (diff)
parentdfd1a56e88c068f0085140630306901d01ed0f98 (diff)
* apt-pkg/depcache.cc:
- support a list of sections for: APT::Install-Recommends-Sections APT::Never-MarkAuto-Sections
-rw-r--r--apt-pkg/depcache.cc37
-rw-r--r--debian/changelog7
-rw-r--r--doc/examples/configure-index2
3 files changed, 35 insertions, 11 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 7f5719454..c21872449 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -27,6 +27,27 @@
#include <apti18n.h>
+// helper for Install-Recommends-Sections and Never-MarkAuto-Sections
+static bool
+ConfigValueInSubTree(const char* SubTree, const char *needle)
+{
+ Configuration::Item const *Opts;
+ Opts = _config->Tree(SubTree);
+ if (Opts != 0 && Opts->Child != 0)
+ {
+ Opts = Opts->Child;
+ for (; Opts != 0; Opts = Opts->Next)
+ {
+ if (Opts->Value.empty() == true)
+ continue;
+ if (strcmp(needle, Opts->Value.c_str()) == 0)
+ return true;
+ }
+ }
+ return false;
+}
+
+
pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
cache(cache), released(false)
{
@@ -954,11 +975,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
<< " as dep of " << Pkg.Name()
<< std::endl;
// now check if we should consider it a automatic dependency or not
- string sec = _config->Find("APT::Never-MarkAuto-Section","");
- if(Pkg.Section() && (string(Pkg.Section()) == sec))
+ if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section()))
{
if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true)
- std::clog << "Setting NOT as auto-installed because its a direct dep of a package in section " << sec << std::endl;
+ std::clog << "Setting NOT as auto-installed (direct dep of pkg in APT::Never-MarkAuto-Section)" << std::endl;
MarkInstall(InstPkg,true,Depth + 1, true);
}
else
@@ -1131,6 +1151,7 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
return Last;
}
/*}}}*/
+
// Policy::IsImportantDep - True if the dependency is important /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -1146,13 +1167,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
// sections
// FIXME: this is a meant as a temporarly solution until the
// recommends are cleaned up
- string s = _config->Find("APT::Install-Recommends-Section","");
- if(s.size() > 0)
- {
- const char *sec = Dep.ParentVer().Section();
- if (sec && strcmp(sec, s.c_str()) == 0)
- return true;
- }
+ const char *sec = Dep.ParentVer().Section();
+ if (sec && ConfigValueInSubTree("APT::Install-Recommends-Sections", sec))
+ return true;
}
else if(Dep->Type == pkgCache::Dep::Suggests)
return _config->FindB("APT::Install-Suggests", false);
diff --git a/debian/changelog b/debian/changelog
index 579dd4e5f..8961a0257 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,15 @@
apt (0.7.5) UNRELEASED; urgency=low
+ [ Otavio Salvador ]
* Applied patch from Guillem Jover <guillem.jover@nokia.com> to use
dpkg-architecture to get the host architecture (closes: #407187)
+ [ Michael Vogt ]
+ * apt-pkg/depcache.cc:
+ - support a list of sections for:
+ APT::Install-Recommends-Sections
+ APT::Never-MarkAuto-Sections
+
-- Otavio Salvador <otavio@ossystems.com.br> Wed, 25 Jul 2007 20:16:46 -0300
apt (0.7.4) unstable; urgency=low
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index bf086e9c1..ab3657a58 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -101,7 +101,7 @@ APT
Install-Suggests "false";
// consider dependencies of packages in this section manual
- Never-MarkAuto-Section "metapackages";
+ Never-MarkAuto-Sections {"metapackages"; "universe/metapackages"; };
// Write progress messages on this fd (for stuff like base-config)
Status-Fd "-1";