Created attachment 321108 [details, diff] Patch to prepend $ROOT to ESELECT_DATA_PATH When running eselect with $ROOT set, it still finds modules in "/usr/share/eselect/modules", making it impossible to use a module inside $ROOT that is not also available in "/". Since the ebuild configures eselect with --datadir=${EPREFIX}/usr/share, the eselect script should be prepending $ROOT to ESELECT_DATA_PATH to find the correct modules in $EROOT.
ROOT is intended for specifying a target system where eselect should operate on. It's not meant to modify the path where eselect will find its own components. For example, there would be breakage if a) versions of /usr/bin/eselect and libraries in ${ROOT}/usr/share/eselect wouldn't match, or b) no eselect was installed in ${ROOT}.
That seems reasonable, but it means that any ebuild being emerged into a different $ROOT is not guaranteed to be able to run eselect correctly (if the relevant module is not installed in the host system). Would it be possible to do something like this instead? : ${ROOT=/} : ${ESELECT_ROOT=/} if [[ "$ROOT" != "$ESELECT_ROOT" ]] then export ESELECT_ROOT=$ROOT exec "${ROOT}/usr/bin/$(basename $0)" "$@" fi
eselect modules that are build-time dependencies should be installed in / but not in ROOT. But maybe you can elaborate what exact problem you are trying to solve?
I'm trying to build (and maintain) a cross compilation image using crossdev, via the emerge wrapper that it creates. I recently cross-emerged postgresql-server and the compilation failed because the emerge of postgresql-base had not managed to call "postgresql-config update" successfully (postgresql-config is a symlink to eselect); this was because I do not have eselect-postgresql installed in my build system, although it had been pulled into the cross-emerge target as a dependency. I then tried to manually run "ROOT=/path/to/image eselect postgresql update", which failed because eselect could not find the postgresql module. It may be that the answer is "you need to emerge eselect-postgresql in the build system", but since eselect is written in shell that seems like it shouldn't be necessary, especially when the necessary modules have already been pulled into the image automatically as dependencies. If ebuilds could differentiate between "build dependencies" and "required tools" then the current eselect behaviour would be fine, but AFAIK there is no way for the cross-emerge wrapper to cause packages to be emerged into /.
*** This bug has been marked as a duplicate of bug 317337 ***