On 02.12.21 18:17, Ross Burton wrote:
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.bur...@arm.com>
---
  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

          done
rm -f ${D}${PYTHON_SITEPACKAGES_DIR}/easy-install.pth





-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#159098): 
https://lists.openembedded.org/g/openembedded-core/message/159098
Mute This Topic: https://lists.openembedded.org/mt/87457521/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to