+ if (Bad == false)
+ continue;
+
+ needConfigure.push_back(Start);
+ }
+ if (i++ > max_loops)
+ return _error->Error("Internal error: MaxLoopCount reached in SmartUnPack (1) for %s, aborting", Pkg.FullName().c_str());
+ } while (Changed == true);
+
+ Bad = false, Changed = false, i = 0;
+ do
+ {
+ Changed = false;
+ for (std::list<DepIterator>::const_iterator D = needConfigure.begin(); D != needConfigure.end(); ++D)
+ {
+ // Compute a single dependency element (glob or) without modifying D
+ pkgCache::DepIterator Start, End;
+ {
+ pkgCache::DepIterator Discard = *D;
+ Discard.GlobOr(Start,End);
+ }
+
+ if (End->Type != pkgCache::Dep::Depends)
+ continue;
+ Bad = true;
+
+ // Search for dependencies which are unpacked but aren't configured yet (maybe loops)
+ for (DepIterator Cur = Start; true; ++Cur)
+ {
+ SPtrArray<Version *> VList = Cur.AllTargets();
+
+ for (Version **I = VList; *I != 0; ++I)
+ {
+ VerIterator Ver(Cache,*I);
+ PkgIterator DepPkg = Ver.ParentPkg();
+
+ // Check if the version that is going to be installed will satisfy the dependency
+ if (Cache[DepPkg].InstallVer != *I)
+ continue;
+
+ if (List->IsFlag(DepPkg,pkgOrderList::UnPacked))
+ {
+ if (List->IsFlag(DepPkg,pkgOrderList::Loop) && PkgLoop)
+ {
+ // This dependency has already been dealt with by another SmartConfigure on Pkg
+ Bad = false;
+ break;
+ }
+ /* Check for a loop to prevent one forming
+ If A depends on B and B depends on A, SmartConfigure will
+ just hop between them if this is not checked. Dont remove the
+ loop flag after finishing however as loop is already set.
+ This means that there is another SmartConfigure call for this
+ package and it will remove the loop flag */
+ if (PkgLoop == false)
+ List->Flag(Pkg,pkgOrderList::Loop);
+ if (SmartConfigure(DepPkg, Depth + 1) == true)
+ {
+ Bad = false;
+ if (List->IsFlag(DepPkg,pkgOrderList::Loop) == false)
+ Changed = true;
+ }
+ if (PkgLoop == false)
+ List->RmFlag(Pkg,pkgOrderList::Loop);
+ // If SmartConfigure was succesfull, Bad is false, so break
+ if (Bad == false)
+ break;
+ }
+ else if (List->IsFlag(DepPkg,pkgOrderList::Configured))
+ {
+ Bad = false;
+ break;
+ }
+ }
+ if (Cur == End || Bad == false)
+ break;
+ }
+
+
+ if (Bad == true && Changed == false && Debug == true)
+ std::clog << OutputInDepth(Depth) << "Could not satisfy " << *D << std::endl;
+ }
+ if (i++ > max_loops)
+ return _error->Error("Internal error: MaxLoopCount reached in SmartUnPack (2) for %s, aborting", Pkg.FullName().c_str());
+ } while (Changed == true);
+
+ if (Bad) {
+ if (Debug)
+ _error->Warning(_("Could not configure '%s'. "),Pkg.FullName().c_str());