More fixes
[ntk/apt.git] / apt-pkg / orderlist.cc
index 614c158..fbd21d4 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: orderlist.cc,v 1.6 1999/07/12 03:40:37 jgg Exp $
+// $Id: orderlist.cc,v 1.10 2000/01/16 05:36:17 jgg Exp $
 /* ######################################################################
 
    Order List - Represents and Manipulates an ordered list of packages.
@@ -150,7 +150,7 @@ bool pkgOrderList::OrderCritical()
 {
    FileList = 0;
    
-   Primary = &DepUnPackPre;
+   Primary = &pkgOrderList::DepUnPackPre;
    Secondary = 0;
    RevDepends = 0;
    Remove = 0;
@@ -176,10 +176,10 @@ bool pkgOrderList::OrderUnpack(string *FileList)
 {
    this->FileList = FileList;
 
-   Primary = &DepUnPackCrit;
-   Secondary = &DepConfigure;
-   RevDepends = &DepUnPackDep;
-   Remove = &DepRemove;
+   Primary = &pkgOrderList::DepUnPackCrit;
+   Secondary = &pkgOrderList::DepConfigure;
+   RevDepends = &pkgOrderList::DepUnPackDep;
+   Remove = &pkgOrderList::DepRemove;
    LoopCount = -1;
 
    // Sort
@@ -200,7 +200,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
       return false;
 
    LoopCount = 0;
-   Primary = &DepUnPackPre;
+   Primary = &pkgOrderList::DepUnPackPre;
    if (DoRun() == false)
       return false;
 
@@ -209,7 +209,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
    for (iterator I = List; I != End; I++)
    {
       PkgIterator P(Cache,*I);
-      cout << P.Name() << endl;
+      cout << P.Name() << ' ' << IsMissing(P) << endl;
    }*/
 
    return true;
@@ -222,7 +222,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
 bool pkgOrderList::OrderConfigure()
 {
    FileList = 0;
-   Primary = &DepConfigure;
+   Primary = &pkgOrderList::DepConfigure;
    Secondary = 0;
    RevDepends = 0;
    Remove = 0;
@@ -312,14 +312,14 @@ int pkgOrderList::OrderCompareA(const void *a, const void *b)
 
    // We order packages with a set state toward the front
    int Res;
-   if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) == 0)
+   if ((Res = BoolCompare(Me->IsNow(A),Me->IsNow(B))) != 0)
       return -1*Res;
    
    // We order missing files to toward the end
    if (Me->FileList != 0)
    {
       if ((Res = BoolCompare(Me->IsMissing(A),
-                            Me->IsMissing(B))) == 0)
+                            Me->IsMissing(B))) != 0)
         return Res;
    }
    
@@ -422,14 +422,14 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver)
 // ---------------------------------------------------------------------
 /* This routine calls visit on all providing packages. */
 bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
-{
+{   
    Version **List = D.AllTargets();
    for (Version **I = List; *I != 0; I++)
    {
       VerIterator Ver(Cache,*I);
       PkgIterator Pkg = Ver.ParentPkg();
-      
-      if (Cache[Pkg].Keep() == true)
+
+      if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
         continue;
       
       if (D->Type != pkgCache::Dep::Conflicts && Cache[Pkg].InstallVer != *I)
@@ -439,9 +439,9 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
         continue;
       
       // Skip over missing files
-      if (IsMissing(D.ParentPkg()) == true)
+      if (Critical == false && IsMissing(D.ParentPkg()) == true)
         continue;
-        
+
       if (VisitNode(Pkg) == false)
       {
         delete [] List;
@@ -475,8 +475,8 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg)
    DepFunc Old = Primary;
    
    // Perform immedate configuration of the package if so flagged.
-   if (IsFlag(Pkg,Immediate) == true && Primary != &DepUnPackPre)
-      Primary = &DepUnPackPreD;
+   if (IsFlag(Pkg,Immediate) == true && Primary != &pkgOrderList::DepUnPackPre)
+      Primary = &pkgOrderList::DepUnPackPreD;
 
    if (IsNow(Pkg) == true)
    {
@@ -589,7 +589,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
         DepFunc Old = Primary;
         bool Res = false;
         if (D->Type == pkgCache::Dep::PreDepends)
-           Primary = &DepUnPackPreD;
+           Primary = &pkgOrderList::DepUnPackPreD;
         Res = VisitProvides(D,true);
         Primary = Old;
         if (Res == false)