]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
use always priv-dropping for changelog download as root
[apt.git] / cmdline / apt-get.cc
index d515a0f4fd42c99f5e9bcf5857347cc2656be13c..b6150a4233b7abc4843da2de8955f4b7124377cc 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>
@@ -702,7 +701,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
@@ -967,8 +966,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 +1002,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 +1014,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 +1025,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);
@@ -1172,12 +1173,12 @@ static bool DoBuildDep(CommandLine &CmdL)
               for (; Ver != verlist.end(); ++Ver)
               {
                  forbidden.clear();
-                 if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All)
+                 if (Ver->MultiArch == pkgCache::Version::No || Ver->MultiArch == pkgCache::Version::All)
                  {
                     if (colon == string::npos)
                        Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
                     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
-                       forbidden = "Multi-Arch: none";
+                       forbidden = "Multi-Arch: no";
                     else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
                        Pkg = Ver.ParentPkg().Group().FindPkg("native");
                  }
@@ -1402,10 +1403,7 @@ 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;
+      // Note: CheckDropPrivsMustBeDisabled isn't needed here as the download happens in a dedicated tempdir
 
       bool Failed = false;
       if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
@@ -1644,13 +1642,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},