diff options
-rw-r--r-- | apt-pkg/acquire-item.cc | 15 | ||||
-rwxr-xr-x | test/integration/test-bug-624218-Translation-file-handling | 55 |
2 files changed, 47 insertions, 23 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c48443eff..7bcdf285b 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1369,9 +1369,20 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ { HashString ExpectedIndexHash; const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey); + bool compressedAvailable = false; if (Record == NULL) { - if (verify == true && (*Target)->IsOptional() == false) + if ((*Target)->IsOptional() == true) + { + std::vector<std::string> types = APT::Configuration::getCompressionTypes(); + for (std::vector<std::string>::const_iterator t = types.begin(); t != types.end(); ++t) + if (MetaIndexParser->Exists(string((*Target)->MetaKey).append(".").append(*t)) == true) + { + compressedAvailable = true; + break; + } + } + else if (verify == true) { Status = StatAuthError; strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str()); @@ -1400,7 +1411,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ if ((*Target)->IsSubIndex() == true) new pkgAcqSubIndex(Owner, (*Target)->URI, (*Target)->Description, (*Target)->ShortDesc, ExpectedIndexHash); - else if (transInRelease == false || MetaIndexParser->Exists((*Target)->MetaKey) == true) + else if (transInRelease == false || Record != NULL || compressedAvailable == true) { if (_config->FindB("Acquire::PDiffs",true) == true && transInRelease == true && MetaIndexParser->Exists(string((*Target)->MetaKey).append(".diff/Index")) == true) diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index d146b943c..d3c5b08ac 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -14,34 +14,47 @@ changetowebserver rm -rf rootdir/var/lib/apt/lists -msgtest 'No download of non-existent locals' 'with Index' -LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists +translationslisted() { + msgtest 'No download of non-existent locals' "$1" + LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of existent locals' 'with Index' -LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of existent locals' "$1" + LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of en in LC_ALL=C' 'with Index' -LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of en in LC_ALL=C' "$1" + LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of en as forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of en as forced language' "$1" + aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of nothing else in forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of nothing else in forced language' "$1" + aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download no Translation- if forced language is non-existent' 'with Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download no Translation- if forced language is non-existent' "$1" + aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of nothing if none is forced' "$1" + aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists +} + +translationslisted 'with full Index' + + +# only compressed files available (as it happens on CD-ROM) +sed -i '/i18n\/Translation-[^.]*$/ d' $(find aptarchive -name 'Release') +signreleasefiles + +translationslisted 'with partial Index' -msgtest 'Download of nothing if none is forced' 'with Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists +# no records at all about Translation files (fallback to guessing) sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release') signreleasefiles |