diff options
author | Stephen Kitt <skitt@debian.org> | 2019-05-12 23:19:36 +0200 |
---|---|---|
committer | Stephen Kitt <skitt@debian.org> | 2019-05-13 14:16:25 +0200 |
commit | c74d1ee6dc7e7139f243cd57e258f51b3677d59c (patch) | |
tree | 5e9bcbf795d0ed2ce4483e84dba1a9e0603680fb | |
parent | 9ada8cb08b9d54291993118120712992302b6641 (diff) |
apt-cache: only show solutions if displayed
Currently, apt-cache [r]depends always shows all solutions for a
package, if appropriate, even if the package itself wasn’t displayed
(e.g. “--installed” was specified).
Thus, currently, with haskell-platform uninstalled and amd64 and i386
enabled, “apt-cache rdepends alex” shows
alex
Reverse Depends:
haskell-platform
alex:i386
haskell-platform
alex:i386
and “apt-cache rdepends alex --installed” shows
alex
Reverse Depends:
alex:i386
alex:i386
which is rather confusing.
This patch changes the behaviour so that solutions are only displayed
for packages which were themselves displayed;
“apt-cache rdepends alex --installed” then shows
alex
Reverse Depends:
Signed-off-by: Stephen Kitt <skitt@debian.org>
-rw-r--r-- | apt-private/private-depends.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/apt-private/private-depends.cc b/apt-private/private-depends.cc index 79d66b72a..95c747ee3 100644 --- a/apt-private/private-depends.cc +++ b/apt-private/private-depends.cc @@ -105,24 +105,24 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends) verset.insert(APT::VersionSet::FromPackage(CacheFile, Trg, APT::CacheSetHelper::CANDIDATE, helper)); } - } - - // Display all solutions - std::unique_ptr<pkgCache::Version *[]> List(D.AllTargets()); - pkgPrioSortList(*Cache,List.get()); - for (pkgCache::Version **I = List.get(); *I != 0; I++) - { - pkgCache::VerIterator V(*Cache,*I); - if (V != Cache->VerP + V.ParentPkg()->VersionList || - V->ParentPkg == D->Package) - continue; - std::cout << " " << V.ParentPkg().FullName(true) << std::endl; - - if (Recurse == true && Shown[V.ParentPkg()->ID] == false) + // Display all solutions + std::unique_ptr<pkgCache::Version *[]> List(D.AllTargets()); + pkgPrioSortList(*Cache,List.get()); + for (pkgCache::Version **I = List.get(); *I != 0; I++) { - Shown[V.ParentPkg()->ID] = true; - verset.insert(APT::VersionSet::FromPackage(CacheFile, V.ParentPkg(), APT::CacheSetHelper::CANDIDATE, helper)); + pkgCache::VerIterator V(*Cache,*I); + if (V != Cache->VerP + V.ParentPkg()->VersionList || + V->ParentPkg == D->Package) + continue; + std::cout << " " << V.ParentPkg().FullName(true) << std::endl; + + if (Recurse == true && Shown[V.ParentPkg()->ID] == false) + { + Shown[V.ParentPkg()->ID] = true; + verset.insert(APT::VersionSet::FromPackage(CacheFile, V.ParentPkg(), APT::CacheSetHelper::CANDIDATE, helper)); + } } + } if (ShowOnlyFirstOr == true) |