Doing some work on my system having most of my system compiled with -pg, Portage got to spewing collisions between all the gmon.out files that got generated. Using INSTALL_MASK is insufficient, because the install mask handling generates more gmon.out files ;-). Could we please have a variable to pass custom options to the tar invocation in dyn_package? This lets me pass --exclude as well as -X and anything else useful (maybe options to preserve xattrs).
Maybe PKG_INSTALL_MASK (which is already supported) will solve your problem with the gmon.out files. Anyway, I'll do a patch to implement PORTAGE_BINPKG_TAR_OPTS.
INSTALL_MASK/PKG_INSTALL_MASK aren't sufficent because it needs full pathes to the files - AND the find invocation in install_mask() leaves gmon.out file of it's own, because it runs from ${D}. Changing it to run from ${T}, and changing the dyn_package tar to run from ${D} as well might also be an improvement.
Okay, preinst_mask() and dyn_package() (which process INSTALL_MASK and PKG_INSTALL_MASK) are both called from ${T} now. Also, preinst_mask() is called after all other functions so that INSTALL_MASK can be used to remove all gmon.out files. (In reply to comment #2) > INSTALL_MASK/PKG_INSTALL_MASK aren't sufficent because it needs full pathes to > the files Here's how install mask works: set -o noglob for no_inst in ${install_mask}; do set +o noglob rm -Rf "${root}"/${no_inst} >&/dev/null find "${root}" -path "${no_inst}" -exec rm -fR {} \; >/dev/null done It seems like you should be able to use INSTALL_MASK="gmon.out */gmon.out" to match all gmon.out files anywhere in ${D} (the first would work via rm and the second would work via find -path).
Created attachment 147606 [details, diff] PORTAGE_BINPKG_TAR_OPTS implementation and $PWD tweaks
This is fixed in 2.1.5_rc1.