summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2025-01-30 21:45:40 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2025-01-30 21:45:40 +0000
commitd0c2cc03d75fa66986a9aadf8b1361426e9ceb4d (patch)
treebcc037bbb9012e7b3c05f1560ce8155f41a189f5
parent1bc8dab8df60c5da7cc817bec5f53e60f7eb9817 (diff)
Do not create descriptions structs for each architecture
The architectures are supposed to share the descriptions as they are (very usually) the same, but the code was happily creating structs for every architecture of a package which is especially pointless as for e.g. Debian those will be the short description likely superseded in output and all uses by the 'en' "translation".
-rw-r--r--apt-pkg/pkgcachegen.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 055b2e08e..de04d1313 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -513,23 +513,26 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
a version with a description of the same MD5 - if so we reuse this
description group instead of creating our own for this version */
for (pkgCache::PkgIterator P = Grp.PackageList();
- P.end() == false; P = Grp.NextPkg(P))
+ not P.end() && Ver->DescriptionList == 0; P = Grp.NextPkg(P))
{
- for (pkgCache::VerIterator V = P.VersionList();
- V.end() == false; ++V)
+ for (pkgCache::VerIterator V = P.VersionList(); not V.end(); ++V)
{
if (V->DescriptionList == 0 || Cache.ViewString(V.DescriptionList()->md5sum) != CurMd5)
continue;
Ver->DescriptionList = V->DescriptionList;
+ break;
}
}
// We haven't found reusable descriptions, so add the first description(s)
map_stringitem_t md5idx = Ver->DescriptionList == 0 ? 0 : Ver.DescriptionList()->md5sum;
- std::vector<std::string> availDesc = List.AvailableDescriptionLanguages();
- for (std::vector<std::string>::const_iterator CurLang = availDesc.begin(); CurLang != availDesc.end(); ++CurLang)
- if (AddNewDescription(List, Ver, *CurLang, CurMd5, md5idx) == false)
+ for (auto const &CurLang : List.AvailableDescriptionLanguages())
+ {
+ if (Ver->DescriptionList != 0 && IsDuplicateDescription(Cache, Ver.DescriptionList(), CurMd5, CurLang))
+ continue;
+ if (not AddNewDescription(List, Ver, CurLang, CurMd5, md5idx))
return false;
+ }
return true;
}
/*}}}*/