--- pym/portage.py (revision 9579) +++ pym/portage.py (revision 9580) @@ -1013,7 +1013,8 @@ "PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR", "PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST", "PORTAGE_BASHRC", - "PORTAGE_BINPKG_FILE", "PORTAGE_BINPKG_TMPFILE", + "PORTAGE_BINPKG_FILE", "PORTAGE_BINPKG_TAR_OPTS", + "PORTAGE_BINPKG_TMPFILE", "PORTAGE_BIN_PATH", "PORTAGE_BUILDDIR", "PORTAGE_COLORMAP", "PORTAGE_CONFIGROOT", "PORTAGE_DEBUG", "PORTAGE_DEPCACHEDIR", --- bin/misc-functions.sh (revision 9579) +++ bin/misc-functions.sh (revision 9580) @@ -534,7 +534,8 @@ # Sandbox is disabled in case the user wants to use a symlink # for $PKGDIR and/or $PKGDIR/All. export SANDBOX_ON="0" - tar ${tar_options} -cf - . | bzip2 -f > "${pkg_tmp}" || \ + tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS . | \ + bzip2 -f > "${pkg_tmp}" || \ die "Failed to create tarball" cd .. export PYTHONPATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} --- bin/isolated-functions.sh (revision 9579) +++ bin/isolated-functions.sh (revision 9580) @@ -466,7 +466,7 @@ LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \ NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \ PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \ - PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \ + PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \ PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \ PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \ PORTAGE_INST_UID PORTAGE_LOG_FILE PORTAGE_MASTER_PID \ --- man/make.conf.5 (revision 9579) +++ man/make.conf.5 (revision 9580) @@ -366,6 +366,10 @@ for more information. Note that it should point to the 'All' directory on the host that creates the binary packages and not to the root of the \fBPKGDIR\fR. .TP +.B PORTAGE_BINPKG_TAR_OPTS +This variable contains options to be passed to the tar command for creation +of binary packages. +.TP \fBPORTAGE_COMPRESS\fR = \fI"bzip2"\fR This variable contains the command used to compress documentation during the install phase. --- bin/misc-functions.sh (revision 9592) +++ bin/misc-functions.sh (revision 9593) @@ -374,7 +374,7 @@ set +o noglob quiet_mode || einfo "Removing ${no_inst}" # normal stuff - rm -Rf ${root}/${no_inst} >&/dev/null + rm -Rf "${root}"/${no_inst} >&/dev/null # we also need to handle globs (*.a, *.h, etc) find "${root}" -path "${no_inst}" -exec rm -fR {} \; >/dev/null --- pym/portage.py (revision 9594) +++ pym/portage.py (revision 9595) @@ -4678,11 +4678,14 @@ phase_retval = exit_status_check(phase_retval) if phase_retval == os.EX_OK: # Post phase logic and tasks that have been factored out of - # ebuild.sh. + # ebuild.sh. Call preinst_mask last so that INSTALL_MASK can + # can be used to wipe out any gmon.out files created during + # previous functions (in case any tools were built with -pg + # in CFLAGS). myargs = [_shell_quote(misc_sh_binary), - "preinst_bsdflags", "preinst_mask", + "preinst_bsdflags", "preinst_sfperms", "preinst_selinux_labels", - "preinst_suid_scan"] + "preinst_suid_scan", "preinst_mask"] _doebuild_exit_status_unlink( mysettings.get("EBUILD_EXIT_STATUS_FILE")) mysettings["EBUILD_PHASE"] = "" --- bin/misc-functions.sh (revision 9594) +++ bin/misc-functions.sh (revision 9595) @@ -407,6 +407,11 @@ eerror "${FUNCNAME}: D is unset" return 1 fi + + # Make sure $PWD is not ${D} so that we don't leave gmon.out files + # in there in case any tools were built with -pg in CFLAGS. + cd "${T}" + # remove man pages, info pages, docs if requested for f in man info doc; do if hasq no${f} $FEATURES; then @@ -525,7 +530,9 @@ } dyn_package() { - cd "${PORTAGE_BUILDDIR}/image" + # Make sure $PWD is not ${D} so that we don't leave gmon.out files + # in there in case any tools were built with -pg in CFLAGS. + cd "${T}" install_mask "${PORTAGE_BUILDDIR}/image" "${PKG_INSTALL_MASK}" local pkg_dest="${PKGDIR}/All/${PF}.tbz2" local pkg_tmp="${PKGDIR}/All/${PF}.tbz2.$$" @@ -534,10 +541,9 @@ # Sandbox is disabled in case the user wants to use a symlink # for $PKGDIR and/or $PKGDIR/All. export SANDBOX_ON="0" - tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS . | \ + tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \ bzip2 -f > "${pkg_tmp}" || \ die "Failed to create tarball" - cd .. export PYTHONPATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} python -c "import xpak; t=xpak.tbz2('${pkg_tmp}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')" if [ $? -ne 0 ]; then