summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-18 16:39:10 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-18 16:39:10 +0100
commitd2ce308082886c50d0ef47efa5a277370603fac1 (patch)
tree616fbd3d84e81c2a50cad68bab5f6538b683492c /cmdline
parentf82dcd7e4ebb3f70d28e9feb3621676f8c0cc024 (diff)
parent815d5b01bf9be1d476b110050b20ae980c76d4a8 (diff)
Merge branch 'solver3'
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-mark.cc36
1 files changed, 1 insertions, 35 deletions
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index 33716bb3c..180247cd0 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -139,40 +139,6 @@ static bool DoMarkAuto(CommandLine &CmdL)
return true;
}
/*}}}*/
-// helper for Install-Recommends-Sections and Never-MarkAuto-Sections /*{{{*/
-// FIXME: Copied verbatim from apt-pkg/depcache.cc
-static bool ConfigValueInSubTree(const char* SubTree, std::string_view const needle)
-{
- if (needle.empty())
- return false;
- Configuration::Item const *Opts = _config->Tree(SubTree);
- if (Opts != nullptr && Opts->Child != nullptr)
- {
- Opts = Opts->Child;
- for (; Opts != nullptr; Opts = Opts->Next)
- {
- if (Opts->Value.empty())
- continue;
- if (needle == Opts->Value)
- return true;
- }
- }
- return false;
-}
-static bool SectionInSubTree(char const * const SubTree, std::string_view Needle)
-{
- if (ConfigValueInSubTree(SubTree, Needle))
- return true;
- auto const sub = Needle.rfind('/');
- if (sub == std::string_view::npos)
- {
- std::string special{"/"};
- special.append(Needle);
- return ConfigValueInSubTree(SubTree, special);
- }
- return ConfigValueInSubTree(SubTree, Needle.substr(sub + 1));
-}
- /*}}}*/
/* DoMinimize - minimize manually installed {{{*/
/* Traverses dependencies of meta packages and marks them as manually
* installed. */
@@ -192,7 +158,7 @@ static bool DoMinimize(CommandLine &CmdL)
auto ver = pkg.CurrentVer();
return ver.end() == false && ((*DepCache)[pkg].Flags & pkgCache::Flag::Auto) == 0 &&
ver->Section != 0 &&
- SectionInSubTree("APT::Never-MarkAuto-Sections", ver.Section());
+ _config->SectionInSubTree("APT::Never-MarkAuto-Sections", ver.Section());
};
APT::PackageSet roots;