]> git.saurik.com Git - apt.git/commitdiff
always do removes first and set not installed remove packages
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 7 Feb 2011 12:08:43 +0000 (13:08 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 7 Feb 2011 12:08:43 +0000 (13:08 +0100)
on hold to prevent temporary installation later (Closes: #549968)

cmdline/apt-get.cc
debian/changelog
test/integration/test-bug-549968-install-depends-of-not-installed [new file with mode: 0755]

index e93d12c2b908b9b43e986d9e779f9a60884bbf8b..a6377f9f1a7e3d31edd8f445d4fa481f19df08e3 100644 (file)
@@ -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);
index ecaca2a9b1874e87689f63521e01cb839e00ad99..3adb9d76f00f5fb6963f980ff33da26e94439e03 100644 (file)
@@ -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
 
diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed
new file mode 100755 (executable)
index 0000000..864dd34
--- /dev/null
@@ -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