Sfoglia il codice sorgente

Changes for the now printing of showbroken
Author: jgg
Date: 2001-07-01 22:59:04 GMT
Changes for the now printing of showbroken

Arch Librarian 22 anni fa
parent
commit
079a992d95
1 ha cambiato i file con 38 aggiunte e 13 eliminazioni
  1. 38 13
      cmdline/apt-get.cc

+ 38 - 13
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.108 2001/07/01 20:49:08 jgg Exp $
+// $Id: apt-get.cc,v 1.109 2001/07/01 22:59:04 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-get - Cover for dpkg
    apt-get - Cover for dpkg
@@ -91,9 +91,9 @@ class CacheFile : public pkgCacheFile
    bool OpenForInstall()
    bool OpenForInstall()
    {
    {
       if (_config->FindB("APT::Get::Print-URIs") == true)
       if (_config->FindB("APT::Get::Print-URIs") == true)
-	 Open(false);
+	 return Open(false);
       else
       else
-	 Open(true);
+	 return Open(true);
    }
    }
    CacheFile() : List(0) {};
    CacheFile() : List(0) {};
 };
 };
@@ -187,30 +187,55 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
    {
    {
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       
       
-      if (Cache[I].InstBroken() == false)
-	  continue;
-	  
+      if (Now == true)
+      {
+	 if (Cache[I].NowBroken() == false)
+	    continue;
+      }
+      else
+      {
+	 if (Cache[I].InstBroken() == false)
+	    continue;
+      }
+      
       // Print out each package and the failed dependencies
       // Print out each package and the failed dependencies
       out <<"  " <<  I.Name() << ":";
       out <<"  " <<  I.Name() << ":";
       unsigned Indent = strlen(I.Name()) + 3;
       unsigned Indent = strlen(I.Name()) + 3;
       bool First = true;
       bool First = true;
-      if (Cache[I].InstVerIter(Cache).end() == true)
+      pkgCache::VerIterator Ver;
+      
+      if (Now == true)
+	 Ver = I.CurrentVer();
+      else
+	 Ver = Cache[I].InstVerIter(Cache);
+      
+      if (Ver.end() == true)
       {
       {
-	 cout << endl;
+	 out << endl;
 	 continue;
 	 continue;
       }
       }
       
       
-      for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false;)
+      for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;)
       {
       {
 	 // Compute a single dependency element (glob or)
 	 // Compute a single dependency element (glob or)
 	 pkgCache::DepIterator Start;
 	 pkgCache::DepIterator Start;
 	 pkgCache::DepIterator End;
 	 pkgCache::DepIterator End;
 	 D.GlobOr(Start,End);
 	 D.GlobOr(Start,End);
 
 
-	 if (Cache->IsImportantDep(End) == false || 
-	     (Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
+	 if (Cache->IsImportantDep(End) == false)
 	    continue;
 	    continue;
-
+	 
+	 if (Now == true)
+	 {
+	    if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow)
+	       continue;
+	 }
+	 else
+	 {
+	    if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
+	       continue;
+	 }
+	 
 	 bool FirstOr = true;
 	 bool FirstOr = true;
 	 while (1)
 	 while (1)
 	 {
 	 {
@@ -243,7 +268,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
 	       pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
 	       pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
 	       if (Now == true)
 	       if (Now == true)
 		  Ver = Targ.CurrentVer();
 		  Ver = Targ.CurrentVer();
-		  
+	       	    
 	       if (Ver.end() == false)
 	       if (Ver.end() == false)
 	       {
 	       {
 		  if (Now == true)
 		  if (Now == true)