When i run "emerge --depclean -p" it works fine wanting to unmerge all my kernel vanilla-sources but the last one. Since i do not want to remove _all_ the other stuff emerge would like to, i tried: "emerge -p --depclean vanilla-sources" and, surprise!, it wants to undelete _every_ kernel (vanilla) source, including the last one (that in the general --depclean was , correctly, listed under "protected") Reproducible: Always Actual Results: unmerges all vanilla kernel sources Expected Results: Should've unmerged all but the last one emerge --info Portage 2.1.6.7 (default/linux/amd64/2008.0/desktop, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.28.7 x86_64) ================================================================= System uname: Linux-2.6.28.7-x86_64-AMD_Phenom-tm-_9750_Quad-Core_Processor-with-glibc2.2.5 Timestamp of tree: Mon, 23 Feb 2009 08:00:02 +0000 ccache version 2.4 [enabled] app-shells/bash: 3.2_p39 dev-java/java-config: 2.1.6-r1 dev-lang/python: 2.5.2-r7 dev-util/ccache: 2.4-r7 dev-util/cmake: 2.4.8 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.13, 2.63 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.27-r2 ACCEPT_KEYWORDS="amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=k8 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-march=k8 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="candy ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userprov usersandbox" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LDFLAGS="-Wl,-O1" LINGUAS="en it" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3dnow 3dnowext X acl acpi aften akode alsa amazon amd64 amr amrnb amrwb animgif audiofile berkdb bluetooth branding bzip2 cairo ccache cdr cleartype cli cracklib crypt cscope cups curl cxx dbus dri dvd dvdr dvdread eds encode esd fam ffmpeg firefox foomaticdb gcrypt gd gdbm gif gimp gkrellm gpm gsm gstreamer gtk hardened iconv imagemagick ipod java java6 jpeg kde lame libgcrypt libssh2 logrotate loop-aes mad matroska midi mmx mmxext mng mp3 mp4 mpeg mpeg2 mplayer mudflap multilib musepack musicbrainz ncurses nls nptl nptlonly ogg opengl openmp openssl opensslcrypt pam pcre pdf perl png ppds pppd python qt3 qt3support qt4 quicktime readline reflection samba sdl session smp sndfile speex spell spl sqlite3 sse sse2 sse3 sse4.1 sse4.2 sse4a sse5 ssl startup-notification subversion svg svnserve swat sysfs syslog tcpd theora tiff truetype unicode usb v4l v4l2 vorbis webkit xcomposite xinerama xml xorg xscreensaver xulrunner xv zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en it" USERLAND="GNU" VIDEO_CARDS="vesa nv nvidia vga" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
You can use the "--prune" option for this kind of task. "--prune (-P) WARNING: This action can remove important packages! Removes all but the highest installed version of a package from your system. Use --prune together with --verbose to show reverse dependencies or with --nodeps to ignore all dependencies." And IMHO, this is the expected behavior of the "--depclean <atom>" syntax : "Depclean serves as a dependency aware version of --unmerge. When given one or more atoms, it will unmerge matched packages that have no reverse dependencies. Use --depclean together with --verbose to show reverse dependencies."
well, i am not questioning the reasoning behind --prune and --depclean: i've seen there's been quite a lot of discussion about this topic :) but then... i don't really see the reason why "emerge --depclean" unmerges say 3 vanillakernelsources and "emerge --depclean vanilla-source" unmerges 4! that is not consistent behaviour imho.
(In reply to comment #2) > don't really see the reason why "emerge --depclean" unmerges say 3 > vanillakernelsources and "emerge --depclean vanilla-source" unmerges 4! that is > not consistent behaviour imho. The difference is that --depclean <atom> acts as if the matched packages are not in the world file. If there are no reverse dependencies, atoms corresponding to the matched packages will be removed from the world file when those packages are uninstalled. It's intended to act similarly to --unmerge, which also removes packages from the world file when they are uninstalled. I see what you mean by saying that the behavior is inconsistent. However, I think it's too late to change the default behavior at this point. We could add another options if some other behavior is needed, but --prune is already pretty close to what you want.
I think I'll add a --deselect action/option that can be used to remove packages from the world file. When used alone (without --depclean, --prune, or --unmerge), it will remove matched packages from the world file. When --deselect=n is used together with an uninstall action such as --depclean, --prune, or --unmerge, it will prevent the matched packages from being removed from the world file (default behavior for these actions will be --deselect=y).
The new --deselect action/option is in svn r13363.
This is fixed in 2.2_rc31.
This is fixed in 2.1.6.12.