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:

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