From 1bc221a9dd22baa6e2e516d45dc858774cafddd0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 30 Jan 2025 16:39:40 +0000 Subject: Drop unused description size info from binary cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing in src:apt uses this information and that isn't all to surprising as it is usually not that interesting to know how big a specific stanza of a description is as the max size is available and you are usually working with more than one description. So this information just takes up space in our binary cache… 64 bits per structure which can quickly add up to whole MBs depending on how many (and which) sources you have enabled. --- apt-pkg/pkgcache.h | 5 +++-- apt-pkg/pkgcachegen.cc | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index f6d0ea097..d5d8fcad3 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -618,8 +618,9 @@ struct pkgCache::DescFile map_pointer NextFile; /** \brief position in the file */ map_filesize_t Offset; // File offset - /** @TODO document pkgCache::DescFile::Size */ - map_filesize_t Size; +#if APT_PKG_ABI <= 600 + [[deprecated("No usage in src:apt, try MaxDescFileSize instead")]] map_filesize_t Size; +#endif }; /*}}}*/ // Version structure /*{{{*/ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index aaa969a8d..76dea6266 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -949,9 +949,14 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc, *Last = DF.MapPointer(); DF->Offset = List.Offset(); - DF->Size = List.Size(); - if (Cache.HeaderP->MaxDescFileSize < DF->Size) - Cache.HeaderP->MaxDescFileSize = DF->Size; + auto const Size = List.Size(); + if (Cache.HeaderP->MaxDescFileSize < Size) + Cache.HeaderP->MaxDescFileSize = Size; +#if APT_PKG_ABI <= 600 + APT_IGNORE_DEPRECATED_PUSH + DF->Size = Size; + APT_IGNORE_DEPRECATED_POP +#endif Cache.HeaderP->DescFileCount++; return true; -- cgit v1.2.3-70-g09d2