From 3f073d44c2d6cecb807f05a5f95c1c35ab23fb3c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Sep 2014 17:18:30 +0200 Subject: cleanup --- apt-pkg/acquire-item.cc | 30 +++++++++++------------------- apt-pkg/acquire-item.h | 5 ++--- 2 files changed, 13 insertions(+), 22 deletions(-) (limited to 'apt-pkg') 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) diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 3c522f66e..ae53fc6ac 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -880,10 +880,9 @@ class pkgAcqIndex : public pkgAcqBaseIndex /** \brief Auto select the right compression to use */ void AutoSelectCompression(); - /** \brief Get the full pathname of the final file for the given URI + /** \brief Get the full pathname of the final file for the current URI */ - std::string GetFinalFilename(std::string const &URI, - std::string const &compExt); + std::string GetFinalFilename() const; /** \brief Schedule file for verification after a IMS hit */ void ReverifyAfterIMS(); -- cgit v1.2.3