From 4bcb198a67156b2654f3b64173499ab78f0d4d9a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 15 Feb 2025 16:37:19 +0100 Subject: cache: Introduce partial SourceVersion support This is the first step that introduces a 1:1 mapping between version and source version. In a future version this can use the fields currently marked unavailable to deduplicate the SourceVersion objects across the group. The policy gains a member for storing pins for sourceversions. Together, in the future we should be able to determine candidates for source versions. --- cmdline/apt-cache.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'cmdline/apt-cache.cc') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 67dde67a6..d8e9e7e4b 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -239,6 +239,8 @@ static bool Stats(CommandLine &CmdL) cout << _(" Mixed virtual packages: ") << NVirt << endl; cout << _(" Missing: ") << Missing << endl; + cout << _("Total distinct source versions: ") << Cache->Head().SourceVersionCount << " (" << SizeToStr(Cache->Head().SourceVersionCount * Cache->Head().SourceVersionSz) << ')' << endl; + cout << _("Total distinct versions: ") << Cache->Head().VersionCount << " (" << SizeToStr(Cache->Head().VersionCount*Cache->Head().VersionSz) << ')' << endl; cout << _("Total distinct descriptions: ") << Cache->Head().DescriptionCount << " (" << @@ -266,8 +268,8 @@ static bool Stats(CommandLine &CmdL) stritems.insert(V->VerStr); if (V->Section != 0) stritems.insert(V->Section); - stritems.insert(V->SourcePkgName); - stritems.insert(V->SourceVerStr); + // FIXME: Count the source versions + stritems.insert(V.SourceVersion()->VerStr); for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; ++D) { if (D->Version != 0) @@ -317,18 +319,19 @@ static bool Stats(CommandLine &CmdL) unsigned long Total = 0; #define APT_CACHESIZE(X,Y) (Cache->Head().X * Cache->Head().Y) Total = Slack + Size + - APT_CACHESIZE(GroupCount, GroupSz) + - APT_CACHESIZE(PackageCount, PackageSz) + - APT_CACHESIZE(VersionCount, VersionSz) + - APT_CACHESIZE(DescriptionCount, DescriptionSz) + - APT_CACHESIZE(DependsCount, DependencySz) + - APT_CACHESIZE(DependsDataCount, DependencyDataSz) + - APT_CACHESIZE(ReleaseFileCount, ReleaseFileSz) + - APT_CACHESIZE(PackageFileCount, PackageFileSz) + - APT_CACHESIZE(VerFileCount, VerFileSz) + - APT_CACHESIZE(DescFileCount, DescFileSz) + - APT_CACHESIZE(ProvidesCount, ProvidesSz) + - (2 * Cache->Head().GetHashTableSize() * sizeof(map_id_t)); + APT_CACHESIZE(GroupCount, GroupSz) + + APT_CACHESIZE(PackageCount, PackageSz) + + APT_CACHESIZE(VersionCount, VersionSz) + + APT_CACHESIZE(SourceVersionCount, SourceVersionSz) + + APT_CACHESIZE(DescriptionCount, DescriptionSz) + + APT_CACHESIZE(DependsCount, DependencySz) + + APT_CACHESIZE(DependsDataCount, DependencyDataSz) + + APT_CACHESIZE(ReleaseFileCount, ReleaseFileSz) + + APT_CACHESIZE(PackageFileCount, PackageFileSz) + + APT_CACHESIZE(VerFileCount, VerFileSz) + + APT_CACHESIZE(DescFileCount, DescFileSz) + + APT_CACHESIZE(ProvidesCount, ProvidesSz) + + (2 * Cache->Head().GetHashTableSize() * sizeof(map_id_t)); cout << _("Total space accounted for: ") << SizeToStr(Total) << endl; #undef APT_CACHESIZE -- cgit v1.2.3-70-g09d2