- if (Cache.AutoInstOk(I, Cache[I].CandidateVerIter(Cache),Start) == true)
- {
- if (Debug == true)
- clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
- Cache.MarkDelete(I);
- if (Counter > 1)
- {
- if (Scores[Pkg->ID] > Scores[I->ID])
- Scores[I->ID] = Scores[Pkg->ID];
- }
- } else {
- /* The dependency of the TargetPkg would be satisfiable with I but it is
- forbidden to install I automatical, so anything we can do is hold
- back the TargetPkg.
- */
- if (Debug == true)
- clog << " Hold back " << Start.TargetPkg().Name() <<
- " rather than change denied AutoInstall " << I.Name() << endl;
- Cache.MarkKeep(Start.TargetPkg());
- }
+ if (Debug == true)
+ clog << " Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
+ Cache.MarkDelete(I);
+ if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
+ Scores[I->ID] = Scores[Pkg->ID];
+ }
+ else if (TryFixByInstall == true &&
+ Start.TargetPkg()->CurrentVer == 0 &&
+ Cache[Start.TargetPkg()].Delete() == false &&
+ (Flags[Start.TargetPkg()->ID] & ToRemove) != ToRemove &&
+ Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
+ {
+ /* Before removing or keeping the package with the broken dependency
+ try instead to install the first not previously installed package
+ solving this dependency. This helps every time a previous solver
+ is removed by the resolver because of a conflict or alike but it is
+ dangerous as it could trigger new breaks/conflicts… */
+ if (Debug == true)
+ clog << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl;
+ unsigned long const OldBroken = Cache.BrokenCount();
+ Cache.MarkInstall(Start.TargetPkg(), true, 1, false);
+ // FIXME: we should undo the complete MarkInstall process here
+ if (Cache[Start.TargetPkg()].InstBroken() == true || Cache.BrokenCount() > OldBroken)
+ Cache.MarkDelete(Start.TargetPkg(), false, 1, false);