diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-09-23 17:18:30 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-09-23 17:18:30 +0200 |
commit | 3f073d44c2d6cecb807f05a5f95c1c35ab23fb3c (patch) | |
tree | 801dfb0d4cfb8e97cd35d15a539b5e37044ae5de /apt-pkg/acquire-item.cc | |
parent | 6f5ccfde13b99be593a5cfce1ebc68a7ee995c88 (diff) |
cleanup
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r-- | apt-pkg/acquire-item.cc | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7185a5efa..0cae5308e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -901,7 +901,10 @@ void pkgAcqIndex::AutoSelectCompression() CompressionExtension.erase(CompressionExtension.end()-1); } // AcqIndex::Init - defered Constructor /*{{{*/ -void pkgAcqIndex::Init(string const &URI, string const &URIDesc, string const &ShortDesc) { +// --------------------------------------------------------------------- +void pkgAcqIndex::Init(string const &URI, string const &URIDesc, + string const &ShortDesc) +{ Decompression = false; Erase = false; @@ -976,16 +979,9 @@ void pkgAcqIndex::InitByHashIfNeeded(const std::string MetaKey) /* The only header we use is the last-modified header. */ string pkgAcqIndex::Custom600Headers() const { - string Final = _config->FindDir("Dir::State::lists"); - Final += URItoFileName(RealURI); - if (_config->FindB("Acquire::GzipIndexes",false)) - Final += ".gz"; + string Final = GetFinalFilename(); string msg = "\nIndex-File: true"; - // FIXME: this really should use "IndexTarget::IsOptional()" but that - // seems to be difficult without breaking ABI - if (ShortDesc().find("Translation") != 0) - msg += "\nFail-Ignore: true"; struct stat Buf; if (stat(Final.c_str(),&Buf) == 0) msg += "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); @@ -1022,11 +1018,11 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ // pkgAcqIndex::GetFinalFilename - Return the full final file path /*{{{*/ // --------------------------------------------------------------------- /* */ -std::string pkgAcqIndex::GetFinalFilename(std::string const &URI, - std::string const &compExt) +std::string pkgAcqIndex::GetFinalFilename() const { + std::string const compExt = CompressionExtension.substr(0, CompressionExtension.find(' ')); std::string FinalFile = _config->FindDir("Dir::State::lists"); - FinalFile += URItoFileName(URI); + FinalFile += URItoFileName(RealURI); if (_config->FindB("Acquire::GzipIndexes",false) && compExt == "gz") FinalFile += ".gz"; return FinalFile; @@ -1042,7 +1038,7 @@ void pkgAcqIndex::ReverifyAfterIMS() DestFile += ".gz"; // copy FinalFile into partial/ so that we check the hash again - string FinalFile = GetFinalFilename(RealURI, compExt); + string FinalFile = GetFinalFilename(); Decompression = true; Desc.URI = "copy:" + FinalFile; QueueURI(Desc); @@ -1105,7 +1101,7 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,HashStringList con // Done, queue for rename on transaction finished PartialFile = DestFile; - DestFile = GetFinalFilename(RealURI, compExt); + DestFile = GetFinalFilename(); return; } @@ -1225,11 +1221,7 @@ pkgAcqIndexTrans::pkgAcqIndexTrans(pkgAcquire *Owner, // --------------------------------------------------------------------- string pkgAcqIndexTrans::Custom600Headers() const { - string Final = _config->FindDir("Dir::State::lists"); - Final += URItoFileName(RealURI); - - if (_config->FindB("Acquire::GzipIndexes",false)) - Final += ".gz"; + string Final = GetFinalFilename(); struct stat Buf; if (stat(Final.c_str(),&Buf) != 0) |