Просмотр исходного кода

always do removes first and set not installed remove packages
on hold to prevent temporary installation later (Closes: #549968)

David Kalnischkies лет назад: 15
Родитель
Сommit
bea4171212

+ 5 - 8
cmdline/apt-get.cc

@@ -895,7 +895,11 @@ struct TryToRemove {
 
       if ((Pkg->CurrentVer == 0 && PurgePkgs == false) ||
 	  (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled))
+      {
 	 ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str());
+	 // MarkInstall refuses to install packages on hold
+	 Pkg->SelectedState = pkgCache::State::Hold;
+      }
       else
 	 Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs);
    }
@@ -1790,14 +1794,7 @@ bool DoInstall(CommandLine &CmdL)
       return false;
    }
 
-   unsigned short order[] = { 0, 0, 0 };
-   if (fallback == MOD_INSTALL) {
-      order[0] = MOD_INSTALL;
-      order[1] = MOD_REMOVE;
-   } else {
-      order[0] = MOD_REMOVE;
-      order[1] = MOD_INSTALL;
-   }
+   unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 };
 
   TryToInstall InstallAction(Cache, Fix, BrokenFix);
   TryToRemove RemoveAction(Cache, Fix);

+ 3 - 1
debian/changelog

@@ -17,6 +17,8 @@ apt (0.8.11) UNRELEASED; urgency=low
       so installing packages from experimental or backports is easier
     - really do not show packages in the extra section if they were
       requested on the commandline, e.g. with a modifier (Closes: #184730)
+    - always do removes first and set not installed remove packages
+      on hold to prevent temporary installation later (Closes: #549968)
   * debian/control:
     - add Vcs-Browser now that loggerhead works again (Closes: #511168)
     - depend on debhelper 7 to raise compat level
@@ -99,7 +101,7 @@ apt (0.8.11) UNRELEASED; urgency=low
       will actually test uncompressed indexes regardless of the internal
       default value of Acquire::GzipIndexes.
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 07 Feb 2011 11:42:41 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 07 Feb 2011 13:06:50 +0100
 
 apt (0.8.10.3) unstable; urgency=low
 

+ 26 - 0
test/integration/test-bug-549968-install-depends-of-not-installed

@@ -0,0 +1,26 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'libc6' 'all' '1.0'
+insertpackage 'unstable' 'coolstuff' 'all' '1.0' 'Recommends: extracoolstuff'
+insertpackage 'unstable' 'extracoolstuff' 'all' '1.0' 'Depends: libc6'
+
+setupaptarchive
+
+# We check the Markers here as the autoremove nuker will also
+# prevent it, but to late - its better to fail earlier
+testequal 'Reading package lists...
+Building dependency tree...
+  MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1
+    Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0
+Package extracoolstuff is not installed, so not removed
+The following NEW packages will be installed:
+  coolstuff
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst coolstuff (1.0 unstable [all])
+Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s