aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-04-22 17:56:01 (GMT)
committerZac Medico <zmedico@gentoo.org>2012-04-22 17:56:01 (GMT)
commitb93b24f9fa1b2761aa0768274bd93ade9b526961 (patch)
treedfe3d7409184b6c140ded3dba3d4460b9be25312
parentrepoman: support * and ~* keywords (diff)
downloadportage-b93b24f9fa1b2761aa0768274bd93ade9b526961.zip
portage-b93b24f9fa1b2761aa0768274bd93ade9b526961.tar.gz
portage-b93b24f9fa1b2761aa0768274bd93ade9b526961.tar.bz2
Add ${T}/build.log symlink to PORT_LOGDIR.
This will fix bug #412865. This makes it easier on people who `emerge foo`, do stuff, `emerge foo`, do stuff, etc... to have the same path to the log in between runs.
-rw-r--r--bin/isolated-functions.sh11
-rw-r--r--pym/portage/package/ebuild/prepare_build_dirs.py22
2 files changed, 29 insertions, 4 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 98be41e..3630488 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -216,8 +216,15 @@ die() {
> "$PORTAGE_BUILDDIR/.die_hooks"
fi
- [[ -n ${PORTAGE_LOG_FILE} ]] \
- && eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ -n ${PORTAGE_LOG_FILE} ]] ; then
+ eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+ if [[ ${PORTAGE_LOG_FILE} != ${T}/* ]] ; then
+ # Display path to symlink in ${T}, as requested in bug #412865.
+ local log_ext=${PORTAGE_LOG_FILE##*/}
+ log_ext=${log_ext#*.}
+ eerror "For convenience, a symlink to the build log is located at '${T}/build.${log_ext}'."
+ fi
+ fi
if [ -f "${T}/environment" ] ; then
eerror "The ebuild environment file is located at '${T}/environment'."
elif [ -d "${T}" ] ; then
diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py
index 50b14ec..b8fbdc5 100644
--- a/pym/portage/package/ebuild/prepare_build_dirs.py
+++ b/pym/portage/package/ebuild/prepare_build_dirs.py
@@ -346,13 +346,31 @@ def _prepare_workdir(mysettings):
writemsg(_unicode_decode("!!! %s: %s\n") %
(_("Permission Denied"), log_subdir), noiselevel=-1)
+ tmpdir_log_path = os.path.join(
+ mysettings["T"], "build.log%s" % compress_log_ext)
if not logdir_subdir_ok:
# NOTE: When sesandbox is enabled, the local SELinux security policies
# may not allow output to be piped out of the sesandbox domain. The
# current policy will allow it to work when a pty is available, but
# not through a normal pipe. See bug #162404.
- mysettings["PORTAGE_LOG_FILE"] = os.path.join(
- mysettings["T"], "build.log%s" % compress_log_ext)
+ mysettings["PORTAGE_LOG_FILE"] = tmpdir_log_path
+ else:
+ # Create a symlink from tmpdir_log_path to PORTAGE_LOG_FILE, as
+ # requested in bug #412865.
+ make_new_symlink = False
+ try:
+ target = os.readlink(tmpdir_log_path)
+ except OSError:
+ make_new_symlink = True
+ else:
+ if target != mysettings["PORTAGE_LOG_FILE"]:
+ make_new_symlink = True
+ if make_new_symlink:
+ try:
+ os.unlink(tmpdir_log_path)
+ except OSError:
+ pass
+ os.symlink(mysettings["PORTAGE_LOG_FILE"], tmpdir_log_path)
def _ensure_log_subdirs(logdir, subdir):
"""