From e6756cdefaad7818f4a3bb95e7a935bc6cf8ed2e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 13 Mar 2007 13:38:12 +0100 Subject: * apt-pkg/packagemanager.cc: - use ActionGroup() to protect FixMissing() --- apt-pkg/packagemanager.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index b0dd43629..1e57d6455 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -95,9 +95,10 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, be downloaded. */ bool pkgPackageManager::FixMissing() { + pkgDepCache::ActionGroup group(Cache); pkgProblemResolver Resolve(&Cache); List->SetFileList(FileNames); - + bool Bad = false; for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { -- cgit v1.2.3 From 92b9551f03035f5a875a44588a318773f652da6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 11:45:33 +0100 Subject: * apt-pkg/depcache.cc: - added APT::Never-MarkAuto-Section variable - that will consider dependencies of packages in this section manual --- apt-pkg/depcache.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 3dc9bda35..f5673dd5d 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -907,7 +907,22 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, std::clog << "Installing " << InstPkg.Name() << " as dep of " << Pkg.Name() << std::endl; - MarkInstall(InstPkg, true, Depth + 1, false); + // 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(_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; + MarkInstall(InstPkg,true,Depth + 1, true); + } + else + { + // mark automatic dependency + MarkInstall(InstPkg,true,Depth + 1, false); + // Set the autoflag, after MarkInstall because MarkInstall unsets it + if (P->CurrentVer == 0) + PkgState[InstPkg->ID].Flags |= Flag::Auto; + } } continue; } -- cgit v1.2.3