X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/ee0167c4a0bf0c6de5437d3b641e7e7c0c614f17..06293aa79b46efdec96910b2f678ce1cbdecc86d:/apt-private/private-show.cc diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 7f4beb7d0..9a8386167 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -57,30 +57,41 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V, return false; pkgTagSection Tags; pkgTagFile TagF(&PkgF); - + + if (TagF.Jump(Tags, V.FileList()->Offset) == false) + return _error->Error("Internal Error, Unable to parse a package record"); + + // make size nice + std::string installed_size; + if (Tags.FindI("Installed-Size") > 0) + installed_size = SizeToStr(Tags.FindI("Installed-Size")*1024); + else + installed_size = _("unknown"); + std::string package_size; + if (Tags.FindI("Size") > 0) + package_size = SizeToStr(Tags.FindI("Size")); + else + package_size = _("unknown"); + TFRewriteData RW[] = { {"Conffiles",0}, {"Description",0}, {"Description-md5",0}, + {"Installed-Size", installed_size.c_str(), 0}, + {"Size", package_size.c_str(), "Download-Size"}, {} }; - const char *Zero = 0; - if (TagF.Jump(Tags, V.FileList()->Offset) == false || - TFRewrite(stdout,Tags,&Zero,RW) == false) - { - _error->Error("Internal Error, Unable to parse a package record"); - return false; - } + if(TFRewrite(stdout, Tags, NULL, RW) == false) + return _error->Error("Internal Error, Unable to parse a package record"); // write the description pkgRecords Recs(*Cache); + // FIXME: show (optionally) all available translations(?) pkgCache::DescIterator Desc = V.TranslatedDescription(); if (Desc.end() == false) { pkgRecords::Parser &P = Recs.Lookup(Desc.FileList()); - if (strcmp(Desc.LanguageCode(),"") != 0) - out << "Description-lang: " << Desc.LanguageCode() << std::endl; - out << "Description" << P.LongDesc(); + out << "Description: " << P.LongDesc(); } // write a final newline (after the description) @@ -93,17 +104,25 @@ bool ShowPackage(CommandLine &CmdL) /*{{{*/ { pkgCacheFile CacheFile; CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); - APT::VersionList::Version const select = APT::VersionList::CANDIDATE; + APT::VersionList::Version const select = _config->FindB("APT::Cache::AllVersions", false) ? + APT::VersionList::ALL : APT::VersionList::CANDIDATE; APT::VersionList const verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper); for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) if (DisplayRecord(CacheFile, Ver, c1out) == false) return false; + if (select == APT::VersionList::CANDIDATE) + { + APT::VersionList const verset_all = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::ALL, helper); + if (verset_all.size() > verset.size()) + _error->Notice(ngettext("There is %lu additional record. Please use the '-a' switch to see it", "There are %lu additional records. Please use the '-a' switch to see them.", verset_all.size() - verset.size()), verset_all.size() - verset.size()); + } + for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin(); Pkg != helper.virtualPkgs.end(); ++Pkg) { c1out << "Package: " << Pkg.FullName(true) << std::endl; - c1out << "State: " << _("not a real pacakge (virtual)") << std::endl; + c1out << "State: " << _("not a real package (virtual)") << std::endl; // FIXME: show providers, see private-cacheset.h // CacheSetHelperAPTGet::showVirtualPackageErrors() }