From: Zac Medico Date: Sun, 22 Apr 2012 17:56:01 +0000 (-0700) Subject: Add ${T}/build.log symlink to PORT_LOGDIR. X-Git-Tag: v2.2.0_alpha101~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b93b24f9fa1b2761aa0768274bd93ade9b526961;p=portage.git 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. --- diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 98be41ec0..36304881f 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 50b14ec91..b8fbdc5cf 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): """