summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-15 16:37:19 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-15 16:37:19 +0100
commit4bcb198a67156b2654f3b64173499ab78f0d4d9a (patch)
tree769672dc89bc948e6018a82d50a6d990d6d73756 /cmdline
parentf299c09e2eae51391a07ae8708ca789df721321a (diff)
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.
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc31
1 files changed, 17 insertions, 14 deletions
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