diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-11 13:58:23 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:00 +0100 |
commit | af9e40c9bfb353b8aea1e2621b3b5a8c1c1db4bd (patch) | |
tree | 45c52718410a77b27ac7ae6745b52d3ec03e9fda /apt-pkg | |
parent | 3685f84d8c0abfbddd12e034561e5f3fe8cbf2eb (diff) |
unbreak the copy-method claiming hashsum mismatch since ~exp9
Commit 653ef26c70dc9c0e2cbfdd4e79117876bb63e87d broke the camels back in
sofar that everything works in terms of our internal use of copy:/, but
external use is completely destroyed. This is kinda the reverse of what
happened in "parallel" in the sid branch, where external use was mostly
fine, internal and external exploded on the GzipIndexes option.
We fix this now by rewriting our internal use by letting copy:/ only do
what the name suggests it does: Copy files and not uncompress them
on-the-fly. Then we teach copy and the uncompressors how to deal with
/dev/null and use it as destination file in case we don't want to store
the uncompressed files on disk.
Closes: 799158
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 53f7f3295..98739f7a6 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2619,7 +2619,18 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const // Methods like e.g. "file:" will give us a (compressed) FileName that is // not the "DestFile" we set, in this case we uncompress from the local file if (FileName != DestFile && RealFileExists(DestFile) == false) + { Local = true; + if (Target.KeepCompressed == true) + { + // but if we don't keep the uncompress we copy the compressed file first + Stage = STAGE_DOWNLOAD; + Desc.URI = "copy:" + FileName; + QueueURI(Desc); + SetActiveSubprocess("copy"); + return; + } + } else EraseFileName = FileName; @@ -2633,18 +2644,6 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const return; } - // If we want compressed indexes, just copy in place for hash verification - if (Target.KeepCompressed == true) - { - DestFile = GetPartialFileNameFromURI(Target.URI + '.' + CurrentCompressionExtension); - EraseFileName = ""; - Stage = STAGE_DECOMPRESS_AND_VERIFY; - Desc.URI = "copy:" + FileName; - QueueURI(Desc); - SetActiveSubprocess("copy"); - return; - } - // get the binary name for your used compression type string decompProg; if(CurrentCompressionExtension == "uncompressed") @@ -2657,9 +2656,16 @@ void pkgAcqIndex::StageDownloadDone(string const &Message, HashStringList const return; } + if (Target.KeepCompressed == true) + { + DestFile = "/dev/null"; + EraseFileName.clear(); + } + else + DestFile += ".decomp"; + // queue uri for the next stage Stage = STAGE_DECOMPRESS_AND_VERIFY; - DestFile += ".decomp"; Desc.URI = decompProg + ":" + FileName; QueueURI(Desc); SetActiveSubprocess(decompProg); @@ -2670,6 +2676,9 @@ void pkgAcqIndex::StageDecompressDone(string const &, HashStringList const &, pkgAcquire::MethodConfig const * const) { + if (Target.KeepCompressed == true && DestFile == "/dev/null") + DestFile = GetPartialFileNameFromURI(Target.URI + '.' + CurrentCompressionExtension); + // Done, queue for rename on transaction finished TransactionManager->TransactionStageCopy(this, DestFile, GetFinalFilename()); return; |