diff options
author | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
commit | 97f16727b50dcaa4810e80d3c16639e0ce6a0958 (patch) | |
tree | 1228c44118015b13b2f94177571c6780eb861a7e /apt-private | |
parent | 6778e2d672d84c962a578f6de415c666b9cf6ee1 (diff) | |
parent | 05fae6fae95d8ef6690f3d56863e3bb6a44d424c (diff) |
Merge branch 'fix/tagfilekeys' into 'main'
Consistently dealing with fields via pkgTagSection::Key
See merge request apt-team/apt!233
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-show.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index b56b87d67..08a4fe6df 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -17,6 +17,7 @@ #include <apt-pkg/policy.h> #include <apt-pkg/sourcelist.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile-keys.h> #include <apt-pkg/tagfile.h> #include <apt-private/private-cacheset.h> @@ -233,13 +234,15 @@ static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgRecords &Recs, /*{{{*/ // make size nice std::string installed_size; - if (Tags.FindULL("Installed-Size") > 0) - strprintf(installed_size, "%sB", SizeToStr(Tags.FindULL("Installed-Size") * 1024).c_str()); + auto const installed_size_field = Tags.FindULL(pkgTagSection::Key::Installed_Size); + if (installed_size_field > 0) + installed_size = SizeToStr(installed_size_field * 1024).append("B"); else installed_size = _("unknown"); std::string package_size; - if (Tags.FindULL("Size") > 0) - strprintf(package_size, "%sB", SizeToStr(Tags.FindULL("Size")).c_str()); + auto const package_size_field = Tags.FindULL(pkgTagSection::Key::Size); + if (package_size_field > 0) + package_size = SizeToStr(package_size_field).append("B"); else package_size = _("unknown"); @@ -257,10 +260,8 @@ static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgRecords &Recs, /*{{{*/ // delete, apt-cache show has this info and most users do not care if (not _config->FindB("APT::Cache::ShowFull", false)) { - RW.push_back(pkgTagSection::Tag::Remove("MD5sum")); - RW.push_back(pkgTagSection::Tag::Remove("SHA1")); - RW.push_back(pkgTagSection::Tag::Remove("SHA256")); - RW.push_back(pkgTagSection::Tag::Remove("SHA512")); + for (char const * const * type = HashString::SupportedHashes(); *type != nullptr; ++type) + RW.push_back(pkgTagSection::Tag::Remove(*type)); RW.push_back(pkgTagSection::Tag::Remove("Filename")); RW.push_back(pkgTagSection::Tag::Remove("Multi-Arch")); RW.push_back(pkgTagSection::Tag::Remove("Conffiles")); |