]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
* ftparchive/multicompress.cc, apt-inst/deb/debfile.cc:
[apt.git] / apt-pkg / algorithms.cc
index bd9a9df622147b8e46aecb17a237491ba03e42fb..66c182b235ed91392fb745e9c463c21ed2b06a7d 100644 (file)
@@ -162,7 +162,28 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
       }
    }
 
-//   Sim.MarkInstall(Pkg,false);
+   if (Sim[Pkg].InstBroken() == true)
+   {
+      /* We don't call Configure for Pseudo packages and if the 'all' is already installed
+         the simulation will think the pseudo package is not installed, so if something is
+         broken we walk over the dependencies and search for not installed pseudo packages */
+      for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++)
+      {
+        if (Sim.IsImportantDep(D) == false || 
+            (Sim[D] & pkgDepCache::DepInstall) != 0)
+           continue;
+        pkgCache::PkgIterator T = D.TargetPkg();
+        if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0)
+           continue;
+        pkgCache::PkgIterator A = T.Group().FindPkg("all");
+        if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 ||
+            Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false)
+           continue;
+        Sim.MarkInstall(T, false);
+        Flags[T->ID] = 2;
+      }
+   }
+
    if (Sim[Pkg].InstBroken() == true)
    {
       cout << "Conf " << Pkg.FullName(false) << " broken" << endl;
@@ -374,6 +395,13 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
 {
    pkgDepCache::ActionGroup group(Cache);
 
+   /* Upgrade all installed packages first without autoinst to help the resolver
+      in versioned or-groups to upgrade the old solver instead of installing
+      a new one (if the old solver is not the first one [anymore]) */
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+      if (I->CurrentVer != 0)
+        Cache.MarkInstall(I, false, 0, false);
+
    /* Auto upgrade all installed packages, this provides the basis 
       for the installation */
    for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
@@ -987,22 +1015,21 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               pkgCache::VerIterator Ver(Cache,*V);
               pkgCache::PkgIterator Pkg = Ver.ParentPkg();
 
-               /* Ignore a target that is not a candidate
-                  This can happen if:
-                    installed package provides video-6
-                    candidate provides video-8
-                  now if a package Start breaks/conflicts video-6
-                  Start.AllTargets() will return the now-installed
-                  versions even though these are not candidates
-                  we can ignore them
-               */
-               if (Cache[Pkg].CandidateVerIter(Cache) != Ver)
+               /* This is a conflicts, and the version we are looking
+                  at is not the currently selected version of the 
+                  package, which means it is not necessary to 
+                  remove/keep */
+               if (Cache[Pkg].InstallVer != Ver &&
+                   (Start->Type == pkgCache::Dep::Conflicts ||
+                    Start->Type == pkgCache::Dep::DpkgBreaks ||
+                    Start->Type == pkgCache::Dep::Obsoletes)) 
                {
-                  if (Debug)
-                     clog << "  Version " << Ver.VerStr() << " for "
-                          << Pkg.Name() << " is not a candidate, ignoring"
+                  if (Debug) 
+                     clog << "  Conflicts//Breaks against version " 
+                          << Ver.VerStr() << " for " << Pkg.Name() 
+                          << " but that is not InstVer, ignoring"
                           << endl;
-                 continue;
+                  continue;
                }
 
               if (Debug == true)
@@ -1063,6 +1090,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                        else if (TryFixByInstall == true &&
                                 Start.TargetPkg()->CurrentVer == 0 &&
                                 Cache[Start.TargetPkg()].Delete() == false &&
+                                (Flags[Start.TargetPkg()->ID] & ToRemove) != ToRemove &&
                                 Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
                        {
                           /* Before removing or keeping the package with the broken dependency
@@ -1087,22 +1115,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
               }
               else
               {
-                 /* This is a conflicts, and the version we are looking
-                    at is not the currently selected version of the 
-                    package, which means it is not necessary to 
-                    remove/keep */
-                 if (Cache[Pkg].InstallVer != Ver &&
-                     (Start->Type == pkgCache::Dep::Conflicts ||
-                      Start->Type == pkgCache::Dep::Obsoletes))
-                    continue;
-
                  if (Start->Type == pkgCache::Dep::DpkgBreaks)
                  {
-                    // first, try upgrading the package, if that
+                    // first, try upgradring the package, if that
                     // does not help, the breaks goes onto the
                     // kill list
+                     //
                     // FIXME: use DoUpgrade(Pkg) instead?
-                    if (Cache[End] & pkgDepCache::DepGCVer) 
+                    if (Cache[End] & pkgDepCache::DepGCVer)
                     {
                        if (Debug)
                           clog << "  Upgrading " << Pkg.FullName(false) << " due to Breaks field in " << I.FullName(false) << endl;
@@ -1123,7 +1143,6 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
                  LEnd++;
                  
                  if (Start->Type != pkgCache::Dep::Conflicts &&
-                      Start->Type != pkgCache::Dep::DpkgBreaks &&
                      Start->Type != pkgCache::Dep::Obsoletes)
                     break;
               }
@@ -1495,9 +1514,9 @@ bool ListUpdate(pkgAcquireStatus &Stat,
    }
    
    if (TransientNetworkFailure == true)
-      _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead."));
+      _error->Warning(_("Some index files failed to download. They have been ignored, or old ones used instead."));
    else if (Failed == true)
-      return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead."));
+      return _error->Error(_("Some index files failed to download. They have been ignored, or old ones used instead."));
 
 
    // Run the success scripts if all was fine