]> git.saurik.com Git - apt.git/commitdiff
* merged with mainline
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 9 Aug 2006 14:54:33 +0000 (16:54 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 9 Aug 2006 14:54:33 +0000 (16:54 +0200)
1  2 
cmdline/apt-get.cc
debian/changelog

diff --combined cmdline/apt-get.cc
index b419a05d95e0d57123464853978f8468d0de18e2,64882e3e8875ad58672ae0c14f3f80964f207584..7b7780a48a822b25c3b81bf5e796a9f8145be057
@@@ -1145,11 -1145,9 +1145,11 @@@ bool TryToInstall(pkgCache::PkgIterato
     else
        ExpectedInst++;
     
 -   // Install it with autoinstalling enabled.
 -   if (State.InstBroken() == true && BrokenFix == false)
 +   // Install it with autoinstalling enabled (if we not respect the minial
 +   // required deps or the policy)
 +   if ((State.InstBroken() == true || State.InstPolicyBroken() == true) && BrokenFix == false)
        Cache.MarkInstall(Pkg,true);
 +
     return true;
  }
                                                                        /*}}}*/
@@@ -1611,68 -1609,86 +1611,86 @@@ bool DoInstall(CommandLine &CmdL
        string SuggestsVersions, RecommendsVersions;
        for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
        {
-        pkgCache::PkgIterator I(Cache,Cache.List[J]);
+        pkgCache::PkgIterator Pkg(Cache,Cache.List[J]);
  
         /* Just look at the ones we want to install */
-        if ((*Cache)[I].Install() == false)
+        if ((*Cache)[Pkg].Install() == false)
           continue;
  
-        for (pkgCache::VerIterator V = I.VersionList(); V.end() == false; V++)
-          {
-            for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; )
-              {
-                pkgCache::DepIterator Start;
-                pkgCache::DepIterator End;
-                D.GlobOr(Start,End); // advances D
-                /* 
-                 * If this is a virtual package, we need to check the list of
-                 * packages that provide it and see if any of those are
-                 * installed
-                 */
-                
-                bool providedBySomething = false;
-                for (pkgCache::PrvIterator Prv = Start.TargetPkg().ProvidesList();
-                       Prv.end() != true;
-                       Prv++)
-                   if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
-                     {
-                      providedBySomething = true;
-                      break;
-                   }
-                if (providedBySomething) continue;
-             
-                  for(;;)
-                  {
-                      /* Skip if package is  installed already, or is about to be */
-                      string target = string(Start.TargetPkg().Name()) + " ";
-                      if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install
-                          || Cache[Start.TargetPkg()].Install())
-                        break;
-                      /* Skip if we already saw it */
-                      if (int(SuggestsList.find(target)) != -1 || int(RecommendsList.find(target)) != -1)
-                        break; 
-                    if (Start->Type == pkgCache::Dep::Suggests) {
-                      SuggestsList += target;
-                      SuggestsVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
-                    }
-                    
-                    if (Start->Type == pkgCache::Dep::Recommends) {
-                      RecommendsList += target;
-                      RecommendsVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
-                    }
-                      if (Start >= End)
-                         break;
-                      Start++;
-                  }
-              }
-          }
+        // get the recommends/suggests for the candidate ver
+        pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
+        for (pkgCache::DepIterator D = CV.DependsList(); D.end() == false; )
+        {
+           pkgCache::DepIterator Start;
+           pkgCache::DepIterator End;
+           D.GlobOr(Start,End); // advances D
+           // FIXME: we really should display a or-group as a or-group to the user
+           //        the problem is that ShowList is incapable of doing this
+           string RecommendsOrList,RecommendsOrVersions;
+           string SuggestsOrList,SuggestsOrVersions;
+           bool foundInstalledInOrGroup = false;
+           for(;;)
+           {
+              /* Skip if package is  installed already, or is about to be */
+              string target = string(Start.TargetPkg().Name()) + " ";
+              
+              if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install
+                  || Cache[Start.TargetPkg()].Install())
+              {
+                 foundInstalledInOrGroup=true;
+                 break;
+              }
+              /* Skip if we already saw it */
+              if (int(SuggestsList.find(target)) != -1 || int(RecommendsList.find(target)) != -1)
+              {
+                 foundInstalledInOrGroup=true;
+                 break; 
+              }
+              // this is a dep on a virtual pkg, check if any package that provides it
+              // should be installed
+              if(Start.TargetPkg().ProvidesList() != 0)
+              {
+                 pkgCache::PrvIterator I = Start.TargetPkg().ProvidesList();
+                 for (; I.end() == false; I++)
+                 {
+                    pkgCache::PkgIterator Pkg = I.OwnerPkg();
+                    if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer() && 
+                        Pkg.CurrentVer() != 0)
+                       foundInstalledInOrGroup=true;
+                 }
+              }
+              if (Start->Type == pkgCache::Dep::Suggests) 
+              {
+                 SuggestsOrList += target;
+                 SuggestsOrVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
+              }
+              
+              if (Start->Type == pkgCache::Dep::Recommends) 
+              {
+                 RecommendsOrList += target;
+                 RecommendsOrVersions += string(Cache[Start.TargetPkg()].CandVersion) + "\n";
+              }
+              if (Start >= End)
+                 break;
+              Start++;
+           }
+           
+           if(foundInstalledInOrGroup == false)
+           {
+              RecommendsList += RecommendsOrList;
+              RecommendsVersions += RecommendsOrVersions;
+              SuggestsList += SuggestsOrList;
+              SuggestsVersions += SuggestsOrVersions;
+           }
+              
+        }
        }
        ShowList(c1out,_("Suggested packages:"),SuggestsList,SuggestsVersions);
        ShowList(c1out,_("Recommended packages:"),RecommendsList,RecommendsVersions);
  
@@@ -2524,7 -2540,6 +2542,7 @@@ int main(int argc,const char *argv[]
        {0,"only-source","APT::Get::Only-Source",0},
        {0,"arch-only","APT::Get::Arch-Only",0},
        {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0},
 +      {0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean},
        {'c',"config-file",0,CommandLine::ConfigFile},
        {'o',"option",0,CommandLine::ArbItem},
        {0,0,0,0}};
diff --combined debian/changelog
index ec802a80c44ab6f9dec0fd94c398c4c3078cfe4a,a84146d20747332d26ac483ba4c3b89c2b46f2c2..de9a43d49d4cf4a7278e439a9ccd7c7b09d615f4
@@@ -1,9 -1,14 +1,14 @@@
  apt (0.6.45.1) unstable; urgency=low
  
    * debian/control:
-     - switched to libdb4.4 for building
+     - switched to libdb4.4 for building (closes: #381019)
+   * cmdline/apt-get.cc:
+     - show only the recommends/suggests for the candidate-version, not for all
+       versions of the package (closes: #257054)
+     - properly handle recommends/suggests or-groups when printing the list of
+       suggested/recommends packages (closes: #311619)
  
 - --
 + -- Michael Vogt <michael.vogt@ubuntu.com>  Wed,  9 Aug 2006 14:27:54 +0200
  
  apt (0.6.45) unstable; urgency=low