Преглед изворни кода

* apt-pkg/orderlist.cc:
- prefer visiting packages marked for deletion in VisitProvides
if we are operating on a negative dependency so that we can
deal early with the fallout of this remove

David Kalnischkies пре 15 година
родитељ
комит
05b64a6f78
2 измењених фајлова са 48 додато и 8 уклоњено
  1. 43 7
      apt-pkg/orderlist.cc
  2. 5 1
      debian/changelog

+ 43 - 7
apt-pkg/orderlist.cc

@@ -495,33 +495,69 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver)
 									/*}}}*/
 									/*}}}*/
 // OrderList::VisitProvides - Visit all of the providing packages	/*{{{*/
 // OrderList::VisitProvides - Visit all of the providing packages	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
-/* This routine calls visit on all providing packages. */
+/* This routine calls visit on all providing packages.
+
+   If the dependency is negative it first visits packages which are
+   intended to be removed and after that all other packages.
+   It does so to avoid situations in which this package is used to
+   satisfy a (or-group/provides) dependency of another package which
+   could have been satisfied also by upgrading another package -
+   otherwise we have more broken packages dpkg needs to auto-
+   deconfigure and in very complicated situations it even decides
+   against it! */
 bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
 bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
-{   
+{
    SPtrArray<Version *> List = D.AllTargets();
    SPtrArray<Version *> List = D.AllTargets();
-   for (Version **I = List; *I != 0; I++)
+   for (Version **I = List; *I != 0; ++I)
    {
    {
       VerIterator Ver(Cache,*I);
       VerIterator Ver(Cache,*I);
       PkgIterator Pkg = Ver.ParentPkg();
       PkgIterator Pkg = Ver.ParentPkg();
 
 
+      if (D.IsNegative() == true && Cache[Pkg].Delete() == false)
+	 continue;
+
       if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
       if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
 	 continue;
 	 continue;
-      
+
       if (D.IsNegative() == false &&
       if (D.IsNegative() == false &&
 	  Cache[Pkg].InstallVer != *I)
 	  Cache[Pkg].InstallVer != *I)
 	 continue;
 	 continue;
-      
+
       if (D.IsNegative() == true &&
       if (D.IsNegative() == true &&
 	  (Version *)Pkg.CurrentVer() != *I)
 	  (Version *)Pkg.CurrentVer() != *I)
 	 continue;
 	 continue;
-      
+
+      // Skip over missing files
+      if (Critical == false && IsMissing(D.ParentPkg()) == true)
+	 continue;
+
+      if (VisitNode(Pkg, "Provides-1") == false)
+	 return false;
+   }
+   if (D.IsNegative() == false)
+      return true;
+   for (Version **I = List; *I != 0; ++I)
+   {
+      VerIterator Ver(Cache,*I);
+      PkgIterator Pkg = Ver.ParentPkg();
+
+      if (Cache[Pkg].Delete() == true)
+	 continue;
+
+      if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
+	 continue;
+
+      if ((Version *)Pkg.CurrentVer() != *I)
+	 continue;
+
       // Skip over missing files
       // Skip over missing files
       if (Critical == false && IsMissing(D.ParentPkg()) == true)
       if (Critical == false && IsMissing(D.ParentPkg()) == true)
 	 continue;
 	 continue;
 
 
-      if (VisitNode(Pkg, "Provides") == false)
+      if (VisitNode(Pkg, "Provides-2") == false)
 	 return false;
 	 return false;
    }
    }
+
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 5 - 1
debian/changelog

@@ -24,8 +24,12 @@ apt (0.8.15.7) UNRELEASED; urgency=low
   * cmdline/apt-key:
   * cmdline/apt-key:
     - if command is 'add' do not error out if the specified
     - if command is 'add' do not error out if the specified
       keyring doesn't exist, it will be created by gpg
       keyring doesn't exist, it will be created by gpg
+  * apt-pkg/orderlist.cc:
+    - prefer visiting packages marked for deletion in VisitProvides
+      if we are operating on a negative dependency so that we can
+      deal early with the fallout of this remove
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 23 Aug 2011 11:19:47 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 24 Aug 2011 00:41:18 +0200
 
 
 apt (0.8.15.6) unstable; urgency=low
 apt (0.8.15.6) unstable; urgency=low