- std::string format = _config->Find("APT::Cmd::format", "${db::Status-Abbrev} ${Package} ${Version} ${Origin} ${Description}");
- std::string output = format;
-
- output = SubstVar(output, "${db::Status-Abbrev}", GetFlagsStr(CacheFile, P));
- output = SubstVar(output, "${Package}", name_str);
- output = SubstVar(output, "${installed:Version}", GetInstalledVersion(CacheFile, P));
- output = SubstVar(output, "${candidate:Version}", GetCandidateVersion(CacheFile, P));
- output = SubstVar(output, "${Version}", GetVersion(CacheFile, V));
- output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P));
- output = SubstVar(output, "${Origin}", GetArchiveSuite(CacheFile, V));
- out << output << std::endl;
- } else {
- // raring/linux-kernel version [upradable: new-version]
- // description
- pkgPolicy *policy = CacheFile.GetPolicy();
- out << std::setiosflags(std::ios::left)
- << _config->Find("APT::Color::Highlight", "")
- << name_str
- << _config->Find("APT::Color::Neutral", "")
- << "/" << suite
- << " ";
- if(P.CurrentVer() == V && state.Upgradable()) {
- out << GetVersion(CacheFile, V)
- << " "
- << "[" << _("installed,upgradable to: ")
- << GetCandidateVersion(CacheFile, P) << "]";
- } else if (P.CurrentVer() == V) {
- out << GetVersion(CacheFile, V)
- << " ";
- if(!V.Downloadable())
- out << _("[installed,local]");
- else
- if(V.Automatic() && state.Garbage)
- out << _("[installed,auto-removable]");
- else if (state.Flags & pkgCache::Flag::Auto)
- out << _("[installed,automatic]");
- else
- out << _("[installed]");
- } else if (P.CurrentVer() &&
- policy->GetCandidateVer(P) == V &&
- state.Upgradable()) {
- out << GetVersion(CacheFile, V)
- << " "
- << _("[upgradable from: ")
- << GetInstalledVersion(CacheFile, P) << "]";
- } else {
- if (V.ParentPkg()->CurrentState == pkgCache::State::ConfigFiles)
- out << GetVersion(CacheFile, V)
- << " "
- << _("[residual-config]");
- else
- out << GetVersion(CacheFile, V);
- }
- out << " " << GetArchitecture(CacheFile, P);
- if (include_summary)
- {
- out << std::endl
- << " " << GetShortDescription(CacheFile, records, P)
- << std::endl;
- }