From 9f145f2183b7361186d7d84006bfca752d34895d Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Fri, 11 Nov 2005 03:10:14 +0000 Subject: [PATCH] Prefix aware portage. Lot of changes such that the autotooling overries defaults instead of having /usr/lib/portage hardcoded all over the place. Down the line switch it over to pulling from a common point (making development simpler) svn path=/main/branches/prefix/; revision=2292 --- bin/archive-conf | 4 +- bin/chkcontents | 4 +- bin/clean_locks | 4 +- bin/dispatch-conf | 4 +- bin/dobin | 2 +- bin/doconfd | 2 +- bin/dodir | 2 +- bin/dodoc | 2 +- bin/doenvd | 2 +- bin/doexe | 4 +- bin/dohard | 2 +- bin/dohtml | 2 +- bin/doinfo | 2 +- bin/doinitd | 2 +- bin/doins | 4 +- bin/dojar | 2 +- bin/dolib | 2 +- bin/dolib.a | 2 +- bin/dolib.so | 2 +- bin/doman | 4 +- bin/domo | 2 +- bin/dopython | 4 +- bin/dosbin | 2 +- bin/dosed | 2 +- bin/dosym | 2 +- bin/ebuild | 4 +- bin/ebuild.sh | 52 ++++++-------- bin/emaint | 2 +- bin/emake | 2 +- bin/emerge | 20 +++--- bin/emerge-webrsync | 12 ++-- bin/env-update | 4 +- bin/env-update.sh | 8 +-- bin/etc-update | 8 +-- bin/find-requires | 2 +- bin/fix-db.py | 4 +- bin/fixdbentries | 2 +- bin/fixpackages | 4 +- bin/fowners | 2 +- bin/fperms | 2 +- bin/md5check.py | 4 +- bin/md5check.sh | 2 +- bin/mirror.py | 4 +- bin/newbin | 2 +- bin/newconfd | 2 +- bin/newdoc | 2 +- bin/newenvd | 2 +- bin/newexe | 2 +- bin/newinitd | 2 +- bin/newins | 2 +- bin/newlib.a | 2 +- bin/newlib.so | 2 +- bin/newman | 2 +- bin/newsbin | 2 +- bin/pkgmerge | 4 +- bin/pkgmerge.new | 4 +- bin/pkgname | 4 +- bin/portage_gpg_update.sh | 2 +- bin/portageq | 6 +- bin/prepall | 2 +- bin/prepalldocs | 2 +- bin/prepallinfo | 2 +- bin/prepallman | 2 +- bin/prepallstrip | 2 +- bin/prepinfo | 2 +- bin/preplib | 2 +- bin/preplib.so | 2 +- bin/prepman | 2 +- bin/prepstrip | 2 +- bin/quickpkg | 4 +- bin/regenworld | 4 +- bin/repoman | 38 +++++----- bin/xpak | 4 +- man/ebuild.1 | 2 +- man/ebuild.5 | 2 +- man/emerge.1 | 2 +- man/make.conf.5 | 4 +- pym/portage.py | 130 ++++++++++++++++++++-------------- pym/portage_const.py | 31 +++++--- pym/portage_const_autotool.py | 13 ++++ pym/portage_data.py | 3 +- pym/portage_exec.py | 3 +- pym/portage_locks.py | 3 +- 83 files changed, 274 insertions(+), 235 deletions(-) create mode 100644 pym/portage_const_autotool.py diff --git a/bin/archive-conf b/bin/archive-conf index 35fa2408c..bdd0968fb 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/archive-conf,v 1.7 2004/10/04 13:57:36 vapier Exp $ @@ -11,7 +11,7 @@ # import os, sys, string -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage, dispatch_conf diff --git a/bin/chkcontents b/bin/chkcontents index 96775fc51..c21966a43 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/chkcontents,v 1.11 2004/10/04 13:56:50 vapier Exp $ @@ -9,7 +9,7 @@ # the right files). import string, os.path, os, sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage def CONTENTScheck(path): diff --git a/bin/clean_locks b/bin/clean_locks index e374e8f93..254d42a95 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -1,10 +1,10 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/clean_locks,v 1.1 2004/09/26 10:44:31 carpaski Exp $ import os,sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage_locks diff --git a/bin/dispatch-conf b/bin/dispatch-conf index bc8077a63..2b777da00 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dispatch-conf,v 1.7.2.10 2005/05/12 15:20:22 jstubbs Exp $ @@ -15,7 +15,7 @@ from stat import * from random import * import os, shutil, sys, string, re, commands, atexit -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage, dispatch_conf diff --git a/bin/dobin b/bin/dobin index b1c6fcf97..0e3b3fe38 100755 --- a/bin/dobin +++ b/bin/dobin @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dobin,v 1.13 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/doconfd b/bin/doconfd index 652f43cd6..8a85bd4f5 100755 --- a/bin/doconfd +++ b/bin/doconfd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doconfd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/dodir b/bin/dodir index 1ea4d623a..3180fcad3 100755 --- a/bin/dodir +++ b/bin/dodir @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dodir,v 1.5 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dodoc b/bin/dodoc index 20628cedc..0caad88f0 100755 --- a/bin/dodoc +++ b/bin/dodoc @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dodoc,v 1.6.2.2 2005/05/15 11:04:21 jstubbs Exp $ diff --git a/bin/doenvd b/bin/doenvd index 8289fe9d3..6c92d344a 100755 --- a/bin/doenvd +++ b/bin/doenvd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doenvd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/doexe b/bin/doexe index aafef223e..f448eb9e4 100755 --- a/bin/doexe +++ b/bin/doexe @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doexe,v 1.10.2.1 2004/12/06 03:01:43 carpaski Exp $ @@ -15,7 +15,7 @@ fi for x in "$@" ; do if [ -L "${x}" ] ; then cp "${x}" "${T}" - mysrc="${T}"/`/usr/bin/basename "${x}"` + mysrc="${T}"/`basename "${x}"` elif [ -d "${x}" ] ; then echo "doexe: warning, skipping directory ${x}" continue diff --git a/bin/dohard b/bin/dohard index ce7d5d828..32163d1d9 100755 --- a/bin/dohard +++ b/bin/dohard @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dohard,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dohtml b/bin/dohtml index 963f4465a..1091e082c 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dohtml,v 1.14.2.1 2004/10/27 14:39:29 jstubbs Exp $ diff --git a/bin/doinfo b/bin/doinfo index 83f639b01..1ee9be1c6 100755 --- a/bin/doinfo +++ b/bin/doinfo @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doinfo,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/doinitd b/bin/doinitd index 4f5885ec6..3665baa69 100755 --- a/bin/doinitd +++ b/bin/doinitd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doinitd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/doins b/bin/doins index bf51463ab..1c5471893 100755 --- a/bin/doins +++ b/bin/doins @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doins,v 1.7.2.2 2004/12/17 22:25:13 carpaski Exp $ @@ -33,7 +33,7 @@ fi for x in "$@" ; do if [ -L "$x" ] ; then cp "$x" "${T}" - mysrc="${T}/$(/usr/bin/basename "${x}")" + mysrc="${T}/$(basename "${x}")" elif [ -d "$x" ] ; then if [ "${DOINSRECUR}" == "n" ] ; then continue diff --git a/bin/dojar b/bin/dojar index 2bbc5ea2e..6f30332b7 100755 --- a/bin/dojar +++ b/bin/dojar @@ -1,4 +1,4 @@ -#!/bin/sh +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dojar,v 1.8 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dolib b/bin/dolib index 5424446ab..b0189b744 100755 --- a/bin/dolib +++ b/bin/dolib @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib,v 1.8.2.2 2005/01/12 02:07:15 carpaski Exp $ diff --git a/bin/dolib.a b/bin/dolib.a index 73392ab3e..b21f0c120 100755 --- a/bin/dolib.a +++ b/bin/dolib.a @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib.a,v 1.8 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/dolib.so b/bin/dolib.so index e130ecd42..52d693546 100755 --- a/bin/dolib.so +++ b/bin/dolib.so @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib.so,v 1.12 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/doman b/bin/doman index a1a2a9754..07a6793b1 100755 --- a/bin/doman +++ b/bin/doman @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doman,v 1.13.2.2 2005/07/29 05:55:34 vapier Exp $ @@ -33,7 +33,7 @@ for x in "$@" ; do mandir=${i18n}man${suffix:0:1} - if echo ${mandir} | egrep -q 'man[0-9n](|f|p|pm)$' -; then + if echo ${mandir} | @EGREP@ -q 'man[0-9n](|f|p|pm)$' -; then if [ -s "${x}" ] ; then if [ ! -d "${D}${BASE}/man/${mandir}" ] ; then install -d "${D}${BASE}/man/${mandir}" diff --git a/bin/domo b/bin/domo index d6cc0826a..a1b15a1f7 100755 --- a/bin/domo +++ b/bin/domo @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/domo,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dopython b/bin/dopython index f058282b1..776ad6108 100755 --- a/bin/dopython +++ b/bin/dopython @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dopython,v 1.8 2004/10/04 13:56:50 vapier Exp $ import sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path from sys import * import portage diff --git a/bin/dosbin b/bin/dosbin index 89c469523..66fc911f7 100755 --- a/bin/dosbin +++ b/bin/dosbin @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosbin,v 1.11 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dosed b/bin/dosed index 76cd46898..428feb0cf 100755 --- a/bin/dosed +++ b/bin/dosed @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosed,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dosym b/bin/dosym index fd57a45e8..c41045fdd 100755 --- a/bin/dosym +++ b/bin/dosym @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosym,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/ebuild b/bin/ebuild index 0ddeaa6bb..0ab526983 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $ @@ -19,7 +19,7 @@ if "merge" in pargs: os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto" os.environ["PORTAGE_CALLER"]="ebuild" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage, portage_util, portage_const diff --git a/bin/ebuild.sh b/bin/ebuild.sh index be4486182..aefe8adba 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1,9 +1,10 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.201.2.42 2005/08/20 17:24:30 jstubbs Exp $ -export SANDBOX_PREDICT="${SANDBOX_PREDICT}:/proc/self/maps:/dev/console:/usr/lib/portage/pym:/dev/random" + +export SANDBOX_PREDICT="${SANDBOX_PREDICT}:/proc/self/maps:/dev/console:@PORTAGE_BASE@/pym:/dev/random" export SANDBOX_WRITE="${SANDBOX_WRITE}:/dev/shm:${PORTAGE_TMPDIR}" export SANDBOX_READ="${SANDBOX_READ}:/dev/shm:${PORTAGE_TMPDIR}" @@ -47,17 +48,10 @@ fi [ ! -z "$OCC" ] && export CC="$OCC" [ ! -z "$OCXX" ] && export CXX="$OCXX" -export PATH="/sbin:/usr/sbin:/usr/lib/portage/bin:/bin:/usr/bin:${ROOTPATH}" +export PATH="${PREFIX}/sbin:${PREFIX}/usr/sbin:@PORTAGE_BASE@/bin:${PREFIX}/bin:${PREFIX}/usr/bin:${ROOTPATH}" [ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH" -if [ -e /etc/init.d/functions.sh ]; then - source /etc/init.d/functions.sh &>/dev/null -elif [ -e /etc/rc.d/config/functions ]; then - source /etc/rc.d/config/functions &>/dev/null -else - #Mac OS X - source /usr/lib/portage/bin/functions.sh &>/dev/null -fi +source @PORTAGE_BASE@/bin/isolated-functions.sh &>/dev/null # the sandbox is disabled by default except when overridden in the relevant stages export SANDBOX_ON="0" @@ -195,7 +189,7 @@ has_version() { fi # return shell-true/shell-false if exists. # Takes single depend-type atoms. - if /usr/lib/portage/bin/portageq 'has_version' "${ROOT}" "$1"; then + if @PORTAGE_BASE@/bin/portageq 'has_version' "${ROOT}" "$1"; then return 0 else return 1 @@ -206,7 +200,7 @@ portageq() { if [ "${EBUILD_PHASE}" == "depend" ]; then die "portageq calls are not allowed in the global scope" fi - /usr/lib/portage/bin/portageq "$@" + @PORTAGE_BASE@/bin/portageq "$@" } @@ -221,7 +215,7 @@ best_version() { fi # returns the best/most-current match. # Takes single depend-type atoms. - /usr/lib/portage/bin/portageq 'best_version' "${ROOT}" "$1" + @PORTAGE_BASE@/bin/portageq 'best_version' "${ROOT}" "$1" } use_with() { @@ -1210,13 +1204,13 @@ dyn_install() { rm -f "${D}/usr/share/info/dir.gz" fi - if hasq multilib-strict ${FEATURES} && [ -x /usr/bin/file -a -x /usr/bin/find -a \ + if hasq multilib-strict ${FEATURES} && [ -x file -a -x find -a \ -n "${MULTILIB_STRICT_DIRS}" -a -n "${MULTILIB_STRICT_DENY}" ]; then MULTILIB_STRICT_EXEMPT=${MULTILIB_STRICT_EXEMPT:-"(perl5|gcc|gcc-lib)"} for dir in ${MULTILIB_STRICT_DIRS}; do [ -d "${D}/${dir}" ] || continue - for file in $(find ${D}/${dir} -type f | egrep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do - file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" && die "File ${file} matches a file type that is not allowed in ${dir}" + for file in $(find ${D}/${dir} -type f | @EGREP@ -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do + file ${file} | @EGREP@ -q "${MULTILIB_STRICT_DENY}" && die "File ${file} matches a file type that is not allowed in ${dir}" done done fi @@ -1326,7 +1320,7 @@ dyn_preinst() { if useq selinux; then # only attempt to label if setfiles is executable # and 'context' is available on selinuxfs. - if [ -f /selinux/context -a -x /usr/sbin/setfiles ]; then + if [ -f /selinux/context -a -x ${PREFIX}/usr/sbin/setfiles ]; then echo ">>> Setting SELinux security labels" if [ -f ${POLICYDIR}/file_contexts/file_contexts ]; then cp -f "${POLICYDIR}/file_contexts/file_contexts" "${T}" @@ -1335,7 +1329,7 @@ dyn_preinst() { fi addwrite /selinux/context - /usr/sbin/setfiles -r "${IMAGE}" "${T}/file_contexts" "${IMAGE}" \ + ${PREFIX}/usr/sbin/setfiles -r "${IMAGE}" "${T}/file_contexts" "${IMAGE}" \ || die "Failed to set SELinux security labels." else # nonfatal, since merging can happen outside a SE kernel @@ -1710,13 +1704,13 @@ if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "setup" ]; then fi if hasq distcc ${FEATURES} &>/dev/null; then - if [ -d /usr/lib/distcc/bin ]; then + if [ -d ${PREFIX}/usr/lib/distcc/bin ]; then #We can enable distributed compile support if [ -z "${PATH/*distcc*/}" ]; then # Remove the other reference. remove_path_entry "distcc" fi - export PATH="/usr/lib/distcc/bin:${PATH}" + export PATH="${PREFIX}/usr/lib/distcc/bin:${PATH}" [ ! -z "${DISTCC_LOG}" ] && addwrite "$(dirname ${DISTCC_LOG})" elif which distcc &>/dev/null; then export CC="distcc $CC" @@ -1731,13 +1725,13 @@ if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "setup" ]; then remove_path_entry "ccache" fi - if [ -d /usr/lib/ccache/bin ]; then - export PATH="/usr/lib/ccache/bin:${PATH}" - elif [ -d /usr/bin/ccache ]; then - export PATH="/usr/bin/ccache:${PATH}" + if [ -d ${PREFIX}/usr/lib/ccache/bin ]; then + export PATH="${PREFIX}/usr/lib/ccache/bin:${PATH}" + elif [ -d ${PREFIX}/usr/bin/ccache ]; then + export PATH="${PREFIX}/usr/bin/ccache:${PATH}" fi - [ -z "${CCACHE_DIR}" ] && export CCACHE_DIR="/var/tmp/ccache" + [ -z "${CCACHE_DIR}" ] && export CCACHE_DIR="@PREFIX/var/tmp/ccache" addread "${CCACHE_DIR}" addwrite "${CCACHE_DIR}" @@ -1746,7 +1740,7 @@ if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "setup" ]; then fi # XXX: Load up the helper functions. -# for X in /usr/lib/portage/bin/functions/*.sh; do +# for X in @PORTAGE_BASE@/bin/functions/*.sh; do # source ${X} || die "Failed to source ${X}" # done @@ -1773,7 +1767,7 @@ unset x # Turn of extended glob matching so that g++ doesn't get incorrectly matched. shopt -u extglob -QA_INTERCEPTORS="javac java-config python python-config perl grep egrep fgrep sed gcc g++ cc bash awk nawk gawk pkg-config" +QA_INTERCEPTORS="javac java-config python python-config perl grep @EGREP@ fgrep sed gcc g++ cc bash awk nawk gawk pkg-config" # level the QA interceptors if we're in depend if hasq "depend" "$@"; then for BIN in ${QA_INTERCEPTORS}; do @@ -1983,7 +1977,7 @@ done if [ "$myarg" != "clean" ]; then # Save current environment and touch a success file. (echo for success) umask 002 - set | egrep -v "^SANDBOX_" > "${T}/environment" 2>/dev/null + set | @EGREP@ -v "^SANDBOX_" > "${T}/environment" 2>/dev/null chown portage:portage "${T}/environment" &>/dev/null chmod g+w "${T}/environment" &>/dev/null fi diff --git a/bin/emaint b/bin/emaint index b48d417c3..9e0f324d9 100755 --- a/bin/emaint +++ b/bin/emaint @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O import sys from copy import copy diff --git a/bin/emake b/bin/emake index efdc0a71a..02e38523f 100755 --- a/bin/emake +++ b/bin/emake @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/emake,v 1.9.2.1 2005/05/18 15:19:52 jstubbs Exp $ diff --git a/bin/emerge b/bin/emerge index aaa288ec4..b7a47eef0 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1,11 +1,11 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.38 2005/08/13 17:25:26 ferringb Exp $ import os,sys os.environ["PORTAGE_CALLER"]="emerge" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage @@ -1999,7 +1999,7 @@ class depgraph: mynewargv += [myarg] else: mynewargv += [arg] - os.execv("/usr/lib/portage/bin/emerge", mynewargv) + os.execv("@PORTAGE_BASE@/bin/emerge", mynewargv) if ("--pretend" not in myopts) and ("--fetchonly" not in myopts) and ("--fetch-all-uri" not in myopts): emergelog(" ::: completed emerge ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[2]+" to "+x[1]) @@ -2267,7 +2267,7 @@ def chk_updated_info_files(retval): infodirs.extend(string.split(portage.settings["INFODIR"], ":")) print - if os.path.exists("/usr/bin/install-info"): + if os.path.exists("install-info"): regen_infodirs=[] for z in infodirs: if z=='': @@ -2315,7 +2315,7 @@ def chk_updated_info_files(retval): for x in os.listdir(inforoot): if (x[0] == ".") or (x in ["dir","dir.old"]) or (os.path.isdir(inforoot+"/"+x)): continue - myso=commands.getstatusoutput("LANG=C LANGUAGE=C /usr/bin/install-info --dir-file="+inforoot+"/dir "+inforoot+"/"+x)[1] + myso=commands.getstatusoutput("LANG=C LANGUAGE=C install-info --dir-file="+inforoot+"/dir "+inforoot+"/"+x)[1] existsstr="already exists, for file `" if myso!="": if re.search(existsstr,myso): @@ -2401,8 +2401,8 @@ if myaction in ["sync","rsync","metadata"] and (not "--help" in myopts): updatecache_flg = True tmpservertimestampfile = None elif syncuri[:8]=="rsync://": - if not os.path.exists("/usr/bin/rsync"): - print "!!! /usr/bin/rsync does not exist, so rsync support is disabled." + if not os.path.exists("rsync"): + print "!!! rsync does not exist, so rsync support is disabled." print "!!! Type \"emerge net-misc/rsync\" to enable rsync support." sys.exit(1) mytimeout=180 @@ -2452,7 +2452,7 @@ if myaction in ["sync","rsync","metadata"] and (not "--help" in myopts): if portage.settings.has_key("RSYNC_RATELIMIT"): rsync_flags.append("--bwlimit="+portage.settings["RSYNC_RATELIMIT"]) - rsynccommand = "/usr/bin/rsync " + string.join(rsync_flags, " ") + rsynccommand = "rsync " + string.join(rsync_flags, " ") servertimestampdir = portage.settings.depcachedir+"/" servertimestampfile = portage.settings.depcachedir+"/timestamp.chk" @@ -2602,8 +2602,8 @@ if myaction in ["sync","rsync","metadata"] and (not "--help" in myopts): print sys.exit(exitcode) elif syncuri[:6]=="cvs://": - if not os.path.exists("/usr/bin/cvs"): - print "!!! /usr/bin/cvs does not exist, so rsync support is disabled." + if not os.path.exists("cvs"): + print "!!! cvs does not exist, so rsync support is disabled." print "!!! Type \"emerge dev-util/cvs\" to enable CVS support." sys.exit(1) cvsroot=syncuri[6:] diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 9e2a44af2..d65c15617 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -1,15 +1,15 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/Attic/emerge-webrsync,v 1.8.2.4 2005/02/26 11:22:38 carpaski Exp $ # Author: Karl Trygve Kalleberg # Rewritten from the old, Perl-based emerge-webrsync script -GENTOO_MIRRORS="${GENTOO_MIRRORS} $(/usr/lib/portage/bin/portageq gentoo_mirrors)" -PORTDIR="$(/usr/lib/portage/bin/portageq portdir)" -FETCHCOMMAND="$(/usr/lib/portage/bin/portageq envvar FETCHCOMMAND)" -USERLAND="$(/usr/lib/portage/bin/portageq envvar USERLAND)" -DISTDIR="$(/usr/lib/portage/bin/portageq envvar PORTAGE_TMPDIR)/emerge-webrsync" +GENTOO_MIRRORS="${GENTOO_MIRRORS} $(@PORTAGE_BASE@/bin/portageq gentoo_mirrors)" +PORTDIR="$(@PORTAGE_BASE@/bin/portageq portdir)" +FETCHCOMMAND="$(@PORTAGE_BASE@/bin/portageq envvar FETCHCOMMAND)" +USERLAND="$(@PORTAGE_BASE@/bin/portageq envvar USERLAND)" +DISTDIR="$(@PORTAGE_BASE@/bin/portageq envvar PORTAGE_TMPDIR)/emerge-webrsync" if [ ! -d $DISTDIR ] ; then mkdir -p $DISTDIR diff --git a/bin/env-update b/bin/env-update index 1cd55cb89..18074603b 100755 --- a/bin/env-update +++ b/bin/env-update @@ -1,11 +1,11 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/env-update,v 1.9 2004/10/04 13:56:50 vapier Exp $ import os,sys os.environ["PORTAGE_CALLER"] = "env-update" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage portage.env_update() diff --git a/bin/env-update.sh b/bin/env-update.sh index ff7fa09d2..90e37000d 100755 --- a/bin/env-update.sh +++ b/bin/env-update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/env-update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ @@ -197,9 +197,9 @@ unset my_envd_LDPATH echo ">>> Regenerating ${ROOT}etc/ld.so.cache..." if [[ ${MAKELINKS} -eq 0 ]] ; then - (cd / ; /sbin/ldconfig -X -r ${ROOT} >& /dev/null) + (cd / ; ${PREFIX}/sbin/ldconfig -X -r ${ROOT} >& /dev/null) else - (cd / ; /sbin/ldconfig -r ${ROOT} >& /dev/null) + (cd / ; ${PREFIX}/sbin/ldconfig -r ${ROOT} >& /dev/null) fi cat << EOF > ${PROFILEENV} @@ -218,4 +218,4 @@ cat << EOF > ${CSHENV} $(set | grep '^my_envd_' | sed -e 's:^my_envd_\([[:alpha:]_][[:alnum:]_]*\)=:setenv \1 :') EOF -[[ ${ROOT} == / ]] && /sbin/depscan.sh +[[ ${ROOT} == / ]] && ${PREFIX}/sbin/depscan.sh diff --git a/bin/etc-update b/bin/etc-update index ce5ac568b..f7a289ac9 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: etc-update 2221 2005-11-01 01:32:07Z vapier $ @@ -65,7 +65,7 @@ function scan() { if [ ! -e "${rpath}/${rfile}" ] || [ ! -e "${rpath}/${rfile:10}" ]; then MATCHES=0 else - diff -Bbua ${rpath}/${rfile} ${rpath}/${rfile:10} | egrep '^[+-]' | egrep -v '^[+-][\t ]*#|^--- |^\+\+\+ ' | egrep -qv '^[-+][\t ]*$' + diff -Bbua ${rpath}/${rfile} ${rpath}/${rfile:10} | @EGREP@ '^[+-]' | @EGREP@ -v '^[+-][\t ]*#|^--- |^\+\+\+ ' | @EGREP@ -qv '^[-+][\t ]*$' MATCHES=$? fi elif [[ -z `diff -Nua ${rpath}/${rfile} ${rpath}/${rfile:10}| @@ -379,8 +379,8 @@ rm -rf ${TMP} 2> /dev/null mkdir ${TMP} || die "failed mkdir command!" 1 # I need the CONFIG_PROTECT value -CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT) -CONFIG_PROTECT_MASK=$(/usr/lib/portage/bin/portageq envvar CONFIG_PROTECT_MASK) +CONFIG_PROTECT=$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROTECT) +CONFIG_PROTECT_MASK=$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROTECT_MASK) # load etc-config's configuration EU_AUTOMERGE=`get_config eu_automerge` diff --git a/bin/find-requires b/bin/find-requires index 5f413f564..5e5742cdb 100755 --- a/bin/find-requires +++ b/bin/find-requires @@ -10,7 +10,7 @@ ulimit -c 0 filelist=`sed "s/['\"]/\\\&/g"` exelist=`echo $filelist | $XARGS file | grep ":.*executable" | cut -d: -f1 ` -scriptlist=`echo $filelist | $XARGS file | egrep ":.* (commands|script) " | cut -d: -f1 ` +scriptlist=`echo $filelist | $XARGS file | @EGREP@ ":.* (commands|script) " | cut -d: -f1 ` liblist=`echo $filelist | $XARGS file | grep ":.*shared object" | cut -d : -f1 ` for f in $exelist; do diff --git a/bin/fix-db.py b/bin/fix-db.py index 3dcd1ca68..7cf15b12d 100755 --- a/bin/fix-db.py +++ b/bin/fix-db.py @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fix-db.py,v 1.8 2004/10/11 04:01:00 jstubbs Exp $ import os,sys,re -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path from stat import * from output import * diff --git a/bin/fixdbentries b/bin/fixdbentries index 884155a7c..6b8640172 100755 --- a/bin/fixdbentries +++ b/bin/fixdbentries @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fixdbentries,v 1.3 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/fixpackages b/bin/fixpackages index 9f44f8250..85b9ec7c3 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -1,11 +1,11 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fixpackages,v 1.6 2004/10/04 13:56:50 vapier Exp $ import os,sys os.environ["PORTAGE_CALLER"]="fixpackages" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage diff --git a/bin/fowners b/bin/fowners index c2aab7181..06ec6d4d3 100755 --- a/bin/fowners +++ b/bin/fowners @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fowners,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/fperms b/bin/fperms index 8d60983e5..efb159ce5 100755 --- a/bin/fperms +++ b/bin/fperms @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fperms,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/md5check.py b/bin/md5check.py index 96a16d3ac..c72fc1b8f 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.py,v 1.4 2004/10/10 10:07:20 carpaski Exp $ @@ -6,7 +6,7 @@ import os,sys,string os.environ["PORTAGE_CALLER"]="mirror" os.environ["FEATURES"]="mirror cvs" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage from threading import * diff --git a/bin/md5check.sh b/bin/md5check.sh index 6ba5efd3d..6c229f70b 100755 --- a/bin/md5check.sh +++ b/bin/md5check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/mirror.py b/bin/mirror.py index 75579f37d..278ae7c2b 100755 --- a/bin/mirror.py +++ b/bin/mirror.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/mirror.py,v 1.3 2004/10/10 10:07:20 carpaski Exp $ @@ -9,7 +9,7 @@ maxsems=5 import os,sys,string os.environ["PORTAGE_CALLER"]="mirror" os.environ["FEATURES"]="mirror cvs" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage from threading import * diff --git a/bin/newbin b/bin/newbin index c8a67466b..d8c005679 100755 --- a/bin/newbin +++ b/bin/newbin @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newbin,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newconfd b/bin/newconfd index 40c021392..5fc6971ef 100755 --- a/bin/newconfd +++ b/bin/newconfd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newconfd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newdoc b/bin/newdoc index 145444843..b19cff1d6 100755 --- a/bin/newdoc +++ b/bin/newdoc @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newdoc,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newenvd b/bin/newenvd index 62640b851..a5ec9f9bb 100755 --- a/bin/newenvd +++ b/bin/newenvd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newenvd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newexe b/bin/newexe index 2e3321a9f..9edd296e7 100755 --- a/bin/newexe +++ b/bin/newexe @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newexe,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newinitd b/bin/newinitd index b1bc0a30c..ef6f2bcf1 100755 --- a/bin/newinitd +++ b/bin/newinitd @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newinitd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newins b/bin/newins index 6ec2f6d14..b549a29d7 100755 --- a/bin/newins +++ b/bin/newins @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newins,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newlib.a b/bin/newlib.a index d704bd321..ebd3c0eca 100755 --- a/bin/newlib.a +++ b/bin/newlib.a @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newlib.a,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newlib.so b/bin/newlib.so index 9df2a4d39..99e139509 100755 --- a/bin/newlib.so +++ b/bin/newlib.so @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newlib.so,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newman b/bin/newman index 5bb6ebdf9..fb47a8854 100755 --- a/bin/newman +++ b/bin/newman @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newman,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newsbin b/bin/newsbin index c361ea39a..4f4aec65d 100755 --- a/bin/newsbin +++ b/bin/newsbin @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newsbin,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/pkgmerge b/bin/pkgmerge index 2cf9b5d35..137b11d43 100755 --- a/bin/pkgmerge +++ b/bin/pkgmerge @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgmerge,v 1.8 2004/10/04 13:56:50 vapier Exp $ import sys,os,string -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage,xpak diff --git a/bin/pkgmerge.new b/bin/pkgmerge.new index 3abcb88c8..46b6f03ea 100755 --- a/bin/pkgmerge.new +++ b/bin/pkgmerge.new @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgmerge.new,v 1.7 2004/10/04 13:56:50 vapier Exp $ import os,string,sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage,xpak diff --git a/bin/pkgname b/bin/pkgname index c2c07525c..9a5314830 100755 --- a/bin/pkgname +++ b/bin/pkgname @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgname,v 1.8 2004/10/04 13:56:50 vapier Exp $ import sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage diff --git a/bin/portage_gpg_update.sh b/bin/portage_gpg_update.sh index 7abbbda4f..f3f76f21f 100755 --- a/bin/portage_gpg_update.sh +++ b/bin/portage_gpg_update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/portage_gpg_update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/portageq b/bin/portageq index f85274baf..17a81a223 100755 --- a/bin/portageq +++ b/bin/portageq @@ -1,11 +1,11 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/portageq,v 1.13.2.1 2005/04/12 12:23:41 jstubbs Exp $ import sys, os os.environ["PORTAGE_CALLER"] = "portageq" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import portage,types,string @@ -192,7 +192,7 @@ def distdir(argv): def envvar(argv): """ Returns a specific environment variable as exists prior to ebuild.sh. - Similar to: emerge --verbose --info | egrep '^=' + Similar to: emerge --verbose --info | @EGREP@ '^=' """ print portage.settings[argv[0]] diff --git a/bin/prepall b/bin/prepall index ba3db9d8e..50d3b2787 100755 --- a/bin/prepall +++ b/bin/prepall @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepall,v 1.10 2004/10/14 23:31:33 ferringb Exp $ diff --git a/bin/prepalldocs b/bin/prepalldocs index 6c540a2fd..64aca6222 100755 --- a/bin/prepalldocs +++ b/bin/prepalldocs @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepalldocs,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallinfo b/bin/prepallinfo index 5875285de..2d6b9e609 100755 --- a/bin/prepallinfo +++ b/bin/prepallinfo @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallinfo,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallman b/bin/prepallman index bc094fa05..456ee004b 100755 --- a/bin/prepallman +++ b/bin/prepallman @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallman,v 1.10 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallstrip b/bin/prepallstrip index cbec1c644..8d876ff66 100755 --- a/bin/prepallstrip +++ b/bin/prepallstrip @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallstrip,v 1.12 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepinfo b/bin/prepinfo index 3e85528cb..62d911f37 100755 --- a/bin/prepinfo +++ b/bin/prepinfo @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepinfo,v 1.6.2.1 2005/05/29 12:40:08 jstubbs Exp $ diff --git a/bin/preplib b/bin/preplib index 53fd2018d..c1bc2b419 100755 --- a/bin/preplib +++ b/bin/preplib @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/preplib,v 1.7.2.1 2005/01/02 09:36:02 jstubbs Exp $ diff --git a/bin/preplib.so b/bin/preplib.so index cbcb66b29..99d548dc1 100755 --- a/bin/preplib.so +++ b/bin/preplib.so @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/preplib.so,v 1.10.2.1 2004/12/06 03:01:43 carpaski Exp $ diff --git a/bin/prepman b/bin/prepman index 14795d954..46435cdf0 100755 --- a/bin/prepman +++ b/bin/prepman @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepman,v 1.10.2.3 2005/05/29 12:40:08 jstubbs Exp $ diff --git a/bin/prepstrip b/bin/prepstrip index eadc5b245..724f531cf 100755 --- a/bin/prepstrip +++ b/bin/prepstrip @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepstrip,v 1.23.2.3 2005/08/15 02:58:20 vapier Exp $ diff --git a/bin/quickpkg b/bin/quickpkg index caa5ce0df..a02e66e5e 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -1,4 +1,4 @@ -#!/bin/bash +#!@BASH@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/quickpkg,v 1.13.2.6 2005/08/10 22:08:48 vapier Exp $ @@ -37,7 +37,7 @@ fi export PKGDIR=$(portageq envvar PKGDIR) export PORTAGE_TMPDIR=$(portageq envvar PORTAGE_TMPDIR) -source /sbin/functions.sh +source @PORTAGE_BASE@/bin/isolated-functions.sh # here we make a package given a little info # $1 = package-name w/version diff --git a/bin/regenworld b/bin/regenworld index 19650d23e..ac8ff2362 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -1,10 +1,10 @@ -#!/usr/bin/python +#!@PYTHON@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/regenworld,v 1.10.2.1 2005/01/11 03:40:57 carpaski Exp $ import sys -sys.path.insert(0, "/usr/lib/portage/pym") +sys.path.insert(0, "@PORTAGE_BASE@/pym") import portage, string, re diff --git a/bin/repoman b/bin/repoman index 49578ad59..f64309691 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/repoman,v 1.98.2.23 2005/06/18 01:00:43 vapier Exp $ @@ -10,7 +10,7 @@ import os,sys,shutil exename=os.path.basename(sys.argv[0]) os.environ["PORTAGE_CALLER"]="repoman" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path version="1.2" allowed_filename_chars="a-zA-Z0-9._-+:" @@ -878,9 +878,9 @@ for x in scanlist: if mymode=="fix": if "--pretend" in myoptions: print "You will need to run:" - print " /usr/sbin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest" + print " "+"portage_const.PORTAGE_BASE+"/usr/sbin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest" else: - retval=os.system("/usr/sbin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest") + retval=os.system(portage_const.PORTAGE_BASE+"/usr/sbin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest") if retval: print "!!! Exiting on ebuild digest (shell) error code:",retval sys.exit(retval) @@ -1055,7 +1055,7 @@ for x in scanlist: fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1])) # this check needs work, it won't catch (\ndie) - if not os.system("egrep '^[^#]*\([^)]*\' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"): + if not os.system("@EGREP@ '^[^#]*\([^)]*\' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"): stats["ebuild.nesteddie"]=stats["ebuild.nesteddie"]+1 fails["ebuild.nesteddie"].append(x+"/"+y+".ebuild") # uselist checks - global @@ -1317,10 +1317,10 @@ else: if myautoadd: print ">>> Auto-Adding missing digests..." if "--pretend" in myoptions: - print "(/usr/bin/cvs add "+string.join(myautoadd)+")" + print "(cvs add "+string.join(myautoadd)+")" retval=0 else: - retval=os.system("/usr/bin/cvs add "+string.join(myautoadd)) + retval=os.system("cvs add "+string.join(myautoadd)) if retval: print "!!! Exiting on cvs (shell) error code:",retval sys.exit(retval) @@ -1341,10 +1341,10 @@ else: for x in mymissing: print " ",x if "--pretend" in myoptions: - print "(/usr/bin/cvs -q up "+string.join(mymissing)+")" + print "(cvs -q up "+string.join(mymissing)+")" retval=0 else: - retval=os.system("/usr/bin/cvs -q up "+string.join(mymissing)) + retval=os.system("cvs -q up "+string.join(mymissing)) if retval: print "!!! Exiting on cvs (shell) error code:",retval sys.exit(retval) @@ -1353,7 +1353,7 @@ else: retval=["",""] if isCvs: print "Performing a "+green("cvs -n up")+" with a little magic grep to check for updates." - retval=getstatusoutput("/usr/bin/cvs -n up 2>&1 | egrep '^[^\?] .*' | egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'") + retval=getstatusoutput("cvs -n up 2>&1 | @EGREP@ '^[^\?] .*' | @EGREP@ -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'") mylines=string.split(retval[1], "\n") myupdates=[] @@ -1372,10 +1372,10 @@ else: if myupdates: print green("Fetching trivial updates...") if "--pretend" in myoptions: - print "(/usr/bin/cvs up "+string.join(myupdates)+")" + print "(cvs up "+string.join(myupdates)+")" retval=0 else: - retval=os.system("/usr/bin/cvs up "+string.join(myupdates)) + retval=os.system("cvs up "+string.join(myupdates)) if retval!=0: print "!!! cvs exited with an error. Terminating." sys.exit(retval) @@ -1399,7 +1399,7 @@ else: headerstring="'\$(Header|Id)" headerstring+=".*\$'" for myfile in myupdates: - myout=getstatusoutput("egrep -q "+headerstring+" "+myfile) + myout=getstatusoutput("@EGREP@ -q "+headerstring+" "+myfile) if myout[0]==0: myheaders.append(myfile) @@ -1438,10 +1438,10 @@ else: print if "--pretend" in myoptions: - print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")" + print "(cvs -q commit -F "+commitmessagefile+")" retval=0 else: - retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile) + retval=os.system("cvs -q commit -F "+commitmessagefile) if retval: print "!!! Exiting on cvs (shell) error code:",retval sys.exit(retval) @@ -1494,13 +1494,13 @@ else: sys.exit(1) if "--pretend" in myoptions: - print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")" + print "(cvs -q commit -F "+commitmessagefile+")" else: mymsg=open(commitmessagefile,"w") mymsg.write(commitmessage) mymsg.write("\n (Unsigned Manifest commit)") mymsg.close() - retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile) + retval=os.system("cvs -q commit -F "+commitmessagefile) if retval: print "!!! Exiting on cvs (shell) error code:",retval sys.exit(retval) @@ -1542,13 +1542,13 @@ else: time.sleep(3) if "--pretend" in myoptions: - print "(/usr/bin/cvs -q commit -F "+commitmessagefile+")" + print "(cvs -q commit -F "+commitmessagefile+")" else: mymsg=open(commitmessagefile,"w") mymsg.write(commitmessage) mymsg.write("\n (Signed Manifest commit)") mymsg.close() - retval=os.system("/usr/bin/cvs -q commit -F "+commitmessagefile) + retval=os.system("cvs -q commit -F "+commitmessagefile) if retval: print "!!! Exiting on cvs (shell) error code:",retval sys.exit(retval) diff --git a/bin/xpak b/bin/xpak index 5becde25d..8e4fec656 100755 --- a/bin/xpak +++ b/bin/xpak @@ -1,4 +1,4 @@ -#!/usr/bin/python -O +#!@PYTHON@ -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/xpak,v 1.10 2004/10/04 13:56:50 vapier Exp $ @@ -8,7 +8,7 @@ if len(sys.argv)!=3: print "xpak: expecting three arguments." sys.exit(1) -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path = ["@PORTAGE_BASE@/pym"]+sys.path import xpak xpak.xpak(sys.argv[1],sys.argv[2]) diff --git a/man/ebuild.1 b/man/ebuild.1 index 742cf6f2e..f82d1531f 100644 --- a/man/ebuild.1 +++ b/man/ebuild.1 @@ -178,4 +178,4 @@ in make.globals. .TP The \fI/usr/sbin/ebuild.sh\fR script. .TP -The helper apps in \fI/usr/lib/portage/bin\fR. +The helper apps in \fI@PORTAGE_BASE@/bin\fR. diff --git a/man/ebuild.5 b/man/ebuild.5 index 59c202d9e..1d497a6d3 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -822,7 +822,7 @@ Mike Frysinger .TP The \fI/usr/sbin/ebuild.sh\fR script. .TP -The helper apps in \fI/usr/lib/portage/bin\fR. +The helper apps in \fI@PORTAGE_BASE@/bin\fR. .TP \fB/etc/make.conf\fR Contains variables for the build\-process and overwrites those in make.defaults. diff --git a/man/emerge.1 b/man/emerge.1 index dc79d6a14..c6eb38815 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -542,7 +542,7 @@ this file\fR. .BR make.conf (5), .BR portage (5) .LP -A number of helper applications reside in \fI/usr/lib/portage/bin\fR. +A number of helper applications reside in \fI@PORTAGE_BASE@bin\fR. .LP The \fBapp\-portage/gentoolkit\fR package contains useful scripts such as \fBequery\fR (a package query tool). diff --git a/man/make.conf.5 b/man/make.conf.5 index 220077b80..7dd0f1117 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -146,7 +146,7 @@ Portage uses lockfiles to ensure competing instances don't clobber each other's files. This feature is enabled by default but may cause heartache on less intelligent remote filesystems like NFSv2 and some strangely configured Samba server (oplocks off, NFS re-export). A tool -/usr/lib/portage/bin/clean_locks exists to help handle lock issues +@PORTAGE_BASE@bin/clean_locks exists to help handle lock issues when a problem arises (normally due to a crash or disconnect). .TP .B fixpackages @@ -390,4 +390,4 @@ Contains a list of all local USE variables. .TP The \fI/usr/sbin/ebuild.sh\fR script. .TP -The helper apps in \fI/usr/lib/portage/bin\fR. +The helper apps in \fI@PORTAGE_BASE@/bin\fR. diff --git a/pym/portage.py b/pym/portage.py index 7e305ea46..10d90c4cb 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -471,11 +471,11 @@ endversion_keys = ["pre", "p", "alpha", "beta", "rc"] def env_update(makelinks=1): global root - if not os.path.exists(root+"etc/env.d"): + if not os.path.exists(root+portage_const.PREFIX+"etc/env.d"): prevmask=os.umask(0) - os.makedirs(root+"etc/env.d",0755) + os.makedirs(root+portage_const.PREFIX+"etc/env.d",0755) os.umask(prevmask) - fns=listdir(root+"etc/env.d",EmptyOnError=1) + fns=listdir(root+portage_const.PREFIX+"etc/env.d",EmptyOnError=1) fns.sort() pos=0 while (pos>> Regenerating "+str(root)+"etc/ld.so.cache...\n") if makelinks: - commands.getstatusoutput("cd / ; /sbin/ldconfig -r "+root) + commands.getstatusoutput("cd / ; "+portage_const.PREFIX+"/sbin/ldconfig -r "+root) else: - commands.getstatusoutput("cd / ; /sbin/ldconfig -X -r "+root) + commands.getstatusoutput("cd / ; "+portage_const.PREFIX+"/sbin/ldconfig -X -r "+root) elif ostype == "FreeBSD": if (ld_cache_update): writemsg(">>> Regenerating "+str(root)+"var/run/ld-elf.so.hints...\n") - commands.getstatusoutput("cd / ; /sbin/ldconfig -i -elf -f "+str(root)+"var/run/ld-elf.so.hints "+str(root)+"etc/ld.so.conf") + commands.getstatusoutput("cd / ; "+portage_const.PREFIX+"/sbin/ldconfig -i -elf -f "+str(root)+portage_const.PREFIX+"var/run/ld-elf.so.hints "+str(root)+portage_const.PREFIX+"etc/ld.so.conf") del specials["LDPATH"] @@ -628,7 +628,7 @@ def env_update(makelinks=1): cenvnotice += "# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n" #create /etc/profile.env for bash support - outfile=open(root+"/etc/profile.env","w") + outfile=open(root+portage_const.PREFIX+"etc/profile.env","w") outfile.write(penvnotice) for path in specials.keys(): @@ -652,7 +652,7 @@ def env_update(makelinks=1): outfile.close() #create /etc/csh.env for (t)csh support - outfile=open(root+"/etc/csh.env","w") + outfile=open(root+portage_const.PREFIX+"etc/csh.env","w") outfile.write(cenvnotice) for path in specials.keys(): @@ -1039,9 +1039,11 @@ class config: #backup-env (for recording our calculated incremental variables:) self.backupenv = os.environ.copy() self.configlist.append(self.backupenv) # XXX Why though? + self.configlist[-1]["PATH"] = portage_const.DEFAULT_PATH self.configdict["backupenv"]=self.configlist[-1] self.configlist.append(os.environ.copy()) + self.configlist[-1]["PATH"] = portage_const.DEFAULT_PATH self.configdict["env"]=self.configlist[-1] @@ -2422,7 +2424,8 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["PN"] = mysplit[0] mysettings["PV"] = mysplit[1] mysettings["PR"] = mysplit[2] - + mysettings["PREFIX"] = portage_const.PREFIX + if mydo != "depend": try: mysettings["INHERITED"], mysettings["RESTRICT"] = db[root][tree].dbapi.aux_get( \ @@ -2619,8 +2622,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["DISTCC_DIR"]="" mysettings["WORKDIR"]=mysettings["BUILDDIR"]+"/work" - mysettings["D"]=mysettings["BUILDDIR"]+"/image/" - + mysettings["D"]=os.path.join(mysettings["BUILDDIR"], "image", portage_const.PREFIX.lstrip(os.path.sep)) if mysettings.has_key("PORT_LOGDIR"): if os.access(mysettings["PORT_LOGDIR"]+"/",os.W_OK): try: @@ -2628,7 +2630,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea os.chmod(mysettings["PORT_LOGDIR"],02770) if not mysettings.has_key("LOG_PF") or (mysettings["LOG_PF"] != mysettings["PF"]): mysettings["LOG_PF"]=mysettings["PF"] - mysettings["LOG_COUNTER"]=str(db[myroot]["vartree"].dbapi.get_counter_tick_core("/")) + mysettings["LOG_COUNTER"]=str(db[myroot]["vartree"].get_counter_tick_core("/")) logfile="%s/%s-%s.log" % (mysettings["PORT_LOGDIR"],mysettings["LOG_COUNTER"],mysettings["LOG_PF"]) except OSError, e: mysettings["PORT_LOGDIR"]="" @@ -2640,7 +2642,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["PORT_LOGDIR"]="" if mydo=="unmerge": - return unmerge(mysettings["CATEGORY"],mysettings["PF"],myroot,mysettings) + return unmerge(mysettings["CATEGORY"],mysettings["PF"],myroot+portage_const.PREFIX,mysettings) # if any of these are being called, handle them -- running them out of the sandbox -- and stop now. if mydo=="clean": @@ -4422,7 +4424,7 @@ class dbapi: def counter_tick_core(self,myroot,incrementing=1,mycpv=None): "This method will grab the next COUNTER value and record it back to the global file. Returns new counter value." - cpath=myroot+"var/cache/edb/counter" + cpath=myroot+portage_const.CACHE_PATH+"/counter" changed=0 min_counter = 0 if mycpv: @@ -4638,15 +4640,15 @@ class vardbapi(dbapi): raise except Exception, e: writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n") - writemsg("!!! Please run /usr/lib/portage/bin/fix-db.pl or\n") - writemsg("!!! Please run /usr/lib/portage/bin/fix-db.py or\n") + writemsg("!!! Please run %s/bin/fix-db.pl or\n" % portage_const.PORTAGE_BASE) + writemsg("!!! Please run %s/bin/fix-db.py or\n" % portage_const.PORTAGE_BASE) writemsg("!!! unmerge this exact version.\n") writemsg("!!! %s\n" % e) sys.exit(1) else: writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n") - writemsg("!!! Please run /usr/lib/portage/bin/fix-db.pl or\n") - writemsg("!!! Please run /usr/lib/portage/bin/fix-db.py or\n") + writemsg("!!! Please run %s/bin/fix-db.pl or\n" % portage_const.PORTAGE_BASE) + writemsg("!!! Please run %s/bin/fix-db.py or\n" % portage_const.PORTAGE_BASE) writemsg("!!! remerge the package.\n") sys.exit(1) else: @@ -5912,8 +5914,9 @@ class dblink: self.settings = mysettings if self.settings==1: raise ValueError - + self.myroot=myroot + self.mergedir = myroot + "/" + portage_const.PREFIX self.updateprotect() self.contentscache=[] @@ -6021,13 +6024,13 @@ class dblink: #do some config file management prep self.protect=[] for x in string.split(self.settings["CONFIG_PROTECT"]): - ppath=normalize_path(self.myroot+x)+"/" + ppath=normalize_path(self.mergedir+x)+"/" if os.path.isdir(ppath): self.protect.append(ppath) self.protectmask=[] for x in string.split(self.settings["CONFIG_PROTECT_MASK"]): - ppath=normalize_path(self.myroot+x)+"/" + ppath=normalize_path(self.mergedir+x)+"/" if os.path.isdir(ppath): self.protectmask.append(ppath) #if it doesn't exist, silently skip it @@ -6078,7 +6081,7 @@ class dblink: #do prerm script if myebuildpath and os.path.exists(myebuildpath): - a=doebuild(myebuildpath,"prerm",self.myroot,self.settings,cleanup=cleanup,use_cache=0,tree=self.treetype) + a=doebuild(myebuildpath,"prerm",self.myroot+portage_const.PREFIX,self.settings,cleanup=cleanup,use_cache=0,tree=self.treetype) # XXX: Decide how to handle failures here. if a != 0: writemsg("!!! FAILED prerm: "+str(a)+"\n") @@ -6566,7 +6569,7 @@ class dblink: mysrc=os.path.normpath("///"+srcroot+offset+x) mydest=os.path.normpath("///"+destroot+offset+x) # myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/") - myrealdest="/"+offset+x + myrealdest=portage_const.PREFIX+offset+x # stat file once, test using S_* macros many times (faster that way) try: mystat=os.lstat(mysrc) @@ -6841,8 +6844,8 @@ class dblink: print zing+" "+mydest def merge(self,mergeroot,inforoot,myroot,myebuild=None,cleanup=0): - return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup) - + #return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup) + return self.treewalk(mergeroot,myroot+"/"+portage_const.PREFIX,inforoot,myebuild,cleanup=cleanup) def getstring(self,name): "returns contents of a file with whitespace converted to spaces" if not os.path.exists(self.dbdir+"/"+name): @@ -6928,7 +6931,7 @@ def pkgmerge(mytbz2,myroot,mysettings): os.chdir(pkgloc) mysettings.configdict["pkg"]["CATEGORY"] = mycat; - a=doebuild(myebuild,"setup",myroot,mysettings,tree="bintree") + a=doebuild(myebuild,"setup",myroot+portage_const.PREFIX,mysettings,tree="bintree") print ">>> extracting",mypkg notok=spawn("bzip2 -dqc -- '"+mytbz2+"' | tar xpf -",mysettings,free=1) if notok: @@ -6939,8 +6942,8 @@ def pkgmerge(mytbz2,myroot,mysettings): # the merge takes care of pre/postinst and old instance # auto-unmerge, virtual/provides updates, etc. mysettings.load_infodir(infloc) - mylink=dblink(mycat,mypkg,myroot,mysettings,treetype="bintree") - mylink.merge(pkgloc,infloc,myroot,myebuild,cleanup=1) + mylink=dblink(mycat,mypkg,myroot+portage_const.PREFIX,mysettings,treetype="bintree") + mylink.merge(pkgloc,infloc,myroot+portage_const.PREFIX,myebuild,cleanup=1) if not os.path.exists(infloc+"/RDEPEND"): returnme="" @@ -6973,38 +6976,55 @@ if root != "/": #create tmp and var/tmp if they don't exist; read config os.umask(0) -if not os.path.exists(root+"tmp"): - writemsg(">>> "+root+"tmp doesn't exist, creating it...\n") - os.mkdir(root+"tmp",01777) -if not os.path.exists(root+"var/tmp"): - writemsg(">>> "+root+"var/tmp doesn't exist, creating it...\n") +if not os.path.exists(root+portage_const.PREFIX+"/tmp"): + writemsg(">>> "+root+portage_const.PREFIX+"/tmp doesn't exist, creating it...\n") + os.mkdir(root+portage_const.PREFIX+"/tmp",01777) +if not os.path.exists(root+portage_const.PREFIX+"var/tmp"): + writemsg(">>> "+root+portage_const.PREFIX+"var/tmp doesn't exist, creating it...\n") try: - os.mkdir(root+"var",0755) + os.mkdir(root+portage_const.PREFIX+"var",0755) except (OSError,IOError): pass try: - os.mkdir(root+"var/tmp",01777) + os.mkdir(root+portage_const.PREFIX+"var/tmp",01777) except SystemExit, e: raise except: - writemsg("portage: couldn't create /var/tmp; exiting.\n") + writemsg("portage: couldn't create "+root+portage_const.PREFIX+"/var/tmp; exiting.\n") sys.exit(1) -if not os.path.exists(root+"var/lib/portage"): - writemsg(">>> "+root+"var/lib/portage doesn't exist, creating it...\n") + +if not os.path.exists(root+portage_const.PREFIX+"var/lib"): + writemsg(">>> "+root+portage_const.PREFIX+"var/lib doesn't exist, creating it...\n") try: - os.mkdir(root+"var",0755) + os.mkdir(root+portage_const.PREFIX+"var",0755) except (OSError,IOError): pass try: - os.mkdir(root+"var/lib",0755) + os.mkdir(root+portage_const.PREFIX+"var/lib",0755) + except (OSError,IOError): + pass + try: + os.mkdir(root+portage_const.PREFIX+"var/lib/portage",0755) + except SystemExit, e: + raise + except: + writemsg("portage: couldn't create "+root+portage_const.PREFIX+"var/lib/portage; exiting.\n") + sys.exit(1) + +if not os.path.exists(root+portage_const.PORTAGE_BASE+""): + writemsg(">>> "+root+portage_const.PORTAGE_BASE+" doesn't exist, creating it...\n") + try: + os.mkdir(root+portage_const.PREFIX+"var",0755) except (OSError,IOError): pass try: - os.mkdir(root+"var/lib/portage",02750) + os.mkdirs(root+portage_const.PORTAGE_BASE,0750) + # second round, since previous dirs may need to be made + os.chmod(root+portage_const.PORTAGE_BASE, 02750) except SystemExit, e: raise except: - writemsg("portage: couldn't create /var/lib/portage; exiting.\n") + writemsg("portage: couldn't create %s; exiting.\n" % portage_const.PORTAGE_BASE) sys.exit(1) @@ -7255,10 +7275,10 @@ def do_upgrade(mykey): for x in update_files: mydblink = dblink('','','/',settings) - if mydblink.isprotected("/etc/portage/"+x): - updating_file=new_protect_filename("/etc/portage/"+x)[0] + if mydblink.isprotected(portage_const.PREFIX+"etc/portage/"+x): + updating_file=new_protect_filename(portage_const.PREFIX+"etc/portage/"+x)[0] else: - updating_file="/etc/portage/"+x + updating_file=portage_const.PREFIX+"etc/portage/"+x try: myfile=open(updating_file,"w") myfile.writelines(file_contents[x]) diff --git a/pym/portage_const.py b/pym/portage_const.py index 296784aeb..c6fdeb9d4 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -2,35 +2,41 @@ # Copyright 1998-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/pym/portage_const.py,v 1.3.2.3 2005/04/29 04:56:35 jstubbs Exp $ +import os + +# =========================================================================== +# autotool supplied constants. +# =========================================================================== +from portage_const_autotool import * # =========================================================================== # START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF # =========================================================================== -VDB_PATH = "var/db/pkg" -PRIVATE_PATH = "/var/lib/portage" -CACHE_PATH = "/var/cache/edb" +VDB_PATH = PREFIX+"var/db/pkg" +PRIVATE_PATH = PREFIX+"/var/lib/portage" +CACHE_PATH = PREFIX+"/var/cache/edb" DEPCACHE_PATH = CACHE_PATH+"/dep" -USER_CONFIG_PATH = "/etc/portage" +USER_CONFIG_PATH = PREFIX+"/etc/portage" MODULES_FILE_PATH = USER_CONFIG_PATH+"/modules" CUSTOM_PROFILE_PATH = USER_CONFIG_PATH+"/profile" -PORTAGE_BASE_PATH = "/usr/lib/portage" +PORTAGE_BASE_PATH = PORTAGE_BASE PORTAGE_BIN_PATH = PORTAGE_BASE_PATH+"/bin" PORTAGE_PYM_PATH = PORTAGE_BASE_PATH+"/pym" -PROFILE_PATH = "/etc/make.profile" +PROFILE_PATH = PREFIX+"/etc/make.profile" LOCALE_DATA_PATH = PORTAGE_BASE_PATH+"/locale" EBUILD_SH_BINARY = PORTAGE_BIN_PATH+"/ebuild.sh" -SANDBOX_BINARY = "/usr/bin/sandbox" -BASH_BINARY = "/bin/bash" -MOVE_BINARY = "/bin/mv" -PRELINK_BINARY = "/usr/sbin/prelink" +SANDBOX_BINARY = PREFIX+"/usr/bin/sandbox" +BASH_BINARY = PREFIX+"/bin/bash" +MOVE_BINARY = PREFIX+"/bin/mv" +PRELINK_BINARY = PREFIX+"/usr/sbin/prelink" WORLD_FILE = PRIVATE_PATH+"/world" -MAKE_CONF_FILE = "/etc/make.conf" +MAKE_CONF_FILE = PREFIX+"/etc/make.conf" MAKE_DEFAULTS_FILE = PROFILE_PATH + "/make.defaults" DEPRECATED_PROFILE_FILE = PROFILE_PATH+"/deprecated" USER_VIRTUALS_FILE = USER_CONFIG_PATH+"/virtuals" @@ -42,8 +48,11 @@ CONFIG_MEMORY_FILE = PRIVATE_PATH + "/config" INCREMENTALS=["USE","USE_EXPAND","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"] STICKIES=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EINSTALL","EXTRA_EMAKE"] +DEFAULT_PATH = ":".join(map(lambda x: os.path.join(PREFIX, x), ["/sbin", "/usr/sbin/", "/bin", "/usr/bin"])) + EAPI = 0 # =========================================================================== # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT # =========================================================================== + diff --git a/pym/portage_const_autotool.py b/pym/portage_const_autotool.py new file mode 100644 index 000000000..f778c6d01 --- /dev/null +++ b/pym/portage_const_autotool.py @@ -0,0 +1,13 @@ +# Copyright: 2005 Gentoo Foundation +# Author(s): Brian Harring (ferringb@gentoo.org) +# License: GPL2 +# $Id:$ + +# all vars that are to wind up in portage_const must have their name listed in __all__ + +__all__ = ["PREFIX", "SYSCONFDIR", "PORTAGE_BASE", "wheelgid"] + +PREFIX="@DOMAIN_PREFIX@/" +SYSCONFDIR="@sysconfdir@/" +PORTAGE_BASE="@PORTAGE_BASE@/" +wheelgid="@wheelgid@" diff --git a/pym/portage_data.py b/pym/portage_data.py index 2afd04667..04c2979d3 100644 --- a/pym/portage_data.py +++ b/pym/portage_data.py @@ -5,6 +5,7 @@ import os,pwd,grp +import portage_const from portage_util import writemsg from output import green,red @@ -42,7 +43,7 @@ os.environ["USERLAND"]=userland secpass=0 uid=os.getuid() -wheelgid=0 +wheelgid=portage_const.wheelgid if uid==0: secpass=2 diff --git a/pym/portage_exec.py b/pym/portage_exec.py index c62d0a549..40f816929 100644 --- a/pym/portage_exec.py +++ b/pym/portage_exec.py @@ -215,7 +215,8 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask): def find_binary(binary): - for path in os.getenv("PATH", "").split(":"): + from portage_const import DEFAULT_PATH + for path in DEFAULT_PATH.split(":"): filename = "%s/%s" % (path, binary) if os.access(filename, os.X_OK) and os.path.isfile(filename): return filename diff --git a/pym/portage_locks.py b/pym/portage_locks.py index 241ff9df9..1bb6c4c88 100644 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -16,6 +16,7 @@ import portage_file import portage_util import portage_data from portage_localization import _ +import portage_const HARDLINK_FD = -2 @@ -271,7 +272,7 @@ def hardlink_lockfile(lockfilename, max_wait=14400): print print "Waiting on (hardlink) lockfile: (one '.' per 3 seconds)" print "This is a feature to prevent distfiles corruption." - print "/usr/lib/portage/bin/clean_locks can fix stuck locks." + print "%s/bin/clean_locks can fix stuck locks." % portage_const.PORTAGE_BASE print "Lockfile: " + lockfilename time.sleep(3) -- 2.26.2