Modify PKG_INSTALL_MASK to apply only to binpkg creation.
authorBrian Harring <ferringb@chromium.org>
Fri, 13 Jan 2012 12:18:48 +0000 (04:18 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 13 Jan 2012 12:18:48 +0000 (04:18 -0800)
Primarily useful for certain cases where cros needs to suppress debug
symbols being included for specific pkgs, and/or suppressing binpkgs
from carrying sensitive configuration data, but we still wish for it
to be installed.

BUG=chromium-os:25060
TEST=set PKG_INSTALL_MASK, check ${D} vs what's in the binpkg

Change-Id: I0f81a9e394b7b0b64dbbcbe8d189876cb8421dfa

bin/misc-functions.sh

index 5a726b36b32b62d26ac97204c6266e2b1c39d36a..df0493bbe08d733de316df9ce29fdf75a8a12d4d 100755 (executable)
@@ -1101,8 +1101,16 @@ dyn_package() {
 
        # 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 "${ED}" "${PKG_INSTALL_MASK}"
+
+       local PROOT="${T}/packaging"
+       # make a temporary copy of ${D} so that any modifications we do that
+       # are binpkg specific, do not influence the actual installed image.
+       cp -la "${PORTAGE_BUILDDIR}/image" "${PROOT}" || die "failed creating packaging tree"
+
+       install_mask "${PROOT}" "${PKG_INSTALL_MASK}"
+
        local tar_options=""
        [[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
        # Sandbox is disabled in case the user wants to use a symlink
@@ -1111,7 +1119,7 @@ dyn_package() {
        [ -z "${PORTAGE_BINPKG_TMPFILE}" ] && \
                die "PORTAGE_BINPKG_TMPFILE is unset"
        mkdir -p "${PORTAGE_BINPKG_TMPFILE%/*}" || die "mkdir failed"
-       tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
+       tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${PROOT}" . | \
                $PORTAGE_BZIP2_COMMAND -c > "$PORTAGE_BINPKG_TMPFILE"
        assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
        PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
@@ -1132,6 +1140,9 @@ dyn_package() {
        [ -n "${md5_hash}" ] && \
                echo ${md5_hash} > "${PORTAGE_BUILDDIR}"/build-info/BINPKGMD5
        vecho ">>> Done."
+
+       # cleanup our temp tree
+       rm -rf "${PROOT}"
        cd "${PORTAGE_BUILDDIR}"
        >> "$PORTAGE_BUILDDIR/.packaged" || \
                die "Failed to create $PORTAGE_BUILDDIR/.packaged"