From 4b0cf4deecfdfaf8219d90e674c9970b20cc1b89 Mon Sep 17 00:00:00 2001 From: Seppo Yli-Olli Date: Thu, 20 Mar 2025 18:33:13 +0200 Subject: [PATCH] autotools: Fix compatibility with POSIX shell This drops support for libtool archives where names have newlines but this seems like so esoteric thing to support that it's unlikely to have any real impact. --- src/buildstream_plugins/elements/autotools.yaml | 10 +++++----- tests/cachekey/project/elements/autotools1.expected | 2 +- tests/cachekey/project/target.expected | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/buildstream_plugins/elements/autotools.yaml b/src/buildstream_plugins/elements/autotools.yaml index 0e2aa1c..75d3294 100644 --- a/src/buildstream_plugins/elements/autotools.yaml +++ b/src/buildstream_plugins/elements/autotools.yaml @@ -79,17 +79,17 @@ variables: remove-libtool-libraries: "false" delete-libtool-archives: | - if %{remove-libtool-modules} || %{remove-libtool-libraries}; then - find "%{install-root}" -name "*.la" -print0 | while read -d '' -r file; do - if grep '^shouldnotlink=yes$' "${file}" &>/dev/null; then - if %{remove-libtool-modules}; then + if [ "%{remove-libtool-modules}" = "true" ] || [ "%{remove-libtool-libraries}" = "true" ]; then + find "%{install-root}" -name "*.la" | while IFS= read -r file; do + if grep '^shouldnotlink=yes$' "${file}" >/dev/null 2>&1; then + if [ "%{remove-libtool-modules}" = "true" ]; then echo "Removing ${file}." rm "${file}" else echo "Not removing ${file}." fi else - if %{remove-libtool-libraries}; then + if [ "%{remove-libtool-libraries}" = "true" ]; then echo "Removing ${file}." rm "${file}" else diff --git a/tests/cachekey/project/elements/autotools1.expected b/tests/cachekey/project/elements/autotools1.expected index 3d73bca..9c68c25 100644 --- a/tests/cachekey/project/elements/autotools1.expected +++ b/tests/cachekey/project/elements/autotools1.expected @@ -1 +1 @@ -98ae7c344c01c64d2597338ec632e22a36f1b78ce502a9f3ed668edd0921dcb3 \ No newline at end of file +1f566532b409f730be288e6138439236d65330c98269fc5956b12e02295c433b diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected index d2a179a..07519b9 100644 --- a/tests/cachekey/project/target.expected +++ b/tests/cachekey/project/target.expected @@ -1 +1 @@ -3dc2ed8ab56f9c706e1fbf4bacc1ab1e38d20f66c686f1ab05d5ad0e504272fc \ No newline at end of file +9219dea2e49b451bbd2f8f8797ac43a31b957b51919171a3449e4d8870d2bc62