]> git.saurik.com Git - apt.git/commitdiff
unmet
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:30 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:30 +0000 (16:51 +0000)
Author: jgg
Date: 1998-11-14 07:20:29 GMT
unmet

cmdline/apt-cache.cc
cmdline/apt-get.cc

index c6299915191efc7ad9a0917b68d1cb3164d08a7e..063add348c3a5479711a27fbcf9328163bef49d8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-cache.cc,v 1.11 1998/11/13 04:24:01 jgg Exp $
+// $Id: apt-cache.cc,v 1.12 1998/11/14 07:20:29 jgg Exp $
 /* ######################################################################
    
    apt-cache - Manages the cache files
 #include <config.h>
                                                                        /*}}}*/
 
+// UnMet - Show unmet dependencies                                     /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool UnMet(pkgCache &Cache)
+{
+   for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
+   {
+      for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
+      {
+        bool Header = false;
+        for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+        {
+           // Collect or groups
+           pkgCache::DepIterator Start;
+           pkgCache::DepIterator End;
+           D.GlobOr(Start,End);
+           
+           // Skip everything but depends
+           if (End->Type != pkgCache::Dep::PreDepends &&
+               End->Type != pkgCache::Dep::Depends && 
+               End->Type != pkgCache::Dep::Suggests &&
+               End->Type != pkgCache::Dep::Recommends)
+              continue;
+
+           // Verify the or group
+           bool OK = false;
+           pkgCache::DepIterator RealStart = Start;
+           do
+           {
+              // See if this dep is Ok
+              pkgCache::Version **VList = Start.AllTargets();
+              if (*VList != 0)
+              {
+                 OK = true;
+                 delete [] VList;
+                 break;
+              }
+              delete [] VList;
+              
+              if (Start == End)
+                 break;
+              Start++;
+           }
+           while (1);
+
+           // The group is OK
+           if (OK == true)
+              continue;
+           
+           // Oops, it failed..
+           if (Header == false)
+                 cout << "Package " << P.Name() << " version " << 
+              V.VerStr() << " has an unmet dep:" << endl;
+           Header = true;
+           
+           // Print out the dep type
+           cout << " " << End.DepType() << ": ";
+
+           // Show the group
+           Start = RealStart;
+           do
+           {
+              cout << Start.TargetPkg().Name();
+              if (Start.TargetVer() != 0)
+                 cout << " (" << Start.CompType() << " " << Start.TargetVer() <<
+                 ")";
+              if (Start == End)
+                 break;
+              cout << " | ";
+              Start++;
+           }
+           while (1);
+           
+           cout << endl;
+        }       
+      }
+   }   
+   return true;
+}
+                                                                       /*}}}*/
 // DumpPackage - Show a dump of a package record                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -301,6 +381,7 @@ int ShowHelp()
    cout << "   stats - Show some basic statistics" << endl;
    cout << "   dump - Show the entire file in a terse form" << endl;
    cout << "   dumpavail - Print an available file to stdout" << endl;
+   cout << "   unmet - Show unmet dependencies" << endl;
    cout << endl;
    cout << "Options:" << endl;
    cout << "  -h   This help text." << endl;
@@ -400,6 +481,12 @@ int main(int argc,const char *argv[])
         DumpAvail(Cache);
         break;
       }
+      
+      if (strcmp(CmdL.FileList[0],"unmet") == 0)
+      {
+        UnMet(Cache);
+        break;
+      }
             
       _error->Error("Invalid operation %s", CmdL.FileList[0]);
       break;
index c9c0a15f87513ab198306c2e1907b524d45780e9..23a918f8d7f7c5191118347753d4f773c51196f8 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.12 1998/11/14 03:32:26 jgg Exp $
+// $Id: apt-get.cc,v 1.13 1998/11/14 07:20:30 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -138,11 +138,8 @@ void ShowBroken(ostream &out,pkgDepCache &Cache)
            for (int J = 0; J != Indent; J++)
               out << ' ';
         First = false;
-        
-        if (D->Type == pkgCache::Dep::Conflicts)
-           out << " Conflicts:" << D.TargetPkg().Name();
-        else
-           out << " Depends:" << D.TargetPkg().Name();
+
+        cout << ' ' << D.DepType() << ": ";
         
         // Show a quick summary of the version requirements
         if (D.TargetVer() != 0)