Prefix aware portage.
authorBrian Harring <ferringb@gentoo.org>
Fri, 11 Nov 2005 03:10:14 +0000 (03:10 -0000)
committerBrian Harring <ferringb@gentoo.org>
Fri, 11 Nov 2005 03:10:14 +0000 (03:10 -0000)
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

83 files changed:
bin/archive-conf
bin/chkcontents
bin/clean_locks
bin/dispatch-conf
bin/dobin
bin/doconfd
bin/dodir
bin/dodoc
bin/doenvd
bin/doexe
bin/dohard
bin/dohtml
bin/doinfo
bin/doinitd
bin/doins
bin/dojar
bin/dolib
bin/dolib.a
bin/dolib.so
bin/doman
bin/domo
bin/dopython
bin/dosbin
bin/dosed
bin/dosym
bin/ebuild
bin/ebuild.sh
bin/emaint
bin/emake
bin/emerge
bin/emerge-webrsync
bin/env-update
bin/env-update.sh
bin/etc-update
bin/find-requires
bin/fix-db.py
bin/fixdbentries
bin/fixpackages
bin/fowners
bin/fperms
bin/md5check.py
bin/md5check.sh
bin/mirror.py
bin/newbin
bin/newconfd
bin/newdoc
bin/newenvd
bin/newexe
bin/newinitd
bin/newins
bin/newlib.a
bin/newlib.so
bin/newman
bin/newsbin
bin/pkgmerge
bin/pkgmerge.new
bin/pkgname
bin/portage_gpg_update.sh
bin/portageq
bin/prepall
bin/prepalldocs
bin/prepallinfo
bin/prepallman
bin/prepallstrip
bin/prepinfo
bin/preplib
bin/preplib.so
bin/prepman
bin/prepstrip
bin/quickpkg
bin/regenworld
bin/repoman
bin/xpak
man/ebuild.1
man/ebuild.5
man/emerge.1
man/make.conf.5
pym/portage.py
pym/portage_const.py
pym/portage_const_autotool.py [new file with mode: 0644]
pym/portage_data.py
pym/portage_exec.py
pym/portage_locks.py

index 35fa2408cad878b3c0eecda47a18e3e51a3d3e79..bdd0968fb7dac264911edff7c08c6054a105f1f0 100755 (executable)
@@ -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
 
index 96775fc5182f51941345d93eee0bade09016f471..c21966a43c316d801ffd5e760b0e41e533a5a144 100755 (executable)
@@ -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):
index e374e8f933ca096a6e05d346412bd016e735266c..254d42a95ae2acd291197b9e85530ca5e7780ae0 100755 (executable)
@@ -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
 
index bc8077a63445b376c42c36dbb158e02efffc2f78..2b777da00aa53da53331678765c7d272f511e15a 100755 (executable)
@@ -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
 
index b1c6fcf974e0d93e922a240fbe0149a62a55d670..0e3b3fe381473431f9aa870ebe6fb8e8931e984c 100755 (executable)
--- 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 $
index 652f43cd63ae9dc95114601ef93de2a653adc053..8a85bd4f5a8313852b23bf85773c96b3f745ebc3 100755 (executable)
@@ -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 $
index 1ea4d623a712148da733ed74d062b2c90d78be39..3180fcad3bfd46c3dff722f09b70cdd3f9d1b7f4 100755 (executable)
--- 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 $
index 20628cedc0de9e32de6455d5d39da32c1d663890..0caad88f022567b41164afd6f7cbc4a18b602bee 100755 (executable)
--- 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 $
index 8289fe9d33a0f76b635ccf5d24b79fe83d6ecdc0..6c92d344a5ecb2edc02f8cac12dc3b75f5a7cc28 100755 (executable)
@@ -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 $
index aafef223e68e3410dfb7f5d57c3f4d7f10a37a07..f448eb9e4c3544702defc1c63679205e3b389a61 100755 (executable)
--- 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
index ce7d5d828d09f5218a7855215337699992a007df..32163d1d9d8e5177599e93ac897fd1f708ac3ecf 100755 (executable)
@@ -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 $
index 963f4465ad33e00c0d4c61e8d53d77263c06a980..1091e082c34a790c10bd6f2c8c2107f5ce734065 100755 (executable)
@@ -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 $
index 83f639b01ca05d20ab655b8f69b7bf6aa044b100..1ee9be1c65e36839d6d7013452abb16a2ebb29a5 100755 (executable)
@@ -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 $
index 4f5885ec63b6e61d79a1041d2ab3af47e92d52d9..3665baa69606db6a296fac73cff731f4795645cb 100755 (executable)
@@ -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 $
index bf51463ab8a486ed30f9cc643dd7bbdb16eaaa6f..1c5471893cb93f92aa49fd548530165b3cc41e50 100755 (executable)
--- 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
index 2bbc5ea2ecd7efc7ed9d249a26add740d4459442..6f30332b7bfc99be2e0df5a78baf206cdc617f17 100755 (executable)
--- 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 $
index 5424446abc8696f6305a17e30c4d4b5af2bd233b..b0189b74423ab4cab91d5d4a38a225c330559d52 100755 (executable)
--- 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 $
index 73392ab3eabc7a7112e6a4e96a92ea1a7a621cbd..b21f0c1201707525f8e7e8593646c2239b71adc0 100755 (executable)
@@ -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 $
index e130ecd42384318f10f2c0e266a9e9dee5fcb594..52d6935460c752c45fc0331525689fd007ffe72b 100755 (executable)
@@ -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 $
index a1a2a975417461d5539b98ff154a848d0b6b6253..07a6793b1012d8ba8785825d6fa01bdbebb1900f 100755 (executable)
--- 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}"
index d6cc0826a77b8ddf7b906e3b73e08c9be7cb47f9..a1b15a1f73464712dbb5c52eb62e006a6689782f 100755 (executable)
--- 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 $
index f058282b1f5c0f903e2b28340dd39502eb836c5a..776ad610835139e96aaa2f18dcc46101ff8feae9 100755 (executable)
@@ -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
index 89c469523f3857001e29c4407a04f25cdd11a590..66fc911f7592827a84d44a7de889dbbc9504f297 100755 (executable)
@@ -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 $
index 76cd4689840da4e00c15d0d4160b8c0468091d32..428feb0cf91f634248e3ee817d6b3d2dd755b4c9 100755 (executable)
--- 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 $
index fd57a45e88e1ca342c41231ce0e3462f66799291..c41045fdd2b649117407c27796b2ee3d88abd806 100755 (executable)
--- 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 $
index 0ddeaa6bb8516b85a3bb6e1422e88eb4ea0b5aa3..0ab5269835b1bb388d0aabe266b3436288233425 100755 (executable)
@@ -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
 
index be44861827c946eb92618b34eff91353a5492714..aefe8adba9d11cbdf69cd84d08a8ce7d53202fa4 100755 (executable)
@@ -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
index b48d417c36048a7d138df842f16e809d620463b1..9e0f324d9b662578088f55f79533e01464c65438 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python -O
+#!@PYTHON@ -O
 
 import sys
 from copy import copy
index efdc0a71a7dc0d73a4766dea751cfe1c18349b82..02e38523f93be916435df91ccabd520c95fcc6b4 100755 (executable)
--- 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 $
index aaa288ec42c9a356bd6dba8b94373dd94ced23de..b7a47eef0abd120905818e978173e09fd65ab69f 100755 (executable)
@@ -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:]
index 9e2a44af214efaad0aa9ee5562ceb0e830e27f56..d65c15617562318bd2e5e359c0e30f7a16f4e74a 100755 (executable)
@@ -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 <karltk@gentoo.org>
 # 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
index 1cd55cb8946e8b2815480e59177673f009431972..18074603bc4ce56f4153837d4dc0c2ea77265621 100755 (executable)
@@ -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()
index ff7fa09d220c3767daae2fd08bfde00780019d5c..90e37000d33a2347db828c2046a42f99989850de 100755 (executable)
@@ -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
index ce5ac568b64d03ce9ce8e70a2560d97a3df8bb20..f7a289ac943dcc9d5eb93de17d982884c52195a9 100755 (executable)
@@ -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`
index 5f413f564f4c05cff6d5ff82e2eb8410e7d97ae9..5e5742cdb0c3f55ff57badc1a9f8e0dda76a6b7f 100755 (executable)
@@ -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
index 3dcd1ca687526b79d71525fb60d026cbb00304b2..7cf15b12d4282fb9cd476fad1576b8b33ef331c8 100755 (executable)
@@ -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 *
index 884155a7c2733ffaab00188e77bd57aa62d40484..6b864017206b84ddb3ac8985a80d4d490df7c62d 100755 (executable)
@@ -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 $
index 9f44f82504b468fd71eee9e678f7ca04432aab8a..85b9ec7c3688948997f6b9fe921cc405f4ed9e2a 100755 (executable)
@@ -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
 
index c2aab7181a527107921583ca74d8b961cc15efe0..06ec6d4d3c101f0b7c8cac4e62b378c4c67350d0 100755 (executable)
@@ -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 $
index 8d60983e5e7f5e7bd24c3077df8f4f5568399464..efb159ce562a2dafe3b078688c8aacdc9fb50185 100755 (executable)
@@ -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 $
index 96a16d3acf34d0fe0e73374366fd92f86f9b8989..c72fc1b8fc1ac2487b419854080785ace39fdd55 100755 (executable)
@@ -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 *
index 6ba5efd3d718684cb57981ae0471141704f1a792..6c229f70b58d1fd366e7670b8e87d7c1d18655bd 100755 (executable)
@@ -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 $
index 75579f37d09a117702a7f7d7a5243e844353ed71..278ae7c2b18b340a29b29d6d8cb24883f1c4de0d 100755 (executable)
@@ -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 *
index c8a67466bcb151e41d70404c3298d5fcfa411baf..d8c0056798d358aaa91ba4608ac17d0bd3281052 100755 (executable)
@@ -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 $
index 40c02139296b43313d91530e55057294851f2166..5fc6971effd5126d01529d5a13078b040785c5ea 100755 (executable)
@@ -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 $
index 145444843ae1d4b0bf067d0a6d40f697bb526e95..b19cff1d6a22da4fda5ef22404d3d3a94f411af4 100755 (executable)
@@ -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 $
index 62640b8514a43003a15956d8ef774c88ef95df89..a5ec9f9bb440254882413268ff63f722db6b80d8 100755 (executable)
@@ -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 $
index 2e3321a9f6b6409fef9b4a27b41fff34bbbf315e..9edd296e7e19dc0d02b3c6aea6d33198339be582 100755 (executable)
@@ -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 $
index b1bc0a30c0e9dae5674f887ec294b8d82f23393f..ef6f2bcf164222b4569fcd7391551a1b7adae1b8 100755 (executable)
@@ -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 $
index 6ec2f6d14ffa71300cae1d9f2774471e500a28d1..b549a29d75ca3409082834b472f6bded6cc4647c 100755 (executable)
@@ -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 $
index d704bd3218391b9435abaf751b9b725aaed9b0fd..ebd3c0ecab30ec0e303a023c80895598cc26e2d6 100755 (executable)
@@ -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 $
index 9df2a4d39177eb41b1c3f10d75f410af98b2be85..99e1395092c3b511d1a321528d5e338bc7ed1ae7 100755 (executable)
@@ -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 $
index 5bb6ebdf9ab95cb3d6e0a061df143a489a94d476..fb47a88544c8cee8918813f09d8042f0b88c6450 100755 (executable)
@@ -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 $
index c361ea39ac0284edeef39ca0061717478aa831f3..4f4aec65d5f9340200ca880f8c21e00cd0541d19 100755 (executable)
@@ -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 $
index 2cf9b5d35b6f82eea901aa011c0bd02ca869e9d0..137b11d43fc0436f36080d9a29470534a81c07ba 100755 (executable)
@@ -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
 
index 3abcb88c8e39aea0ff95441311fb542efaab9ffb..46b6f03ea02eaa969cf2739062a4e126ba22dcbb 100755 (executable)
@@ -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
 
index c2c07525c07acf05fda3cfbe85237ed2c95f6047..9a5314830812619f6c341e62e06b177e44b7485b 100755 (executable)
@@ -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
 
index 7abbbda4f4429934d2cf55dc78cb5b4c25176680..f3f76f21feab77706f80109591c5514cb3042ff4 100755 (executable)
@@ -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 $
index f85274baf6a4179ee5de09aa28ee8f41849d573c..17a81a223c52d1115270674858179c6478a89593 100755 (executable)
@@ -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):
        """<variable>
        Returns a specific environment variable as exists prior to ebuild.sh.
-       Similar to: emerge --verbose --info | egrep '^<variable>='
+       Similar to: emerge --verbose --info | @EGREP@ '^<variable>='
        """
        print portage.settings[argv[0]]
 
index ba3db9d8e905f46b617654bc94f38c5112035d63..50d3b2787715a8340c48c7377f2ea13ced5fe289 100755 (executable)
@@ -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 $
index 6c540a2fd1593c8631cff305c937c4fd1549a9b1..64aca6222ef61680b41e7fd2af0d021dd5d10b79 100755 (executable)
@@ -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 $
index 5875285deb9e541164596cbb9ce6c4df3d27ff20..2d6b9e609317ff44f056cd47ea35bd33c4906b0a 100755 (executable)
@@ -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 $
index bc094fa0540d5dd89548cc8b4bd602b578f654a7..456ee004b1765c8d3a54e3275492c58859aee03e 100755 (executable)
@@ -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 $
index cbec1c6446fbc990c8f0cdfe4c5399f418f461c9..8d876ff66499eada788486cb3db5b0a62a48056e 100755 (executable)
@@ -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 $
index 3e85528cbc43a753e5f166accf71472a6d4ff7dd..62d911f37d07196933546a6264f9a3d795224cf5 100755 (executable)
@@ -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 $
index 53fd2018d19bc1c1725a03313e27fd80e0ed00c0..c1bc2b4198063d6d55efd62a92223f3e748c7352 100755 (executable)
@@ -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 $
index cbcb66b29f1cd7819370c38c6fb73dba7a181231..99d548dc1cfa76daf09e8018b8fb014030ad2fb0 100755 (executable)
@@ -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 $
index 14795d954328c5e74917b1a5f491db55466953ef..46435cdf0ed66aca1b1dbf617a611c7d246bbed0 100755 (executable)
@@ -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 $
index eadc5b2452060ac7890c5330be8239977054c95a..724f531cfac0d7d2429b80a0a5659de1a9dc42ec 100755 (executable)
@@ -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 $
index caa5ce0df9012fd86b557f1785ca6a7ec2a5b55c..a02e66e5eb2ca2444a8eb621063e05ddb3979c43 100755 (executable)
@@ -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
index 19650d23e97d7edceccf629f3d73cfa9f22d43bd..ac8ff2362f9e95a7cddce11af588e3ece64ea8dd 100755 (executable)
@@ -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
 
index 49578ad59f73ddfa39d682de344a043d1200e8b9..f64309691bd40b7e60d0869b0c27f9707ef6b324 100755 (executable)
@@ -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 '^[^#]*\([^)]*\<die\>' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"):
+               if not os.system("@EGREP@ '^[^#]*\([^)]*\<die\>' "+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)
index 5becde25d741dfc28dee906f1f21f17762612862..8e4fec656f786da97e2a28c84cc998fbdb12ef1e 100755 (executable)
--- 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])
index 742cf6f2e3c9ff767f23832bfbc5aa216e341979..f82d1531fc222e11cf85da087c6a1065784912b3 100644 (file)
@@ -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.
index 59c202d9eacad8a21d3e69daf64738e69820fa22..1d497a6d3368c4509504c7dc9ca47fe53242ef25 100644 (file)
@@ -822,7 +822,7 @@ Mike Frysinger <vapier@gentoo.org>
 .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.
index dc79d6a1474d851027828fdbbb3ba9fedef4d0a4..c6eb388154cc2873ecc0fedb5c3897a9c5807175 100644 (file)
@@ -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).
index 220077b805d54f8f7f613b9b30d02fbbcf55fa66..7dd0f1117a0d7aa39459f354f6124b1370735901 100644 (file)
@@ -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.
index 7e305ea46d33cd19a0f381904741221d8ab6dc5f..10d90c4cbcdd46a6bf1d7b987ae2bf896d4cea43 100644 (file)
@@ -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<len(fns)):
@@ -506,9 +506,9 @@ def env_update(makelinks=1):
                # don't process backup files
                if x[-1]=='~' or x[-4:]==".bak":
                        continue
-               myconfig=getconfig(root+"etc/env.d/"+x)
+               myconfig=getconfig(root+portage_const.PREFIX+"etc/env.d/"+x)
                if myconfig==None:
-                       writemsg("!!! Parsing error in "+str(root)+"etc/env.d/"+str(x)+"\n")
+                       writemsg("!!! Parsing error in "+str(root)+portage_const.PREFIX+"etc/env.d/"+str(x)+"\n")
                        #parse error
                        continue
                # process PATH, CLASSPATH, LDPATH
@@ -523,8 +523,8 @@ def env_update(makelinks=1):
                for myenv in myconfig.keys():
                        env[myenv]=myconfig[myenv]
 
-       if os.path.exists(root+"etc/ld.so.conf"):
-               myld=open(root+"etc/ld.so.conf")
+       if os.path.exists(root+portage_const.PREFIX+"etc/ld.so.conf"):
+               myld=open(root+portage_const.PREFIX+"etc/ld.so.conf")
                myldlines=myld.readlines()
                myld.close()
                oldld=[]
@@ -546,9 +546,9 @@ def env_update(makelinks=1):
        newld=specials["LDPATH"]
        if (oldld!=newld):
                #ld.so.conf needs updating and ldconfig needs to be run
-               myfd=open(root+"etc/ld.so.conf","w")
+               myfd=open(root+portage_const.PREFIX+"etc/ld.so.conf","w")
                myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
-               myfd.write("# contents of /etc/env.d directory\n")
+               myfd.write("# contents of "+portage_const.PREFIX+"etc/env.d directory\n")
                for x in specials["LDPATH"]:
                        myfd.write(x+"\n")
                myfd.close()
@@ -556,11 +556,11 @@ def env_update(makelinks=1):
 
        # Update prelink.conf if we are prelink-enabled
        if prelink_capable:
-               newprelink=open(root+"etc/prelink.conf","w")
+               newprelink=open(root+portage_const.PREFIX+"etc/prelink.conf","w")
                newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
-               newprelink.write("# contents of /etc/env.d directory\n")
+               newprelink.write("# contents of "+portage_const.PREFIX+"etc/env.d directory\n")
 
-               for x in ["/bin","/sbin","/usr/bin","/usr/sbin","/lib","/usr/lib"]:
+               for x in map(lambda x: portage_const.PREFIX+x, ["bin","/sbin","/usr/bin","/usr/sbin","/lib","/usr/lib"]):
                        newprelink.write("-l "+x+"\n");
                for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
                        if not x:
@@ -585,7 +585,7 @@ def env_update(makelinks=1):
        if not mtimedb.has_key("ldpath"):
                mtimedb["ldpath"]={}
 
-       for x in specials["LDPATH"]+['/usr/lib','/lib']:
+       for x in map(lambda x: portage_const.PREFIX+x, specials["LDPATH"]+['/usr/lib','/lib']):
                try:
                        newldpathtime=os.stat(x)[stat.ST_MTIME]
                except SystemExit, e:
@@ -611,13 +611,13 @@ def env_update(makelinks=1):
                        # we can safely create links.
                        writemsg(">>> 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])
index 296784aeb9786dd06cba8ee9614d3f2eb5dc0c45..c6fdeb9d4ee8d855a117d9b4e4f80d4216470423 100644 (file)
@@ -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 (file)
index 0000000..f778c6d
--- /dev/null
@@ -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@"
index 2afd0466771f61e09523ca50d9d0b52ada17bfb1..04c2979d3f7ddff5d09ddf00c2b467f0e8d819f2 100644 (file)
@@ -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
index c62d0a549a45ca1e76189043b3417cdec499b1ff..40f816929fbfdf870bec095206310768584db2d0 100644 (file)
@@ -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
index 241ff9df9779f0c60f74448c3d26015144625e31..1bb6c4c88809b7d6e3bcf6da4286abe52ede4362 100644 (file)
@@ -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)