* Apply --important option to apt-cache depends (LP: #16947)
authorMichael Vogt <michael.vogt@ubuntu.com>
Thu, 31 Jul 2008 12:57:38 +0000 (14:57 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Thu, 31 Jul 2008 12:57:38 +0000 (14:57 +0200)
cmdline/apt-cache.cc
debian/changelog
doc/apt-cache.8.xml

index d73111b..a73e35a 100644 (file)
@@ -555,6 +555,7 @@ bool Depends(CommandLine &CmdL)
    
    bool Recurse = _config->FindB("APT::Cache::RecurseDepends",false);
    bool Installed = _config->FindB("APT::Cache::Installed",false);
+   bool Important = _config->FindB("APT::Cache::Important",false);
    bool DidSomething;
    do
    {
@@ -577,7 +578,12 @@ bool Depends(CommandLine &CmdL)
         
         for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
         {
-
+           // Important deps only
+           if (Important == true)
+              if (D->Type != pkgCache::Dep::PreDepends &&
+                  D->Type != pkgCache::Dep::Depends)
+                 continue;
+                 
            pkgCache::PkgIterator Trg = D.TargetPkg();
 
            if((Installed && Trg->CurrentVer != 0) || !Installed)
index c788c1d..24f876e 100644 (file)
@@ -29,7 +29,7 @@ apt (0.7.15) UNRELEASED; urgency=low
 
   [ Dereck Wonnacott ]
   * apt-ftparchive might write corrupt Release files (LP: #46439)
-
+  * Apply --important option to apt-cache depends (LP: #16947) 
 
  --
 
index c1e6533..c359ac3 100644 (file)
@@ -289,7 +289,7 @@ Reverse Provides:
      </varlistentry>
 
      <varlistentry><term><option>-i</option></term><term><option>--important</option></term>
-     <listitem><para>Print only important dependencies; for use with unmet. Causes only Depends and 
+     <listitem><para>Print only important dependencies; for use with unmet and depends. Causes only Depends and 
      Pre-Depends relations to be printed.
      Configuration Item: <literal>APT::Cache::Important</literal>.</para></listitem>
      </varlistentry>