X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a345a69945548525d5219fcd18e3754f4d252bfd..3bb98bee11b38df0264099f3c9e858880759999d:/apt-pkg/depcache.cc diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 81e1eeb33..ca9636cc1 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -8,9 +8,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/depcache.h" -#endif #include #include #include @@ -26,6 +23,8 @@ #include #include +#include + #include pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) : @@ -241,9 +240,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) std::clog << "Skipping already written " << pkg.Name() << std::endl; continue; } - // skip not installed ones if requested - if(InstalledOnly && pkg->CurrentVer == 0) - continue; + // skip not installed ones if requested + if(InstalledOnly && pkg->CurrentVer == 0) + continue; if(_config->FindB("Debug::pkgAutoRemove",false)) std::clog << "Writing new AutoInstall: " << pkg.Name() << std::endl; @@ -256,8 +255,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) } fclose(OutFile); - // move the outfile over the real file + // move the outfile over the real file and set permissions rename(outfile.c_str(), state.c_str()); + chmod(state.c_str(), 0644); return true; } @@ -715,7 +715,6 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser) // We dont even try to keep virtual packages.. if (Pkg->VersionList == 0) return; - #if 0 // reseting the autoflag here means we lose the // auto-mark information if a user selects a package for removal // but changes his mind then and sets it for keep again @@ -955,11 +954,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, ForceImportantDeps); - - // Set the autoflag, after MarkInstall because MarkInstall unsets it - if (P->CurrentVer == 0) - PkgState[InstPkg->ID].Flags |= Flag::Auto; + // 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, ForceImportantDeps); + // Set the autoflag, after MarkInstall because MarkInstall unsets it + if (P->CurrentVer == 0) + PkgState[InstPkg->ID].Flags |= Flag::Auto; + } } continue; } @@ -1122,6 +1132,34 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg) return Last; } /*}}}*/ +// Policy::IsImportantDep - True if the dependency is important /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep) +{ + if(Dep.IsCritical()) + return true; + else if(Dep->Type == pkgCache::Dep::Recommends) + { + if ( _config->FindB("APT::Install-Recommends", false)) + return true; + // we suport a special mode to only install-recommends for certain + // 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; + } + } + else if(Dep->Type == pkgCache::Dep::Suggests) + return _config->FindB("APT::Install-Suggests", false); + + return false; +} /*}}}*/ pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc() @@ -1341,32 +1379,3 @@ bool pkgDepCache::Sweep() return true; } -// Policy::IsImportantDep - True if the dependency is important /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep) -{ - if(Dep.IsCritical()) - return true; - else if(Dep->Type == pkgCache::Dep::Recommends) - { - if ( _config->FindB("APT::Install-Recommends", false)) - return true; - // we suport a special mode to only install-recommends for certain - // 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; - } - } - else if(Dep->Type == pkgCache::Dep::Suggests) - return _config->FindB("APT::Install-Suggests", false); - - return false; -} - /*}}}*/