My USE var begins with "-*". In /etc/portage/package.use. I have the line... dev-lang/python readline ssl xml When emerging or re-emerging python, sys-libs/readline is not pulled in, and python's "readline" module is not built. If I emerge "sys-libs/readline" manually before emerging python, then python's readline module is built, and works properly. However, "emerge --depclean readline" wants to remove readline, notwithstanding python's "readline" flag. In summary... * python ebuild honours "readline" flag (builds readline module) when readline is installed before python * even with readline flag, python ebuild does not pull in readline, nor protect it against depclean Reproducible: Always Steps to Reproduce: Part 1 of the problem 1. USE starts with "-*" 2. /etc/portage/package.use contains line "dev-lang/python readline ssl xml" 3. readline has not been installed 4. emerge -1 =dev-lang/python-2.7.2-r3 =dev-lang/python-3.1.4-r3 5. python-updater Part 2 of problem Same as above, but change step 3 to... 3. emerge -1 readline Add step 6 6. emerge -pv --depclean readline Actual Results: In Part 1 ========= emerge command does not pull in readline. waltdnes@d530 ~ $ python Python 2.7.2 (default, Dec 14 2011, 00:09:44) [GCC 4.5.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import readline Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named readline >>> In Part 2 ========= waltdnes@d530 ~ $ python Python 2.7.2 (default, Jan 31 2012, 02:14:56) [GCC 4.5.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import readline >>> Up-arrow, down-arrow, left-arrow, right-arrow all work OK... *BUT* waltdnes@d530 ~ $ emerge -pv --depclean readline Calculating dependencies... done! >>> Calculating removal order... >>> These are the packages that would be unmerged: sys-libs/readline selected: 6.2_p1 protected: none omitted: none All selected packages: sys-libs/readline-6.2_p1 Expected Results: In Part 1 ========= emerge should have pulled in sys-libs/readline allowing python's readline module to be built In Part 2 ========= "emerge -pv --depclean readline" should not want to remove sys-libs/readline waltdnes@d530 ~ $ emerge --info Portage 2.1.10.41 (default/linux/x86/10.0, gcc-4.5.3, glibc-2.13-r4, 3.1.10-gentoo-r1 i686) ================================================================= System uname: Linux-3.1.10-gentoo-r1-i686-Genuine_Intel-R-_CPU_2140_@_1.60GHz-with-gentoo-2.0.3 Timestamp of tree: Wed, 25 Jan 2012 23:15:01 +0000 app-shells/bash: 4.1_p9 dev-lang/python: 2.7.2-r3, 3.1.4-r3 dev-util/cmake: 2.8.6-r4 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.0.3 sys-apps/openrc: 0.9.8.2 sys-apps/sandbox: 2.5 sys-devel/autoconf: 2.13, 2.68 sys-devel/automake: 1.11.1 sys-devel/binutils: 2.21.1-r1 sys-devel/gcc: 4.5.3-r1 sys-devel/gcc-config: 1.4.1-r1 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 3.1 (virtual/os-headers) sys-libs/glibc: 2.13-r4 Repositories: gentoo x-portage ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="*" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=native -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -march=native -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--autounmask=n" FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://gentoo.netnitco.net" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en" MAKEOPTS="-j1" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" 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" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="X a52 aac bzip2 cxx dga dri exif ffmpeg flac fortran gallium gif intel jpeg mmx mng mp3 mpeg nptl nptlonly nsplugin offensive ogg opengl png posix sse sse2 sse3 ssse3 theora threads tiff truetype vim-syntax vorbis win32codecs wmf x86 xcomposite xpm xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol asym" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="intel" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
RDEPEND appears to be correct, so could you try again after emerging: sys-apps/portage-2.1.10.44
I keyworded and emerged sys-apps/portage-2.1.10.44 and went through the cycle again. No change from before. I did some more looking at the ebuild, and I think I've found the problem. "readline" is mentioned in 2 places in the python-2.7.2-r3 ebuild, and presumably the other ebuilds. The 2 places are in IUSE and RDEPEND. In RDEPEND it's... ############################################# ncurses? ( >=sys-libs/ncurses-5.2 readline? ( >=sys-libs/readline-4.1 ) ) ############################################# IANAD (I Am Not A Developer) but I read that fragment as 2 nested IF's... IF "ncurses" flag pull in sys-libs/ncurses IF "readline" flag pull in sys-libs/readline END IF END IF In other words, portage won't even try to pull in sys-libs/readline unless the "ncurses" flag is set. This seems to over-ride the IUSE line. I changed the line in /etc/portage/package.use to... dev-lang/python ncurses readline ssl xml ...and it pulls in sys-libs/readline. Problem found. I need to set both "ncurses" and "readline". Readline gets pulled in, and is now protected against depclean. Question, did the developers really intend to allow readline only if ncurses was present, or was this an error?
This looks really suspicious, and still applies to newest ebuilds. In any case, we should either move the dep, or update module conditional to match.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6c4829483f69298a2cd83f02a44ef24680ebb2c commit b6c4829483f69298a2cd83f02a44ef24680ebb2c Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2018-04-20 21:37:56 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2018-04-20 21:41:44 +0000 dev-lang/python: Move readline dep outside 'ncurses?' Move the dependency on readline to be independent of ncurses. Looking at the code, there is no apparent reason for putting it inside 'ncurses?' block. Furthermore, it is inconsistent with how the readline module build is controlled. Closes: https://bugs.gentoo.org/401651 dev-lang/python/python-2.7.14-r1.ebuild | 6 ++---- dev-lang/python/python-3.4.6-r1.ebuild | 6 ++---- dev-lang/python/python-3.5.5.ebuild | 6 ++---- dev-lang/python/python-3.6.5.ebuild | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-)