Bladeren bron

* merged from apt--mvo

Michael Vogt 19 jaren geleden
bovenliggende
commit
f324844723
6 gewijzigde bestanden met toevoegingen van 26 en 10 verwijderingen
  1. 8 2
      apt-pkg/depcache.cc
  2. 1 1
      apt-pkg/depcache.h
  3. 15 5
      cmdline/apt-get.cc
  4. 1 0
      cmdline/apt-mark
  5. 1 0
      methods/http.cc
  6. 0 2
      methods/http.h

+ 8 - 2
apt-pkg/depcache.cc

@@ -23,6 +23,8 @@
 #include <sstream>    
 #include <sstream>    
 #include <set>
 #include <set>
 
 
+#include <sys/stat.h>
+
 #include <apti18n.h>    
 #include <apti18n.h>    
 
 
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
@@ -176,7 +178,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
    return true;
    return true;
 }
 }
 
 
-bool pkgDepCache::writeStateFile(OpProgress *prog)
+bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
 {
 {
    if(_config->FindB("Debug::pkgAutoRemove",false))
    if(_config->FindB("Debug::pkgAutoRemove",false))
       std::clog << "pkgDepCache::writeStateFile()" << std::endl;
       std::clog << "pkgDepCache::writeStateFile()" << std::endl;
@@ -238,6 +240,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
 	       std::clog << "Skipping already written " << pkg.Name() << std::endl;
 	       std::clog << "Skipping already written " << pkg.Name() << std::endl;
 	    continue;
 	    continue;
 	 }
 	 }
+         // skip not installed ones if requested
+         if(InstalledOnly && pkg->CurrentVer == 0)
+            continue;
 	 if(_config->FindB("Debug::pkgAutoRemove",false))
 	 if(_config->FindB("Debug::pkgAutoRemove",false))
 	    std::clog << "Writing new AutoInstall: " 
 	    std::clog << "Writing new AutoInstall: " 
 		      << pkg.Name() << std::endl;
 		      << pkg.Name() << std::endl;
@@ -250,8 +255,9 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
    }
    }
    fclose(OutFile);
    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());
    rename(outfile.c_str(), state.c_str());
+   chmod(state.c_str(), 0644);
 
 
    return true;
    return true;
 }
 }

+ 1 - 1
apt-pkg/depcache.h

@@ -403,7 +403,7 @@ class pkgDepCache : protected pkgCache::Namespace
 
 
    // read persistent states
    // read persistent states
    bool readStateFile(OpProgress *prog);
    bool readStateFile(OpProgress *prog);
-   bool writeStateFile(OpProgress *prog);
+   bool writeStateFile(OpProgress *prog, bool InstalledOnly=false);
    
    
    // Size queries
    // Size queries
    inline double UsrSize() {return iUsrSize;};
    inline double UsrSize() {return iUsrSize;};

+ 15 - 5
cmdline/apt-get.cc

@@ -1535,7 +1535,7 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
       buf[end-start] = 0x0;
       buf[end-start] = 0x0;
       if (regexec(&Pattern,buf,0,0,0) != 0)
       if (regexec(&Pattern,buf,0,0,0) != 0)
 	 continue;
 	 continue;
-      res &= TryToInstall(Pkg,Cache,Fix,false,BrokenFix,ExpectedInst);
+      res &= TryToInstall(Pkg,Cache,Fix,false,true,ExpectedInst);
       found = true;
       found = true;
    }
    }
    
    
@@ -1595,6 +1595,18 @@ bool DoInstall(CommandLine &CmdL)
 	 bool Remove = DefRemove;
 	 bool Remove = DefRemove;
 	 char *VerTag = 0;
 	 char *VerTag = 0;
 	 bool VerIsRel = false;
 	 bool VerIsRel = false;
+
+         // this is a task!
+         if (Length >= 1 && S[Length - 1] == '^')
+         {
+            S[--Length] = 0;
+            // tasks must always be confirmed
+            ExpectedInst += 1000;
+            // see if we can install it
+            TryInstallTask(Cache, Fix, BrokenFix, ExpectedInst, S);
+            continue;
+         }
+
 	 while (Cache->FindPkg(S).end() == true)
 	 while (Cache->FindPkg(S).end() == true)
 	 {
 	 {
 	    // Handle an optional end tag indicating what to do
 	    // Handle an optional end tag indicating what to do
@@ -1743,10 +1755,8 @@ bool DoInstall(CommandLine &CmdL)
 	 return _error->Error(_("Broken packages"));
 	 return _error->Error(_("Broken packages"));
       }   
       }   
    }
    }
-   if (_config->FindB("APT::Get::AutomaticRemove")) {
-      if (!DoAutomaticRemove(Cache)) 
-	 return false;
-   }
+   if (!DoAutomaticRemove(Cache)) 
+      return false;
 
 
    /* Print out a list of packages that are going to be installed extra
    /* Print out a list of packages that are going to be installed extra
       to what the user asked */
       to what the user asked */

+ 1 - 0
cmdline/apt-mark

@@ -62,3 +62,4 @@ if __name__ == "__main__":
         # all done, rename the tmpfile
         # all done, rename the tmpfile
         os.chmod(outfile.name, 0644)
         os.chmod(outfile.name, 0644)
         os.rename(outfile.name, STATE_FILE)
         os.rename(outfile.name, STATE_FILE)
+        os.chmod(outfile.name, 0644)

+ 1 - 0
methods/http.cc

@@ -58,6 +58,7 @@ time_t HttpMethod::FailTime = 0;
 unsigned long PipelineDepth = 10;
 unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 unsigned long TimeOut = 120;
 bool Debug = false;
 bool Debug = false;
+URI Proxy;
 
 
 unsigned long CircleBuf::BwReadLimit=0;
 unsigned long CircleBuf::BwReadLimit=0;
 unsigned long CircleBuf::BwTickReadData=0;
 unsigned long CircleBuf::BwTickReadData=0;

+ 0 - 2
methods/http.h

@@ -158,6 +158,4 @@ class HttpMethod : public pkgAcqMethod
    };
    };
 };
 };
 
 
-URI Proxy;
-
 #endif
 #endif