- /* If this or element did not match then continue on to the
- next or element until a matching element is found */
- if (Bad == true)
- {
- // This triggers if someone make a pre-depends/depend loop.
- if (Start == End)
- return _error->Error("Couldn't configure pre-depend %s for %s, "
- "probably a dependency cycle.",
- End.TargetPkg().Name(),Pkg.Name());
- ++Start;
- }
- else
- break;
- }
-
- if (End->Type == pkgCache::Dep::Conflicts ||
- End->Type == pkgCache::Dep::Obsoletes)
- {
- /* Look for conflicts. Two packages that are both in the install
- state cannot conflict so we don't check.. */
- SPtrArray<Version *> VList = End.AllTargets();
- for (Version **I = VList; *I != 0; I++)
- {
- VerIterator Ver(Cache,*I);
- PkgIterator ConflictPkg = Ver.ParentPkg();
- VerIterator InstallVer(Cache,Cache[ConflictPkg].InstallVer);
-
- // See if the current version is conflicting
- if (ConflictPkg.CurrentVer() == Ver && List->IsNow(ConflictPkg))
- {
- cout << OutputInDepth(Depth) << Pkg.Name() << " conflicts with " << ConflictPkg.Name() << endl;
- /* If a loop is not present or has not yet been detected, attempt to unpack packages
- to resolve this conflict. If there is a loop present, remove packages to resolve this conflict */
- if (!List->IsFlag(ConflictPkg,pkgOrderList::Loop)) {
- if (Cache[ConflictPkg].Keep() == 0 && Cache[ConflictPkg].InstallVer != 0) {
- if (Debug)
- cout << OutputInDepth(Depth) << OutputInDepth(Depth) << "Unpacking " << ConflictPkg.Name() << " to prevent conflict" << endl;
- List->Flag(Pkg,pkgOrderList::Loop);
- SmartUnPack(ConflictPkg,false, Depth + 1);
- // Remove loop to allow it to be used later if needed
- List->RmFlag(Pkg,pkgOrderList::Loop);
- } else {
- if (EarlyRemove(ConflictPkg) == false)
- return _error->Error("Internal Error, Could not early remove %s",ConflictPkg.Name());
- }
- } else {
- if (!List->IsFlag(ConflictPkg,pkgOrderList::Removed)) {
- if (Debug)
- cout << OutputInDepth(Depth) << "Because of conficts knot, removing " << ConflictPkg.Name() << " to conflict violation" << endl;
- if (EarlyRemove(ConflictPkg) == false)
- return _error->Error("Internal Error, Could not early remove %s",ConflictPkg.Name());
- }
+ // Not the install version
+ if (Cache[Pkg].InstallVer != *I ||
+ (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing))
+ continue;
+
+ if (List->IsFlag(Pkg,pkgOrderList::Configured))
+ {
+ Bad = false;
+ break;
+ }
+
+ // check if it needs unpack or if if configure is enough
+ if (List->IsFlag(Pkg,pkgOrderList::UnPacked) == false)
+ {
+ if (Debug)
+ clog << OutputInDepth(Depth) << "Trying to SmartUnpack " << Pkg.FullName() << endl;
+ // SmartUnpack with the ImmediateFlag to ensure its really ready
+ if (SmartUnPack(Pkg, true, Depth + 1) == true)
+ {
+ Bad = false;
+ if (List->IsFlag(Pkg,pkgOrderList::Loop) == false)
+ Changed = true;
+ break;
+ }
+ }
+ else
+ {
+ if (Debug)
+ clog << OutputInDepth(Depth) << "Trying to SmartConfigure " << Pkg.FullName() << endl;
+ if (SmartConfigure(Pkg, Depth + 1) == true)
+ {
+ Bad = false;
+ if (List->IsFlag(Pkg,pkgOrderList::Loop) == false)
+ Changed = true;
+ break;
+ }
+ }