From 73da43e90be945d3be9b4f3b6e5016fb7bacb59d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 5 Jul 2011 15:58:32 +0200 Subject: * apt-pkg/acquire*.{cc,h}: - try even harder to support really big files in the fetcher by converting (hopefully) everything to 'long long' (Closes: #632271) --- apt-pkg/acquire-item.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d790bd898..a6698b367 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -94,7 +94,7 @@ void pkgAcquire::Item::Failed(string Message,pkgAcquire::MethodConfig *Cnf) // --------------------------------------------------------------------- /* Stash status and the file size. Note that setting Complete means sub-phases of the acquire process such as decompresion are operating */ -void pkgAcquire::Item::Start(string /*Message*/,unsigned long Size) +void pkgAcquire::Item::Start(string /*Message*/,unsigned long long Size) { Status = StatFetching; if (FileSize == 0 && Complete == false) @@ -104,7 +104,7 @@ void pkgAcquire::Item::Start(string /*Message*/,unsigned long Size) // Acquire::Item::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcquire::Item::Done(string Message,unsigned long Size,string Hash, +void pkgAcquire::Item::Done(string Message,unsigned long long Size,string Hash, pkgAcquire::MethodConfig *Cnf) { // We just downloaded something.. @@ -245,7 +245,7 @@ void pkgAcqSubIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{* } } /*}}}*/ -void pkgAcqSubIndex::Done(string Message,unsigned long Size,string Md5Hash, /*{{{*/ +void pkgAcqSubIndex::Done(string Message,unsigned long long Size,string Md5Hash, /*{{{*/ pkgAcquire::MethodConfig *Cnf) { if(Debug) @@ -544,7 +544,7 @@ void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{ Dequeue(); } /*}}}*/ -void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash, /*{{{*/ +void pkgAcqDiffIndex::Done(string Message,unsigned long long Size,string Md5Hash, /*{{{*/ pkgAcquire::MethodConfig *Cnf) { if(Debug) @@ -710,7 +710,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/ return true; } /*}}}*/ -void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash, /*{{{*/ +void pkgAcqIndexDiffs::Done(string Message,unsigned long long Size,string Md5Hash, /*{{{*/ pkgAcquire::MethodConfig *Cnf) { if(Debug) @@ -881,7 +881,7 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ to the uncompressed version of the file. If this is so the file is copied into the partial directory. In all other cases the file is decompressed with a gzip uri. */ -void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, +void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash, pkgAcquire::MethodConfig *Cfg) { Item::Done(Message,Size,Hash,Cfg); @@ -1123,7 +1123,7 @@ string pkgAcqMetaSig::Custom600Headers() return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } -void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5, +void pkgAcqMetaSig::Done(string Message,unsigned long long Size,string MD5, pkgAcquire::MethodConfig *Cfg) { Item::Done(Message,Size,MD5,Cfg); @@ -1232,7 +1232,7 @@ string pkgAcqMetaIndex::Custom600Headers() return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } /*}}}*/ -void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, /*{{{*/ +void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash, /*{{{*/ pkgAcquire::MethodConfig *Cfg) { Item::Done(Message,Size,Hash,Cfg); @@ -1768,7 +1768,7 @@ bool pkgAcqArchive::QueueNext() if (stat(FinalFile.c_str(),&Buf) == 0) { // Make sure the size matches - if ((unsigned)Buf.st_size == Version->Size) + if ((unsigned long long)Buf.st_size == Version->Size) { Complete = true; Local = true; @@ -1787,7 +1787,7 @@ bool pkgAcqArchive::QueueNext() if (stat(FinalFile.c_str(),&Buf) == 0) { // Make sure the size matches - if ((unsigned)Buf.st_size == Version->Size) + if ((unsigned long long)Buf.st_size == Version->Size) { Complete = true; Local = true; @@ -1807,7 +1807,7 @@ bool pkgAcqArchive::QueueNext() if (stat(DestFile.c_str(),&Buf) == 0) { // Hmm, the partial file is too big, erase it - if ((unsigned)Buf.st_size > Version->Size) + if ((unsigned long long)Buf.st_size > Version->Size) unlink(DestFile.c_str()); else PartialSize = Buf.st_size; @@ -1830,7 +1830,7 @@ bool pkgAcqArchive::QueueNext() // AcqArchive::Done - Finished fetching /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqArchive::Done(string Message,unsigned long Size,string CalcHash, +void pkgAcqArchive::Done(string Message,unsigned long long Size,string CalcHash, pkgAcquire::MethodConfig *Cfg) { Item::Done(Message,Size,CalcHash,Cfg); @@ -1941,7 +1941,7 @@ void pkgAcqArchive::Finished() // --------------------------------------------------------------------- /* The file is added to the queue */ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, - unsigned long Size,string Dsc,string ShortDesc, + unsigned long long Size,string Dsc,string ShortDesc, const string &DestDir, const string &DestFilename, bool IsIndexFile) : Item(Owner), ExpectedHash(Hash), IsIndexFile(IsIndexFile) @@ -1969,7 +1969,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, if (stat(DestFile.c_str(),&Buf) == 0) { // Hmm, the partial file is too big, erase it - if ((unsigned)Buf.st_size > Size) + if ((unsigned long long)Buf.st_size > Size) unlink(DestFile.c_str()); else PartialSize = Buf.st_size; @@ -1981,7 +1981,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, // AcqFile::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgAcqFile::Done(string Message,unsigned long Size,string CalcHash, +void pkgAcqFile::Done(string Message,unsigned long long Size,string CalcHash, pkgAcquire::MethodConfig *Cnf) { Item::Done(Message,Size,CalcHash,Cnf); -- cgit v1.2.3 From 14b4780d0da30493b949bf65587f4e8a71db561d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 28 Jul 2011 10:26:39 +0200 Subject: * [ABI break] apt-pkg/acquire-item.{cc,h}: - cleanup around OptionalIndexTarget and SubIndexTarget --- apt-pkg/acquire-item.cc | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index aa77824f8..df83d1481 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2071,13 +2071,3 @@ string pkgAcqFile::Custom600Headers() return ""; } /*}}}*/ -bool IndexTarget::IsOptional() const { - if (strncmp(ShortDesc.c_str(), "Translation", 11) != 0) - return false; - return true; -} -bool IndexTarget::IsSubIndex() const { - if (ShortDesc != "TranslationIndex") - return false; - return true; -} -- cgit v1.2.3 From c5f661b715fbd86fcbca694c44bb8422f01db267 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Aug 2011 10:48:18 +0200 Subject: * apt-pkg/acquire-item.{cc,h}: - do not check for a "Package" tag in optional index targets like the translations index --- apt-pkg/acquire-item.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index df83d1481..d0fbf948f 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -808,6 +808,9 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target, if (CompressionExtension.empty() == false) CompressionExtension.erase(CompressionExtension.end()-1); + if (Target->IsOptional()) + Verify = false; + Init(Target->URI, Target->Description, Target->ShortDesc); } /*}}}*/ @@ -905,6 +908,7 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash, /* Verify the index file for correctness (all indexes must * have a Package field) (LP: #346386) (Closes: #627642) */ + if (Verify == true) { FileFd fd(DestFile, FileFd::ReadOnly); pkgTagSection sec; -- cgit v1.2.3 From 97efc27f0723f09405d7a1836ab21c2e2948eb10 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 5 Aug 2011 11:00:46 +0200 Subject: apt-pkg/acquire-item.cc: always init Verify --- apt-pkg/acquire-item.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d0fbf948f..d8fa1f828 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -808,8 +808,12 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target, if (CompressionExtension.empty() == false) CompressionExtension.erase(CompressionExtension.end()-1); + // only verify non-optional targets, see acquire-item.h for a FIXME + // to make this more flexible if (Target->IsOptional()) Verify = false; + else + Verify = true; Init(Target->URI, Target->Description, Target->ShortDesc); } -- cgit v1.2.3