From 6bc703c22970055d9e1a1b4e3e0efe74f4cefda5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 21 Mar 2010 21:48:09 +0100 Subject: [PATCH] =?utf8?q?Add=20with=20pkgCacheGen::Essential=20a=20way=20?= =?utf8?q?to=20control=20which=20packages=20get=20the=20essential=20flag:?= =?utf8?q?=20*=20native=20is=20the=20default=20and=20will=20only=20mark=20?= =?utf8?q?packages=20of=20the=20main=20arch=20*=20all=20will=20mark=20all?= =?utf8?q?=20packages=20which=20have=20these=20flag=20in=20Packages=20*=20?= =?utf8?q?none=20will=20obviously=20do=20the=20opposite=20*=20installed=20?= =?utf8?q?will=20only=20mark=20packages=20which=20are=20installed=20as=20e?= =?utf8?q?ssential,=20=20=20so=20it=20will=20behave=20in=20the=20same=20wa?= =?utf8?q?y=20as=20dpkg=20does=20it.=20It=20is=20mostly=20needed=20sometim?= =?utf8?q?es=20for=20debugging=20but=20some=20users=20with=20special=20nee?= =?utf8?q?ds=20might=20like=20to=20switch=20the=20mode=20as=20well=20under?= =?utf8?q?=20the=20expense=20to=20be=20on=20their=20own=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apt-pkg/deb/deblistparser.cc | 16 +++++++++++++--- doc/examples/configure-index | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) 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++); diff --git a/doc/examples/configure-index b/doc/examples/configure-index index f07302efd..f08a42ec7 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -432,6 +432,8 @@ Debug } +pkgCacheGen::Essential "native"; // other modes: all, none, installed + /* Whatever you do, do not use this configuration file!! Take out ONLY the portions you need! */ This Is Not A Valid Config File -- 2.47.2