]> git.saurik.com Git - apt.git/commitdiff
apt-get now prints out suggested and recommended packages.
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:01:16 +0000 (17:01 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:01:16 +0000 (17:01 +0000)
Author: doogie
Date: 2003-04-27 01:47:10 GMT
apt-get now prints out suggested and recommended packages.

cmdline/apt-get.cc
debian/changelog

index 4fa8a2600476e48716a6af021e31aa7a53b7200e..bb0414c5e78482135abd1c2bcd5eabc0aad942a2 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.127 2003/04/27 01:36:14 doogie Exp $
+// $Id: apt-get.cc,v 1.128 2003/04/27 01:47:10 doogie Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -1504,6 +1504,69 @@ bool DoInstall(CommandLine &CmdL)
       ShowList(c1out,_("The following extra packages will be installed:"),List,VersionsList);
    }
 
       ShowList(c1out,_("The following extra packages will be installed:"),List,VersionsList);
    }
 
+   /* Print out a list of suggested and recommended packages */
+   {
+      string SuggestsList, RecommendsList, List;
+      for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
+      {
+        pkgCache::PkgIterator I(Cache,Cache.List[J]);
+
+        /* Just look at the ones we want to install */
+        if ((*Cache)[I].Install() == false)
+          continue;
+
+        for (pkgCache::VerIterator V = I.VersionList(); V.end() == false; V++)
+          {
+            for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+              {
+                pkgCache::DepIterator Start;
+                pkgCache::DepIterator End;
+                D.GlobOr(Start,End);
+                do
+                  {
+                    if (Start->Type == pkgCache::Dep::Suggests) {
+
+                      /* A suggests relations, let's see if we have it 
+                         installed already */
+
+                      string target = string(Start.TargetPkg().Name()) + " ";
+                      if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install)
+                        break;
+                      /* Does another package suggest it as well?  If so,
+                         don't print it twice */
+                      if (int(SuggestsList.find(target)) > -1)
+                        break; 
+                      SuggestsList += target;
+                    }
+                    
+                    if (Start->Type == pkgCache::Dep::Recommends) {
+
+                      /* A recommends relation, let's see if we have it
+                         installed already */
+
+                      string target = string(Start.TargetPkg().Name()) + " ";
+                      if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install)
+                        break;
+                      
+                      /* Does another package recommend it as well?  If so,
+                         don't print it twice */
+
+                      if (int(RecommendsList.find(target)) > -1)
+                        break;
+                      RecommendsList += target;
+                    }
+             if (Start == End)
+               break;
+             Start++;
+           } while (1);
+              }
+          }
+      }
+      ShowList(c1out,_("Suggested packages:"),SuggestsList);
+      ShowList(c1out,_("Recommended packages:"),RecommendsList);
+
+   }
+
    // See if we need to prompt
    if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0)
       return InstallPackages(Cache,false,false);
    // See if we need to prompt
    if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0)
       return InstallPackages(Cache,false,false);
index 03961bd9a58204540024e699f532c4a33a4a973e..ae13a8370293ddb73ca0fa5e2a0940cc9f28d8c2 100644 (file)
@@ -111,6 +111,8 @@ apt (0.5.4.9) unstable; urgency=low
   * Add option to apt-get to show versions of packages being
     upgraded/installed.
   * Be quiet in apt.post{inst,rm}.  Closes: #70685.
   * Add option to apt-get to show versions of packages being
     upgraded/installed.
   * Be quiet in apt.post{inst,rm}.  Closes: #70685.
+  * apt-get now prints out suggested and recommended packages.  Closes:
+    #54982.
 
  -- Adam Heath <doogie@debian.org>  Sun, 02 Feb 2003 02:54:45 -0600
 
 
  -- Adam Heath <doogie@debian.org>  Sun, 02 Feb 2003 02:54:45 -0600