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

merge with apt/experimental

* apt-pkg/packagemanager.cc:
  - fix bug in predepends handling - ensure that packages that needs
    unpackaging are unpacked before they are configured (LP: #927993)
[ Julian Andres Klode ]
* apt-pkg/deb/deblistparser.cc:
  - Set the Essential flag on APT instead of only Important
* apt-pkg/packagemanager.cc:
  - Do not use immediate configuration for packages with the Important flag
* Treat the Important flag like the Essential flag with those differences:
  - No Immediate configuration (see above)
  - Not automatically installed during dist-upgrade
  - No higher score for installation ordering
David Kalnischkies пре 14 година
родитељ
комит
e8184cc38f
5 измењених фајлова са 51 додато и 11 уклоњено
  1. 11 2
      apt-pkg/algorithms.cc
  2. 1 1
      apt-pkg/deb/deblistparser.cc
  3. 8 0
      apt-pkg/depcache.cc
  4. 18 8
      apt-pkg/packagemanager.cc
  5. 13 0
      debian/changelog

+ 11 - 2
apt-pkg/algorithms.cc

@@ -556,7 +556,8 @@ void pkgProblemResolver::MakeScores()
          essantial package above most other packages but low enough
          essantial package above most other packages but low enough
 	 to allow an obsolete essential packages to be removed by
 	 to allow an obsolete essential packages to be removed by
 	 a conflicts on a powerfull normal package (ie libc6) */
 	 a conflicts on a powerfull normal package (ie libc6) */
-      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential
+	  || (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
 	 Score += PrioEssentials;
 	 Score += PrioEssentials;
 
 
       // We transform the priority
       // We transform the priority
@@ -631,7 +632,8 @@ void pkgProblemResolver::MakeScores()
    {
    {
       if ((Flags[I->ID] & Protected) != 0)
       if ((Flags[I->ID] & Protected) != 0)
 	 Scores[I->ID] += AddProtected;
 	 Scores[I->ID] += AddProtected;
-      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential ||
+          (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
 	 Scores[I->ID] += AddEssential;
 	 Scores[I->ID] += AddEssential;
    }
    }
 }
 }
@@ -1430,6 +1432,13 @@ static int PrioComp(const void *A,const void *B)
    if ((L.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
    if ((L.ParentPkg()->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
        (R.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
        (R.ParentPkg()->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
      return -1;
      return -1;
+
+   if ((L.ParentPkg()->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important &&
+       (R.ParentPkg()->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important)
+     return 1;
+   if ((L.ParentPkg()->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important &&
+       (R.ParentPkg()->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
+     return -1;
    
    
    if (L->Priority != R->Priority)
    if (L->Priority != R->Priority)
       return R->Priority - L->Priority;
       return R->Priority - L->Priority;

+ 1 - 1
apt-pkg/deb/deblistparser.cc

@@ -249,7 +249,7 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
       return false;
       return false;
 
 
    if (strcmp(Pkg.Name(),"apt") == 0)
    if (strcmp(Pkg.Name(),"apt") == 0)
-      Pkg->Flags |= pkgCache::Flag::Important;
+      Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
    
    
    if (ParseStatus(Pkg,Ver) == false)
    if (ParseStatus(Pkg,Ver) == false)
       return false;
       return false;

+ 8 - 0
apt-pkg/depcache.cc

@@ -963,6 +963,13 @@ struct CompareProviders {
 	 else if ((B->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
 	 else if ((B->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
 	    return true;
 	    return true;
       }
       }
+      if ((A->Flags & pkgCache::Flag::Important) != (B->Flags & pkgCache::Flag::Important))
+      {
+	 if ((A->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
+	    return false;
+	 else if ((B->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
+	    return true;
+      }
       // higher priority seems like a good idea
       // higher priority seems like a good idea
       if (AV->Priority != BV->Priority)
       if (AV->Priority != BV->Priority)
 	 return AV->Priority < BV->Priority;
 	 return AV->Priority < BV->Priority;
@@ -1641,6 +1648,7 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
    {
    {
       if(!(PkgState[p->ID].Flags & Flag::Auto) ||
       if(!(PkgState[p->ID].Flags & Flag::Auto) ||
 	  (p->Flags & Flag::Essential) ||
 	  (p->Flags & Flag::Essential) ||
+	  (p->Flags & Flag::Important) ||
 	  userFunc.InRootSet(p) ||
 	  userFunc.InRootSet(p) ||
 	  // be nice even then a required package violates the policy (#583517)
 	  // be nice even then a required package violates the policy (#583517)
 	  // and do the full mark process also for required packages
 	  // and do the full mark process also for required packages

+ 18 - 8
apt-pkg/packagemanager.cc

@@ -183,8 +183,7 @@ bool pkgPackageManager::CreateOrderList()
 	 continue;
 	 continue;
       
       
       // Mark the package and its dependends for immediate configuration
       // Mark the package and its dependends for immediate configuration
-      if ((((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential ||
-	   (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) &&
+      if ((((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential) &&
 	  NoImmConfigure == false) || ImmConfigureAll)
 	  NoImmConfigure == false) || ImmConfigureAll)
       {
       {
 	 if(Debug && !ImmConfigureAll)
 	 if(Debug && !ImmConfigureAll)
@@ -486,7 +485,8 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg)
 
 
    // Essential packages get special treatment
    // Essential packages get special treatment
    bool IsEssential = false;
    bool IsEssential = false;
-   if ((Pkg->Flags & pkgCache::Flag::Essential) != 0)
+   if ((Pkg->Flags & pkgCache::Flag::Essential) != 0 ||
+       (Pkg->Flags & pkgCache::Flag::Important) != 0)
       IsEssential = true;
       IsEssential = true;
 
 
    /* Check for packages that are the dependents of essential packages and 
    /* Check for packages that are the dependents of essential packages and 
@@ -496,7 +496,8 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg)
       for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
       for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
 	   IsEssential == false; ++D)
 	   IsEssential == false; ++D)
 	 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
 	 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
-	    if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
+	    if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0 ||
+	        (D.ParentPkg()->Flags & pkgCache::Flag::Important) != 0)
 	       IsEssential = true;
 	       IsEssential = true;
    }
    }
 
 
@@ -610,10 +611,19 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	       continue;
 	       continue;
 	    }
 	    }
 
 
-	    if (Debug)
-	       clog << OutputInDepth(Depth) << "Trying to SmartConfigure " << Pkg.Name() << endl;
-	    Bad = !SmartConfigure(Pkg, Depth + 1);
-	 }
+            // check if it needs unpack or if if configure is enough
+            if (!List->IsFlag(Pkg,pkgOrderList::UnPacked))
+            {
+               if (Debug)
+                  clog << OutputInDepth(Depth) << "Trying to SmartUnpack " << Pkg.Name() << endl;
+               // SmartUnpack with the ImmediateFlag to ensure its really ready
+               Bad = !SmartUnPack(Pkg, true, Depth + 1);
+            } else {
+               if (Debug)
+                  clog << OutputInDepth(Depth) << "Trying to SmartConfigure " << Pkg.Name() << endl;
+               Bad = !SmartConfigure(Pkg, Depth + 1);
+            }
+         }
 
 
 	 /* If this or element did not match then continue on to the
 	 /* If this or element did not match then continue on to the
 	    next or element until a matching element is found */
 	    next or element until a matching element is found */

+ 13 - 0
debian/changelog

@@ -73,6 +73,19 @@ apt (0.8.16~exp13) UNRELEASED; urgency=low
       (LP: #923807)
       (LP: #923807)
   * apt-pkg/contrib/fileutl.h:
   * apt-pkg/contrib/fileutl.h:
     - fix compat with FileFd::OpenDescriptor() in ReadOnlyGzip mode
     - fix compat with FileFd::OpenDescriptor() in ReadOnlyGzip mode
+  * apt-pkg/packagemanager.cc:
+    - fix bug in predepends handling - ensure that packages that needs
+      unpackaging are unpacked before they are configured (LP: #927993)
+
+  [ Julian Andres Klode ]
+  * apt-pkg/deb/deblistparser.cc:
+    - Set the Essential flag on APT instead of only Important
+  * apt-pkg/packagemanager.cc:
+    - Do not use immediate configuration for packages with the Important flag
+  * Treat the Important flag like the Essential flag with those differences:
+    - No Immediate configuration (see above)
+    - Not automatically installed during dist-upgrade
+    - No higher score for installation ordering
 
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 06 Mar 2012 10:52:00 +0100
  -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 06 Mar 2012 10:52:00 +0100