]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
* merged apt--no-pragma
[apt.git] / apt-pkg / depcache.cc
index 81e1eeb336237986a59bc94ed6358077fd782a56..9f0fa143d3e033b90ea5d7ef468922c63713022c 100644 (file)
@@ -8,9 +8,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/depcache.h"
-#endif
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/error.h>
@@ -26,6 +23,8 @@
 #include <sstream>    
 #include <set>
 
+#include <sys/stat.h>
+
 #include <apti18n.h>    
 
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
@@ -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;
 }
@@ -955,11 +955,23 @@ 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, ForceImportantDeps);
+           }
+           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;
       }