diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-07-30 11:02:24 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-07-30 11:02:24 +0200 |
commit | 65f810811a5f66a934f933900c185bfd012a6b3e (patch) | |
tree | d99ffb743e560f4d72be15804ef7c6b00054d360 | |
parent | 5c6a9439ea115ab7b5adb934f4955be893961830 (diff) |
- return success in show if a virtual package was given
*
-rw-r--r-- | cmdline/apt-cache.cc | 64 | ||||
-rw-r--r-- | debian/changelog | 4 |
2 files changed, 41 insertions, 27 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 2a4e200a7..6813d2978 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -46,6 +46,29 @@ using namespace std; +// CacheSetHelper saving virtual packages /*{{{*/ +class CacheSetHelperVirtuals: public APT::CacheSetHelper { +public: + APT::PackageSet virtualPkgs; + + virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { + virtualPkgs.insert(Pkg); + return CacheSetHelper::canNotFindCandidateVer(Cache, Pkg); + } + + virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { + virtualPkgs.insert(Pkg); + return CacheSetHelper::canNotFindNewestVer(Cache, Pkg); + } + + virtual APT::VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { + virtualPkgs.insert(Pkg); + return CacheSetHelper::canNotFindAllVer(Cache, Pkg); + } + + CacheSetHelperVirtuals(bool const &ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {} +}; + /*}}}*/ // LocalitySort - Sort a version list by package file locality /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -173,7 +196,7 @@ bool UnMet(CommandLine &CmdL) } else { - APT::CacheSetHelper helper(true, GlobalError::NOTICE); + CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); for (APT::VersionSet::iterator V = verset.begin(); V != verset.end(); ++V) @@ -555,22 +578,6 @@ bool DumpAvail(CommandLine &Cmd) } /*}}}*/ // ShowDepends - Helper for printing out a dependency tree /*{{{*/ -class CacheSetHelperDepends: public APT::CacheSetHelper { -public: - APT::PackageSet virtualPkgs; - - virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { - virtualPkgs.insert(Pkg); - return pkgCache::VerIterator(Cache, 0); - } - - virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { - virtualPkgs.insert(Pkg); - return pkgCache::VerIterator(Cache, 0); - } - - CacheSetHelperDepends() : CacheSetHelper(false, GlobalError::NOTICE) {} -}; bool ShowDepends(CommandLine &CmdL, bool const RevDepends) { pkgCacheFile CacheFile; @@ -578,7 +585,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends) if (unlikely(Cache == NULL)) return false; - CacheSetHelperDepends helper; + CacheSetHelperVirtuals helper(false); APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); if (verset.empty() == true && helper.virtualPkgs.empty() == true) return false; @@ -1408,7 +1415,7 @@ bool ShowAuto(CommandLine &CmdL) bool ShowPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; - APT::CacheSetHelper helper(true, GlobalError::NOTICE); + CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ? APT::VersionSet::ALL : APT::VersionSet::CANDIDATE; APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper); @@ -1416,9 +1423,14 @@ bool ShowPackage(CommandLine &CmdL) if (DisplayRecord(CacheFile, Ver) == false) return false; - if (verset.empty() == false) - return true; - return _error->Error(_("No packages found")); + if (verset.empty() == true) + { + if (helper.virtualPkgs.empty() == true) + return _error->Error(_("No packages found")); + else + _error->Notice(_("No packages found")); + } + return true; } /*}}}*/ // ShowPkgNames - Show package names /*{{{*/ @@ -1491,10 +1503,10 @@ bool ShowSrcPackage(CommandLine &CmdL) _error->Warning(_("Unable to locate package %s"),*I); continue; } - } - if (found > 0) - return true; - return _error->Error(_("No packages found")); + } + if (found == 0) + _error->Notice(_("No packages found")); + return true; } /*}}}*/ // Policy - Show the results of the preferences file /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 14cc1c352..12c70884b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,12 +10,14 @@ apt (0.7.26~exp12) UNRELEASEDexperimental; urgency=low * cmdline/apt-cache.cc: - use Notice instead of Error in the CacheSetHelper messages for compat reasons. Otherwise tools like sbuild blow up + - return success in show if a virtual package was given * debian/control: - remove libcurl3-gnutls-dev alternative as the package is gone - increase needed version of libcurl4-gnutls-dev to >= 7.19.0 as we use CURLOPT_{ISSUERCERT,CRLFILE} (Closes: #589642) + * - -- David Kalnischkies <kalnischkies@gmail.com> Fri, 30 Jul 2010 10:08:42 +0200 + -- David Kalnischkies <kalnischkies@gmail.com> Fri, 30 Jul 2010 11:01:18 +0200 apt (0.7.26~exp11) experimental; urgency=low |