]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
avoid using global PendingError to avoid failing too often too soon
[apt.git] / cmdline / apt-get.cc
index 9189425051b55c539df1b1a8d5940f7613fbb9c9..ebc8c94c27dbc1f4378327ce86eea2262e300b1a 100644 (file)
@@ -39,7 +39,6 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/indexfile.h>
-#include <apt-pkg/indexrecords.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/metaindex.h>
@@ -630,9 +629,6 @@ static bool DoDownload(CommandLine &CmdL)
       return true;
    }
 
-   // Disable drop-privs if "_apt" can not write to the target dir
-   CheckDropPrivsMustBeDisabled(Fetcher);
-
    if (_error->PendingError() == true || CheckAuth(Fetcher, false) == false)
       return false;
 
@@ -702,7 +698,7 @@ static bool DoSource(CommandLine &CmdL)
    AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
    pkgAcquire Fetcher(&Stat);
 
-   SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
+   std::unique_ptr<DscFile[]> Dsc(new DscFile[CmdL.FileSize()]);
    
    // insert all downloaded uris into this set to avoid downloading them
    // twice
@@ -851,9 +847,6 @@ static bool DoSource(CommandLine &CmdL)
       return true;
    }
 
-   // Disable drop-privs if "_apt" can not write to the target dir
-   CheckDropPrivsMustBeDisabled(Fetcher);
-
    // check authentication status of the source as well
    if (UntrustedList.empty() == false && AuthPrompt(UntrustedList, false) == false)
       return false;
@@ -967,8 +960,10 @@ static bool DoBuildDep(CommandLine &CmdL)
    CacheFile Cache;
 
    _config->Set("APT::Install-Recommends", false);
+
+   bool WantLock = _config->FindB("APT::Get::Print-URIs", false) == false;
    
-   if (Cache.Open(true) == false)
+   if (Cache.Open(WantLock) == false)
       return false;
 
    if (CmdL.FileSize() <= 1)
@@ -1001,7 +996,7 @@ static bool DoBuildDep(CommandLine &CmdL)
    {
       string Src;
       pkgSrcRecords::Parser *Last = 0;
-      SPtr<pkgSrcRecords::Parser> LastOwner;
+      std::unique_ptr<pkgSrcRecords::Parser> LastOwner;
 
       // an unpacked debian source tree
       using APT::String::Startswith;
@@ -1013,7 +1008,7 @@ static bool DoBuildDep(CommandLine &CmdL)
          std::string TypeName = "Debian control file";
          pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
          if(Type != NULL)
-            LastOwner = Last = Type->CreateSrcPkgParser(*I);
+            LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
       }
       // if its a local file (e.g. .dsc) use this
       else if (FileExists(*I))
@@ -1024,7 +1019,7 @@ static bool DoBuildDep(CommandLine &CmdL)
          string TypeName = "Debian " + flExtension(*I) + " file";
          pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
          if(Type != NULL)
-            LastOwner = Last = Type->CreateSrcPkgParser(*I);
+            LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
       } else {
          // normal case, search the cache for the source file
         Last = FindSrc(*I,SrcRecs,Src,Cache);
@@ -1402,11 +1397,6 @@ static bool DoChangelog(CommandLine &CmdL)
 
    if (printOnly == false)
    {
-      // Disable drop-privs if "_apt" can not write to the target dir
-      CheckDropPrivsMustBeDisabled(Fetcher);
-      if (_error->PendingError() == true)
-        return false;
-
       bool Failed = false;
       if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
         return false;
@@ -1497,11 +1487,21 @@ static bool DoIndexTargets(CommandLine &CmdL)
               << "Description: " << T->Description << "\n"
               << "URI: " << T->URI << "\n"
               << "Filename: " << filename << "\n"
-              << "Optional: " << (T->IsOptional ? "yes" : "no") << "\n";
+              << "Optional: " << (T->IsOptional ? "yes" : "no") << "\n"
+              << "KeepCompressed: " << (T->KeepCompressed ? "yes" : "no") << "\n";
            for (std::map<std::string,std::string>::const_iterator O = AddOptions.begin(); O != AddOptions.end(); ++O)
               stanza << format_key(O->first) << ": " << O->second << "\n";
            for (std::map<std::string,std::string>::const_iterator O = T->Options.begin(); O != T->Options.end(); ++O)
-              stanza << format_key(O->first) << ": " << O->second << "\n";
+           {
+              if (O->first == "PDIFFS")
+                 stanza << "PDiffs: " << O->second << "\n";
+              else if (O->first == "COMPRESSIONTYPES")
+                 stanza << "CompressionTypes: " << O->second << "\n";
+              else if (O->first == "DEFAULTENABLED")
+                 stanza << "DefaultEnabled: " << O->second << "\n";
+              else
+                 stanza << format_key(O->first) << ": " << O->second << "\n";
+           }
            stanza << "\n";
 
            if (Filtered)
@@ -1644,13 +1644,16 @@ int main(int argc,const char *argv[])                                   /*{{{*/
                                    {"remove",&DoInstall},
                                    {"purge",&DoInstall},
                                   {"autoremove",&DoInstall},
+                                  {"auto-remove",&DoInstall},
                                   {"markauto",&DoMarkAuto},
                                   {"unmarkauto",&DoMarkAuto},
                                    {"dist-upgrade",&DoDistUpgrade},
+                                   {"full-upgrade",&DoDistUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
                                   {"build-dep",&DoBuildDep},
                                    {"clean",&DoClean},
                                    {"autoclean",&DoAutoClean},
+                                   {"auto-clean",&DoAutoClean},
                                    {"check",&DoCheck},
                                   {"source",&DoSource},
                                    {"download",&DoDownload},