diff mbox series

[1/2] coreutils: fix ptest build error with single-binary

Message ID 20250508072814.106107-1-ovidiu.panait@windriver.com
State New
Headers show
Series [1/2] coreutils: fix ptest build error with single-binary | expand

Commit Message

Ovidiu Panait May 8, 2025, 7:28 a.m. UTC
From: Ovidiu Panait <ovidiu.panait@windriver.com>

When coreutils has 'single-binary' PACKAGECONFIG enabled, coreutils-ptest
build fails with the following errors:
DISTRO_FEATURES:append = " ptest"
EXTRA_IMAGE_FEATURES += " ptest-pkgs"
PACKAGECONFIG:append:pn-coreutils = " single-binary"

bitbake coreutils
....
ERROR: coreutils-9.6-r0 do_package_qa: QA Issue: File /usr/lib/coreutils/ptest/src/pwd in package coreutils-ptest contains reference to TMPDIR [buildpaths]
ERROR: coreutils-9.6-r0 do_package_qa: QA Issue: coreutils-ptest: /usr/lib/coreutils/ptest/src/pwd maximum shebang size exceeded, the maximum size is 128. [shebang-size]

To fix this, use /usr/bin/env shebangs in ptest files and get rid of build
host paths.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 meta/recipes-core/coreutils/coreutils_9.6.bb | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Randy MacLeod May 12, 2025, 6 p.m. UTC | #1
On 2025-05-08 3:28 a.m., Ovidiu Panait via lists.openembedded.org wrote:
> From: Ovidiu Panait<ovidiu.panait@windriver.com>
>
> When coreutils has 'single-binary' PACKAGECONFIG enabled, coreutils-ptest
> build fails with the following errors:
> DISTRO_FEATURES:append = " ptest"
> EXTRA_IMAGE_FEATURES += " ptest-pkgs"
> PACKAGECONFIG:append:pn-coreutils = " single-binary"

Hi Ovidiu,

Fixing this issue a a good idea since the single-binary can save space:
    "rpm package reduces from 849K to 519K."
https://git.openembedded.org/openembedded-core/commit/?id=94ce5d25cad7d81b979218a40cdf15be26a7aae5

Can we fix this by adjusting the build-aux/gen-single-binary.sh script, 
ideally upstream?

Also, coreutils can generate symlinks:

  --enable-single-binary=shebangs|symlinks
                           Compile all the tools in a single binary, 
reducing
                           the overall size. When compiled this way, 
shebangs
                           (default when enabled) or symlinks are 
installed for
                           each tool that points to the single binary.

have you looked into doing that to avoid the script problem?

If you mention that in the commit log, that will help people who may have
these questions later.

Thanks,

../Randy


>
> bitbake coreutils
> ....
> ERROR: coreutils-9.6-r0 do_package_qa: QA Issue: File /usr/lib/coreutils/ptest/src/pwd in package coreutils-ptest contains reference to TMPDIR [buildpaths]
> ERROR: coreutils-9.6-r0 do_package_qa: QA Issue: coreutils-ptest: /usr/lib/coreutils/ptest/src/pwd maximum shebang size exceeded, the maximum size is 128. [shebang-size]
>
> To fix this, use /usr/bin/env shebangs in ptest files and get rid of build
> host paths.
>
> Signed-off-by: Ovidiu Panait<ovidiu.panait@windriver.com>
> ---
>   meta/recipes-core/coreutils/coreutils_9.6.bb | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/meta/recipes-core/coreutils/coreutils_9.6.bb b/meta/recipes-core/coreutils/coreutils_9.6.bb
> index b876a8fdd0..fe2cf73d40 100644
> --- a/meta/recipes-core/coreutils/coreutils_9.6.bb
> +++ b/meta/recipes-core/coreutils/coreutils_9.6.bb
> @@ -215,6 +215,12 @@ do_install_ptest () {
>
>       # handle multilib
>       sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
> +
> +    if ${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'true', 'false', d)}; then
> +        find "${D}${PTEST_PATH}/src" -type f -exec \
> +            sed -i -e 's:${B}/src/coreutils:/usr/bin/env -S coreutils:g' \
> +            {} +
> +    fi
>   }
>
>   do_install_ptest:append:libc-musl () {
> --
> 2.34.1
>
> pLK@tY:ATbOf1"dW
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#216144):https://lists.openembedded.org/g/openembedded-core/message/216144
> Mute This Topic:https://lists.openembedded.org/mt/112783421/3616765
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-core/coreutils/coreutils_9.6.bb b/meta/recipes-core/coreutils/coreutils_9.6.bb
index b876a8fdd0..fe2cf73d40 100644
--- a/meta/recipes-core/coreutils/coreutils_9.6.bb
+++ b/meta/recipes-core/coreutils/coreutils_9.6.bb
@@ -215,6 +215,12 @@  do_install_ptest () {
     
     # handle multilib
     sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
+
+    if ${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'true', 'false', d)}; then
+        find "${D}${PTEST_PATH}/src" -type f -exec \
+            sed -i -e 's:${B}/src/coreutils:/usr/bin/env -S coreutils:g' \
+            {} +
+    fi
 }
 
 do_install_ptest:append:libc-musl () {