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;
/* 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);
// 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;
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);
// Done, queue for rename on transaction finished
PartialFile = DestFile;
- DestFile = GetFinalFilename(RealURI, compExt);
+ DestFile = GetFinalFilename();
return;
}
// ---------------------------------------------------------------------
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)