Use portage_const.EPREFIX instead of self["EPREFIX"] for consistency.
authorFabian Groffen <grobian@gentoo.org>
Tue, 17 Oct 2006 20:39:50 +0000 (20:39 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 17 Oct 2006 20:39:50 +0000 (20:39 -0000)
Added eprefixify function which does sedding on files to add EPREFIX in.

svn path=/main/branches/prefix/; revision=4740

bin/eprefixify [new file with mode: 0755]
pym/portage.py

diff --git a/bin/eprefixify b/bin/eprefixify
new file mode 100755 (executable)
index 0000000..44b03d9
--- /dev/null
@@ -0,0 +1,39 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+# replaces @GENTOO_PORTAGE_EPREFIX@ with EPREFIX for the given files
+
+if [[ $# -lt 1 ]] ; then
+       echo "$0: at least one argument needed" 1>&2
+       exit 1
+fi
+
+source "${PORTAGE_BIN_PATH}/isolated-functions.sh"
+case "${NOCOLOR:-false}" in
+       yes|true)
+               unset_colors
+               ;;
+       no|false)
+               set_colors
+               ;;
+esac
+
+ret=0
+
+einfo "Adjusting to prefix ..."
+for x in "$@" ; do
+       if [[ -e ${x} ]] ; then
+               ebegin ${x##*/}
+               sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}"
+               r=$?
+               eend $r
+               ((ret+=$r))
+       else
+               echo "!!! ${0##*/}: ${x} does not exist" 1>&2
+               false
+       fi
+done
+
+exit ${ret}
index fa6fbad37f9ada851b2ae90810f593943324d134..8b0c9d7a3cbac5725d064bb03771afff8aa6538f 100644 (file)
@@ -1386,7 +1386,7 @@ class config:
                for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
                        try:
                                mydir = normalize_path(
-                                               os.path.join(self["ROOT"] + self["EPREFIX"], mypath))
+                                               os.path.join(self["ROOT"] + portage_const.EPREFIX, mypath))
                                portage_util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
                        except portage_exception.PortageException, e:
                                writemsg("!!! Directory initialization failed: '%s'\n" % mydir,