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
-#!/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 $
#
import os, sys, string
-sys.path = ["/usr/lib/portage/pym"]+sys.path
+sys.path = ["@PORTAGE_BASE@/pym"]+sys.path
import portage, dispatch_conf
-#!/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 $
# 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):
-#!/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
-#!/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 $
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
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
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
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
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
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
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}"
-#!/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 $
-#!/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
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
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
-#!/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}"
[ ! -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"
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
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 "$@"
}
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() {
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
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}"
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
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"
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}"
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
# 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
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
-#!/usr/bin/python -O
+#!@PYTHON@ -O
import sys
from copy import copy
-#!/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 $
-#!/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
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])
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=='':
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):
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
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"
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:]
-#!/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
-#!/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()
-#!/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 $
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}
$(set | grep '^my_envd_' | sed -e 's:^my_envd_\([[:alpha:]_][[:alnum:]_]*\)=:setenv \1 :')
EOF
-[[ ${ROOT} == / ]] && /sbin/depscan.sh
+[[ ${ROOT} == / ]] && ${PREFIX}/sbin/depscan.sh
-#!/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 $
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}|
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`
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
-#!/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 *
-#!/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 $
-#!/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
-#!/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 $
-#!/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 $
-#!/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 $
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 *
-#!/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 $
-#!/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 $
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 *
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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
-#!/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
-#!/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
-#!/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 $
-#!/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
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]]
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
-#!/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 $
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
-#!/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
-#!/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 $
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._-+:"
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)
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
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)
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)
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=[]
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)
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)
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)
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)
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)
-#!/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 $
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])
.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
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.
.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).
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
.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.
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)):
# 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
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=[]
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()
# 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:
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:
# 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"]
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():
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():
#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]
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( \
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:
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"]=""
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":
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:
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:
self.settings = mysettings
if self.settings==1:
raise ValueError
-
+
self.myroot=myroot
+ self.mergedir = myroot + "/" + portage_const.PREFIX
self.updateprotect()
self.contentscache=[]
#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
#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")
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)
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):
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:
# 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=""
#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)
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])
# 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"
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
# ===========================================================================
+
--- /dev/null
+# 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@"
import os,pwd,grp
+import portage_const
from portage_util import writemsg
from output import green,red
secpass=0
uid=os.getuid()
-wheelgid=0
+wheelgid=portage_const.wheelgid
if uid==0:
secpass=2
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
import portage_util
import portage_data
from portage_localization import _
+import portage_const
HARDLINK_FD = -2
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)