[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Keep current version with aptitude



On 2009-03-12 19:44 +0100, Sjoerd Hiemstra wrote:

> To keep a package at its current version during an
> 'aptitude safe-upgrade', I issue the command:
>
>     aptitude hold <packagename>
>
> But this only lasts for one upgrade.
> During the next 'safe-upgrade' I am proposed to upgrade that package
> again.

Probably you ran into bug #466228¹.

> Is there a way to make it permanent?

A workaround is to not run safe-upgrade if there are no new updates
("aptitude update" will tell you).  Another possibility is to try the
experimental aptitude version.

> In Synaptic there's an option to 'lock' the package. Is there an
> aptitude equivalent?
> I tried 'aptitude keep <packagename>' but apparently, that does not
> achieve this either.

Some time ago² Daniel posted a patch here that works fine for me.  You
may want to try it:

diff -r aabbcab08cd3 src/cmdline/cmdline_upgrade.cc
--- a/src/cmdline/cmdline_upgrade.cc	Sat Aug 09 09:58:13 2008 -0700
+++ b/src/cmdline/cmdline_upgrade.cc	Sat Aug 09 16:41:07 2008 -0700
@@ -112,7 +112,10 @@
 	// Reset all the package states.
 	for(pkgCache::PkgIterator i=(*apt_cache_file)->PkgBegin();
 	    !i.end(); ++i)
-	  (*apt_cache_file)->mark_keep(i, false, false, NULL);
+	  {
+	    bool held = (*apt_cache_file)->get_ext_state(i).selection_state == pkgCache::State::Hold;
+	    (*apt_cache_file)->mark_keep(i, false, held, NULL);
+	  }
       }
 
       // Use the apt 'upgrade' algorithm as a fallback against, e.g.,
¹ http://bugs.debian.org/466228
² http://lists.debian.org/debian-user/2008/08/msg00692.html

Reply to: