diff options
-rw-r--r-- | eclass/alternatives.eclass | 14 | ||||
-rw-r--r-- | eclass/python.eclass | 19 |
2 files changed, 22 insertions, 11 deletions
diff --git a/eclass/alternatives.eclass b/eclass/alternatives.eclass index 6a17a381306d..97f3369e0394 100644 --- a/eclass/alternatives.eclass +++ b/eclass/alternatives.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.7 2003/11/24 10:57:06 liquidx Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/alternatives.eclass,v 1.8 2004/01/18 01:32:35 liquidx Exp $ # Author : Alastair Tse <liquidx@gentoo.org> (03 Oct 2003) # Short Desc: Creates symlink to the latest version of multiple slotted @@ -58,10 +58,11 @@ alternatives_auto_makesym() { else myregex=${REGEX} fi - + # sort a space delimited string by converting it to a multiline list # and then run sort -r over it. - ALT="$(for i in $(echo ${myregex}); do echo $i; done | sort -r)" + # make sure we use ${ROOT} because otherwise stage-building will break + ALT="$(for i in $(echo ${ROOT}${myregex}); do echo ${i#${ROOT}}; done | sort -r)" alternatives_makesym ${SYMLINK} ${ALT} } @@ -69,9 +70,11 @@ alternatives_makesym() { local ALTERNATIVES="" local SYMLINK="" local alt pref + # usage: alternatives_makesym <resulting symlink> [alternative targets..] SYMLINK=$1 - pref=${ROOT:0:${#ROOT}-1} + # this trick removes the trailing / from ${ROOT} + pref=$(echo ${ROOT} | sed 's:/$::') shift ALTERNATIVES=$@ @@ -80,14 +83,15 @@ alternatives_makesym() { for alt in ${ALTERNATIVES}; do if [ -f "${pref}${alt}" ]; then - einfo "Linking ${alt} to ${pref}${SYMLINK}" #are files in same directory? if [ "${alt%/*}" = "${SYMLINK%/*}" ] then #yes; strip leading dirname from alt to create relative symlink + einfo "Linking ${alt} to ${pref}${SYMLINK} (relative)" ln -sf ${alt##*/} ${pref}${SYMLINK} else #no; keep absolute path + einfo "Linking ${alt} to ${pref}${SYMLINK} (absolute)" ln -sf ${pref}${alt} ${pref}${SYMLINK} fi break diff --git a/eclass/python.eclass b/eclass/python.eclass index 77b955b3dabc..c06168ced872 100644 --- a/eclass/python.eclass +++ b/eclass/python.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.12 2003/12/08 19:02:14 liquidx Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.13 2004/01/18 01:32:35 liquidx Exp $ # # Author: Alastair Tse <liquidx@gentoo.org> # @@ -136,6 +136,10 @@ python_mod_compile() { # python_mod_optimize ${ROOT}usr/share/codegen # python_mod_optimize() { + local myroot + # strip trailing slash + myroot=$(echo ${ROOT} | sed 's:/$::') + # allow compiling for older python versions if [ -n "${PYTHON_OVERRIDE_PYVER}" ]; then PYVER=${PYTHON_OVERRIDE_PYVER} @@ -151,8 +155,8 @@ python_mod_optimize() { fi ebegin "Byte compiling python modules for python-${PYVER} .." - python${PYVER} ${ROOT}usr/lib/python${PYVER}/compileall.py ${compileopts} $@ - python${PYVER} -O ${ROOT}usr/lib/python${PYVER}/compileall.py ${compileopts} $@ + python${PYVER} ${myroot}/usr/lib/python${PYVER}/compileall.py ${compileopts} $@ + python${PYVER} -O ${myroot}/usr/lib/python${PYVER}/compileall.py ${compileopts} $@ eend $? } @@ -166,14 +170,17 @@ python_mod_optimize() { # if they are, then it will remove their corresponding .pyc and .pyo # python_mod_cleanup() { - local SEARCH_PATH + local SEARCH_PATH myroot + + # strip trailing slash + myroot=$(echo ${ROOT} | sed 's:/$::') if [ $# -gt 0 ]; then for path in $@; do - SEARCH_PATH="${SEARCH_PATH} ${ROOT}${path#/}" + SEARCH_PATH="${SEARCH_PATH} ${myroot}/${path#/}" done else - for path in ${ROOT}usr/lib/python*/site-packages; do + for path in ${myroot}/usr/lib/python*/site-packages; do SEARCH_PATH="${SEARCH_PATH} ${path}" done fi |