summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/apt-cache.cc89
-rw-r--r--cmdline/apt-get.cc9
2 files changed, 91 insertions, 7 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index c62999151..063add348 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -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
@@ -27,6 +27,86 @@
#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;
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index c9c0a15f8..23a918f8d 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -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)