summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc46
1 files changed, 23 insertions, 23 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index d798c7107..9433e5c4a 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -683,17 +683,17 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
// remove all patches until the next matching patch is found
// this requires the Index file to be ordered
for(vector<DiffInfo>::iterator I=available_patches.begin();
- available_patches.size() > 0 &&
+ available_patches.empty() == false &&
I != available_patches.end() &&
- (*I).sha1 != local_sha1;
- I++)
+ I->sha1 != local_sha1;
+ ++I)
{
available_patches.erase(I);
}
// error checking and falling back if no patch was found
- if(available_patches.size() == 0)
- {
+ if(available_patches.empty() == true)
+ {
Failed("", NULL);
return false;
}
@@ -758,7 +758,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long long Size,string Md5Has
chmod(FinalFile.c_str(),0644);
// see if there is more to download
- if(available_patches.size() > 0) {
+ if(available_patches.empty() == false) {
new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
ExpectedHash, ServerSha1, available_patches);
return Finish();
@@ -810,6 +810,13 @@ 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);
}
/*}}}*/
@@ -907,6 +914,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;
@@ -1260,8 +1268,9 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash, /
if (SigFile == "")
{
// There was no signature file, so we are finished. Download
- // the indexes without verification.
- QueueIndexes(false);
+ // the indexes and do only hashsum verification
+ MetaIndexParser->Load(DestFile);
+ QueueIndexes(true);
}
else
{
@@ -1376,7 +1385,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
#endif
for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
Target != IndexTargets->end();
- Target++)
+ ++Target)
{
HashString ExpectedIndexHash;
if (verify)
@@ -1398,6 +1407,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
{
std::cerr << "Queueing: " << (*Target)->URI << std::endl;
std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
+ std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
}
if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
{
@@ -1673,7 +1683,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
// check if we have one trusted source for the package. if so, switch
// to "TrustedOnly" mode
- for (pkgCache::VerFileIterator i = Version.FileList(); i.end() == false; i++)
+ for (pkgCache::VerFileIterator i = Version.FileList(); i.end() == false; ++i)
{
pkgIndexFile *Index;
if (Sources->FindIndex(i.File(),Index) == false)
@@ -1710,7 +1720,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
bool pkgAcqArchive::QueueNext()
{
string const ForceHash = _config->Find("Acquire::ForceHash");
- for (; Vf.end() == false; Vf++)
+ for (; Vf.end() == false; ++Vf)
{
// Ignore not source sources
if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0)
@@ -1825,7 +1835,7 @@ bool pkgAcqArchive::QueueNext()
Desc.ShortDesc = Version.ParentPkg().Name();
QueueURI(Desc);
- Vf++;
+ ++Vf;
return true;
}
return false;
@@ -1899,7 +1909,7 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
{
// Vf = Version.FileList();
- while (Vf.end() == false) Vf++;
+ while (Vf.end() == false) ++Vf;
StoreFilename = string();
Item::Failed(Message,Cnf);
return;
@@ -2073,13 +2083,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;
-}