]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-item.cc
use one 'store' method to rule all (de)compressors
[apt.git] / apt-pkg / acquire-item.cc
index 7f31d14492b967a649c0cb5bdd2e1f3dadd18dd3..6b0debb44fd7b84011cb61b9cc25343b21c6a98f 100644 (file)
@@ -422,7 +422,7 @@ bool pkgAcqIndex::TransactionState(TransactionStates const state)
         {
            // keep the compressed file, but drop the decompressed
            EraseFileName.clear();
-           if (PartialFile.empty() == false && flExtension(PartialFile) == "decomp")
+           if (PartialFile.empty() == false && flExtension(PartialFile) != CurrentCompressionExtension)
               RemoveFile("TransactionAbort", PartialFile);
         }
         break;
@@ -1042,9 +1042,13 @@ void pkgAcqMetaBase::QueueIndexes(bool const verify)                     /*{{{*/
       // download time, bandwidth and diskspace for nothing, BUT Debian doesn't feature all
       // in the set of supported architectures, so we can filter based on this property rather
       // than invent an entirely new flag we would need to carry for all of eternity.
-      if (Target->Option(IndexTarget::ARCHITECTURE) == "all" &&
-           TransactionManager->MetaIndexParser->IsArchitectureSupported("all") == false)
-        continue;
+      if (Target->Option(IndexTarget::ARCHITECTURE) == "all")
+      {
+        if (TransactionManager->MetaIndexParser->IsArchitectureSupported("all") == false)
+           continue;
+        if (TransactionManager->MetaIndexParser->IsArchitectureAllSupportedFor(*Target) == false)
+           continue;
+      }
 
       bool trypdiff = Target->OptionBool(IndexTarget::PDIFFS);
       if (verify == true)
@@ -2677,7 +2681,8 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const
    {
       Stage = STAGE_DECOMPRESS_AND_VERIFY;
       Local = true;
-      DestFile += ".decomp";
+      if (CurrentCompressionExtension != "uncompressed")
+        DestFile.erase(DestFile.length() - (CurrentCompressionExtension.length() + 1));
       Desc.URI = "copy:" + FileName;
       QueueURI(Desc);
       SetActiveSubprocess("copy");
@@ -2699,6 +2704,18 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const
         SetActiveSubprocess("copy");
         return;
       }
+      else
+      {
+        // symlinking ensures that the filename can be used for compression detection
+        // that is e.g. needed for by-hash over file
+        if (symlink(FileName.c_str(),DestFile.c_str()) != 0)
+           _error->WarningE("pkgAcqIndex::StageDownloadDone", "Symlinking file %s to %s failed", FileName.c_str(), DestFile.c_str());
+        else
+        {
+           EraseFileName = DestFile;
+           FileName = DestFile;
+        }
+      }
    }
    else
       EraseFileName = FileName;
@@ -2713,25 +2730,19 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const
       return;
    }
 
-   // get the binary name for your used compression type
-   string decompProg;
-   if(CurrentCompressionExtension == "uncompressed")
-      decompProg = "copy";
-   else
-      decompProg = _config->Find(string("Acquire::CompressionTypes::").append(CurrentCompressionExtension),"");
-   if(decompProg.empty() == true)
-   {
-      _error->Error("Unsupported extension: %s", CurrentCompressionExtension.c_str());
-      return;
-   }
-
+   string decompProg = "store";
    if (Target.KeepCompressed == true)
    {
       DestFile = "/dev/null";
       EraseFileName.clear();
    }
    else
-      DestFile += ".decomp";
+   {
+      if (CurrentCompressionExtension == "uncompressed")
+        decompProg = "copy";
+      else
+        DestFile.erase(DestFile.length() - (CurrentCompressionExtension.length() + 1));
+   }
 
    // queue uri for the next stage
    Stage = STAGE_DECOMPRESS_AND_VERIFY;