- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End);
-
- /*
- * If this is a virtual package, we need to check the list of
- * packages that provide it and see if any of those are
- * installed
- */
- pkgCache::PrvIterator Prv = Start.TargetPkg().ProvidesList();
- bool providedBySomething = false;
- for (; Prv.end() != true; Prv++)
- if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false) {
- providedBySomething = true;
- break;
- }
-
- if (providedBySomething) continue;
-
- do
- {
- if (Start->Type == pkgCache::Dep::Suggests) {
-
- /* A suggests relations, let's see if we have it
- installed already */
-
- string target = string(Start.TargetPkg().Name()) + " ";
- if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install || Cache[Start.TargetPkg()].Install())
- break;
- /* Does another package suggest it as well? If so,
- don't print it twice */
- if (int(SuggestsList.find(target)) > -1)
- break;
- SuggestsList += target;
- SuggestsVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
- }
-
- if (Start->Type == pkgCache::Dep::Recommends) {
-
- /* A recommends relation, let's see if we have it
- installed already */
-
- string target = string(Start.TargetPkg().Name()) + " ";
- if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install || Cache[Start.TargetPkg()].Install())
- break;
-
- /* Does another package recommend it as well? If so,
- don't print it twice */
-
- if (int(RecommendsList.find(target)) > -1)
- break;
- RecommendsList += target;
- SuggestsVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
- }
- if (Start == End)
- break;
- Start++;
- } while (1);
+ foundInstalledInOrGroup=true;
+ break;
+ }
+
+ /* Skip if we already saw it */
+ if (int(SuggestsList.find(target)) != -1 || int(RecommendsList.find(target)) != -1)
+ {
+ foundInstalledInOrGroup=true;
+ break;
+ }
+
+ // this is a dep on a virtual pkg, check if any package that provides it
+ // should be installed
+ if(Start.TargetPkg().ProvidesList() != 0)
+ {
+ pkgCache::PrvIterator I = Start.TargetPkg().ProvidesList();
+ for (; I.end() == false; I++)
+ {
+ pkgCache::PkgIterator Pkg = I.OwnerPkg();
+ if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer() &&
+ Pkg.CurrentVer() != 0)
+ foundInstalledInOrGroup=true;
+ }
+ }
+
+ if (Start->Type == pkgCache::Dep::Suggests)
+ {
+ SuggestsOrList += target;
+ SuggestsOrVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";