From 6bc703c22970055d9e1a1b4e3e0efe74f4cefda5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 21 Mar 2010 21:48:09 +0100 Subject: =?UTF-8?q?Add=20with=20pkgCacheGen::Essential=20a=20way=20to=20co?= =?UTF-8?q?ntrol=20which=20packages=20get=20the=20essential=20flag:=20*=20?= =?UTF-8?q?native=20is=20the=20default=20and=20will=20only=20mark=20packag?= =?UTF-8?q?es=20of=20the=20main=20arch=20*=20all=20will=20mark=20all=20pac?= =?UTF-8?q?kages=20which=20have=20these=20flag=20in=20Packages=20*=20none?= =?UTF-8?q?=20will=20obviously=20do=20the=20opposite=20*=20installed=20wil?= =?UTF-8?q?l=20only=20mark=20packages=20which=20are=20installed=20as=20ess?= =?UTF-8?q?ential,=20=20=20so=20it=20will=20behave=20in=20the=20same=20way?= =?UTF-8?q?=20as=20dpkg=20does=20it.=20It=20is=20mostly=20needed=20sometim?= =?UTF-8?q?es=20for=20debugging=20but=20some=20users=20with=20special=20ne?= =?UTF-8?q?eds=20might=20like=20to=20switch=20the=20mode=20as=20well=20und?= =?UTF-8?q?er=20the=20expense=20to=20be=20on=20their=20own=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/deb/deblistparser.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 5c9cf6d4b..947e060e3 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -255,9 +255,13 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg, if (Pkg->Section == 0) Pkg->Section = UniqFindTagWrite("Section"); - // Packages which are not from "our" arch doesn't get the essential flag + // Packages which are not from the "native" arch doesn't get the essential flag + // in the default "native" mode - it is also possible to mark "all" or "none". + // The "installed" mode is handled by ParseStatus(), See #544481 and friends. string const static myArch = _config->Find("APT::Architecture"); - if (Pkg->Arch != 0 && myArch == Pkg.Arch()) + string const static essential = _config->Find("pkgCacheGen::Essential", "native"); + if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) || + essential == "all") if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) return false; if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false) @@ -333,7 +337,13 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg, const char *Stop; if (Section.Find("Status",Start,Stop) == false) return true; - + + // UsePackage() is responsible for setting the flag in the default case + bool const static essential = _config->Find("pkgCacheGen::Essential", "") == "installed"; + if (essential == true && + Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) + return false; + // Isolate the first word const char *I = Start; for(; I < Stop && *I != ' '; I++); -- cgit v1.2.3