mkdir "${TMP}" || die "failed to create temp dir" 1
# make sure we have a secure directory to work in
chmod 0700 "${TMP}" || die "failed to set perms on temp dir" 1
-chown ${UID:-0}:${GID:-0} "${TMP}" || die "failed to set ownership on temp dir" 1
+# GID need not to be available, and group 0 is not cool when not being
+# root, hence just rely on mkdir to have created a dir which is owned by
+# the user
+if [[ -z ${UID} || ${UID} == 0 ]] ; then
+ chown ${UID:-0}:${GID:-0} "${TMP}" || die "failed to set ownership on temp dir" 1
+fi
# 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
+ CLEAR_TERM=$(get_config clear_term)
EU_AUTOMERGE=$(get_config eu_automerge)
rm_opts=$(get_config rm_opts)
mv_opts=$(get_config mv_opts)
sys.exit(128 + signal.SIGINT)
import os
- import subprocess
import types
+# for an explanation on this logic, see pym/_emerge/__init__.py
+if os.environ.__contains__("PORTAGE_PYTHONPATH"):
+ pym_path = os.environ["PORTAGE_PYTHONPATH"]
+else:
+ pym_path = os.path.join(os.path.dirname(
+ os.path.dirname(os.path.realpath(__file__))), "pym")
# Avoid sandbox violations after python upgrade.
-pym_path = os.path.join(os.path.dirname(
- os.path.dirname(os.path.realpath(__file__))), "pym")
if os.environ.get("SANDBOX_ON") == "1":
sandbox_write = os.environ.get("SANDBOX_WRITE", "").split(":")
if pym_path not in sandbox_write:
from portage import _unicode_encode
from portage.data import secpass
from portage.output import xtermTitle
+from portage.const import EPREFIX
-_emerge_log_dir = '/var/log'
+ # We disable emergelog by default, since it's called from
+ # dblink.merge() and we don't want that to trigger log writes
+ # unless it's really called via emerge.
+ _disable = True
- _disable = False
+_emerge_log_dir = EPREFIX + '/var/log'
def emergelog(xterm_titles, mystr, short_msg=None):
- # Copyright 2007 Gentoo Foundation
+ # Copyright 2007-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-import errno
import re
from itertools import chain