+// PM::CreateOrderList - Create the ordering class /*{{{*/
+// ---------------------------------------------------------------------
+/* This populates the ordering list with all the packages that are
+ going to change. */
+bool pkgPackageManager::CreateOrderList()
+{
+ delete List;
+ List = new pkgOrderList(Cache);
+
+ // Generate the list of affected packages and sort it
+ for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+ {
+ // Mark the package for immediate configuration
+ if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+ {
+ List->Flag(I,pkgOrderList::Immediate);
+
+ // Look for other packages to make immediate configurea
+ if (Cache[I].InstallVer != 0)
+ for (DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
+ D.end() == false; D++)
+ if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
+ List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
+
+ // And again with the current version.
+ if (I->CurrentVer != 0)
+ for (DepIterator D = I.CurrentVer().DependsList();
+ D.end() == false; D++)
+ if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
+ List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
+ }
+
+ // Not interesting
+ if ((Cache[I].Keep() == true ||
+ Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
+ I.State() == pkgCache::PkgIterator::NeedsNothing)
+ continue;
+
+ // Append it to the list
+ List->push_back(I);
+
+ if ((I->Flags & pkgCache::Flag::ImmediateConf) == pkgCache::Flag::ImmediateConf)
+ List->Flag(I,pkgOrderList::Immediate);
+ }
+
+ return true;
+}
+ /*}}}*/