Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 259994

Summary: portage --depclean wrong behaviour when specifying single package
Product: Gentoo Linux Reporter: Francesco Lamonica <alienpenguin>
Component: [OLD] baselayoutAssignee: Portage team <dev-portage>
Severity: normal CC: gef.kornflakes, gentoo-bugs
Priority: High Keywords: InVCS
Version: 2008.0   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 210077, 265206, 268228    

Description Francesco Lamonica 2009-02-23 11:34:31 UTC
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 (default/linux/amd64/2008.0/desktop, gcc-4.1.2, glibc-2.8_p20080602-r1, x86_64)
System uname: Linux-
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-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
CFLAGS="-march=k8 -O2 -pipe"
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"
FEATURES="candy ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userprov usersandbox"
LINGUAS="en it"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
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"
Comment 1 Gef 2009-02-23 19:13:28 UTC
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."
Comment 2 Francesco Lamonica 2009-02-23 23:11:57 UTC
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.
Comment 3 Zac Medico gentoo-dev 2009-02-25 00:37:28 UTC
(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.
Comment 4 Zac Medico gentoo-dev 2009-04-13 18:50:13 UTC
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).
Comment 5 Zac Medico gentoo-dev 2009-04-19 05:49:49 UTC
The new --deselect action/option is in svn r13363.
Comment 6 Zac Medico gentoo-dev 2009-04-19 23:32:42 UTC
This is fixed in 2.2_rc31.
Comment 7 Zac Medico gentoo-dev 2009-05-02 02:38:45 UTC
This is fixed in