Hey! While you're here, why not check out my open source endevours?

Gentoo: Catching stray files on install

File collisions can get annoying when installing packages on Gentoo. It's particularly bad when the collision is caused by a file that shouldn't even be there. Recently, I've noticed a number of Python packages that install files directly into /usr. This is usually a side-effect of upstream developers poorly using data_files in setup.py and then a Gentoo dev not catching it when writing an ebuild. (I too am guilty of this.) I've added this small function to help catch stray files and I recommend other devs use something similar:

/etc/portage/bashrc
post_pkg_preinst() {
        STATUS=0
        ebegin "Checking for stray files"
        pushd ${D} >/dev/null
        out=`find usr -maxdepth 1 -type f`
        if [ "x$out" != "x" ]; then
                STATUS=1
                for file in $out; do
                        ewarn "Stray file: /$file"
                done
        fi
        popd >/dev/null
        eend $STATUS
}
Copyright 2023 Daniel M. WeeksLoaded in 0.00131 seconds using 2048 KB