distutils3_do_install wants to sed out build directory references from all binaries in ${bindir} and ${sbindir}. It tries to avoid touching symlinks by doing 'test -f' on the files as it iterates, but test always dereferences symlinks so this will touch both real files and symlinks to real files. The end result of this is that recipes which ship a script /usr/bin/foo and a symlink /usr/bin/bar -> foo, bar will be replaced with a real file which is a duplicate of foo, wasting disk space. Replace the loop with a find loop which can look at the real file type, not the target type. Signed-off-by: Ross Burton <ross.burton@...> --- meta/classes/distutils3.bbclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass index be645d37bd..0973d304f4 100644 --- a/meta/classes/distutils3.bbclass +++ b/meta/classes/distutils3.bbclass @@ -43,11 +43,9 @@ distutils3_do_install() { find ${D} -name "*.py" -exec grep -q ${D} {} \; \ -exec sed -i -e s:${D}::g {} \; - for i in ${D}${bindir}/* ${D}${sbindir}/*; do - if [ -f "$i" ]; then - sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $i - sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i - fi + for bin in $(find ${D}${bindir} ${D}${sbindir} -type f -maxdepth 1); do + sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${DISTUTILS_PYTHON}:g $bin + sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $bin
Does the same also apply to setuptools as in Tim's distutils deprecation series? If so it should definitely we be merged there