From 240ffddaffc9eaff0fe436a7dbb837314018bc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Mon, 11 Aug 2025 16:22:11 +0200 Subject: [PATCH] fixup! spec: fix node binary calls to use versioned node-24 binary --- nodejs24.spec | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/nodejs24.spec b/nodejs24.spec index 9a2c5f7..95624b6 100644 --- a/nodejs24.spec +++ b/nodejs24.spec @@ -453,27 +453,18 @@ declare NPM_DIR="${RPM_BUILD_ROOT}%{nodejs_private_sitelib}/npm" # Adjust npm scripts to use the renamed interpreter readonly SHEBANG_ERE='^#!/usr/bin/(env\s+)?node\b' readonly SHEBANG_FIX='#!%{_bindir}/node-%{node_version_major}' -readonly -a npm_bin_dirs=("${NPM_DIR}/bin" "${NPM_DIR}/node_modules/node-gyp/bin") +readonly -a npm_bin_dirs=("${NPM_DIR}/bin" "${NPM_DIR}/node_modules") find "${npm_bin_dirs[@]}" -type f \ | xargs grep --extended-regexp --files-with-matches "${SHEBANG_ERE}" \ | xargs sed --regexp-extended --in-place "s;${SHEBANG_ERE};${SHEBANG_FIX};" -# Fix additional node binary calls throughout the source tree - -# Fix all JavaScript/TypeScript files with node shebangs in npm nested modules -find "${NPM_DIR}/node_modules" -type f \( -name "*.js" -o -name "*.mjs" -o -name "*.ts" \) 2>/dev/null | while read -r file; do - if grep -q "${SHEBANG_ERE}" "$file" 2>/dev/null; then - sed --regexp-extended --in-place "s;${SHEBANG_ERE};${SHEBANG_FIX};" "$file" - fi -done - # Fix shell scripts that call 'node' as command -find "${NPM_DIR}" -type f -executable | while read -r file; do - if grep -q '\bnode\s\+["`$]' "$file" 2>/dev/null; then - sed --regexp-extended --in-place 's;\bnode\s+;%{_bindir}/node-%{node_version_major} ;g' "$file" - fi -done +readonly -a known_shell_scripts=( + "${NPM_DIR}/bin/node-gyp-bin/node-gyp" + "${NPM_DIR}/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp" +) +sed --regexp-extended --in-place 's;\bnode(\s);%{_bindir}/node-%{node_version_major}\1;' "${known_shell_scripts[@]}" # Replace npm %%{_bindir} symlinks with properly versioned ones # usage: relink_bin