diff --git a/.gitignore b/.gitignore index 74a65c4..ccf0512 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,3 @@ /undici-*-nm-prod.tgz /undici-*-nm-dev.tgz /undici-*-bundled-licenses.txt - -#untared package folders -/undici* diff --git a/0001-use-system-wasm-opt-if-available.patch b/0001-use-system-wasm-opt-if-available.patch new file mode 100644 index 0000000..f3dcf60 --- /dev/null +++ b/0001-use-system-wasm-opt-if-available.patch @@ -0,0 +1,52 @@ +From 72a1eb42a3126f498fd23758e81a3a8883e8b7fa Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 13 Aug 2024 13:18:53 +0200 +Subject: [PATCH] use system wasm-opt if available + +Signed-off-by: rpm-build +--- + build/wasm.js | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/build/wasm.js b/build/wasm.js +index 2f65c0e..1880ce3 100644 +--- a/build/wasm.js ++++ b/build/wasm.js +@@ -14,6 +14,7 @@ const WASM_CC = process.env.WASM_CC || 'clang' + let WASM_CFLAGS = process.env.WASM_CFLAGS || '--sysroot=/usr/share/wasi-sysroot -target wasm32-unknown-wasi' + let WASM_LDFLAGS = process.env.WASM_LDFLAGS || '' + const WASM_LDLIBS = process.env.WASM_LDLIBS || '' ++const WASM_OPT = process.env.WASM_OPT || './wasm-opt' + + // For compatibility with Node.js' `configure --shared-builtin-undici/undici-path ...` + const EXTERNAL_PATH = process.env.EXTERNAL_PATH +@@ -77,7 +78,7 @@ const hasApk = (function () { + try { execSync('command -v apk'); return true } catch (error) { return false } + })() + const hasOptimizer = (function () { +- try { execSync('./wasm-opt --version'); return true } catch (error) { return false } ++ try { execSync(`${WASM_OPT} --version`); return true } catch (error) { return false } + })() + if (hasApk) { + // Gather information about the tools used for the build +@@ -97,7 +98,7 @@ ${join(WASM_SRC, 'src')}/*.c \ + ${WASM_LDLIBS}`, { stdio: 'inherit' }) + + if (hasOptimizer) { +- execSync(`./wasm-opt ${WASM_OPT_FLAGS} -o ${join(WASM_OUT, 'llhttp.wasm')} ${join(WASM_OUT, 'llhttp.wasm')}`, { stdio: 'inherit' }) ++ execSync(`${WASM_OPT} ${WASM_OPT_FLAGS} -o ${join(WASM_OUT, 'llhttp.wasm')} ${join(WASM_OUT, 'llhttp.wasm')}`, { stdio: 'inherit' }) + } + writeWasmChunk('llhttp.wasm', 'llhttp-wasm.js') + +@@ -109,7 +110,7 @@ ${join(WASM_SRC, 'src')}/*.c \ + ${WASM_LDLIBS}`, { stdio: 'inherit' }) + + if (hasOptimizer) { +- execSync(`./wasm-opt ${WASM_OPT_FLAGS} --enable-simd -o ${join(WASM_OUT, 'llhttp_simd.wasm')} ${join(WASM_OUT, 'llhttp_simd.wasm')}`, { stdio: 'inherit' }) ++ execSync(`${WASM_OPT} ${WASM_OPT_FLAGS} --enable-simd -o ${join(WASM_OUT, 'llhttp_simd.wasm')} ${join(WASM_OUT, 'llhttp_simd.wasm')}`, { stdio: 'inherit' }) + } + writeWasmChunk('llhttp_simd.wasm', 'llhttp_simd-wasm.js') + +-- +2.46.0 + diff --git a/nodejs-undici.spec b/nodejs-undici.spec index 6d99ca2..cf74107 100644 --- a/nodejs-undici.spec +++ b/nodejs-undici.spec @@ -8,13 +8,13 @@ # Adjust as needed. %bcond wasm_opt %[0%{?fedora} > 39] -%global llhttp_version_major 9 -%global llhttp_version_minor 3 +%global llhttp_version_major 8 +%global llhttp_version_minor 1 %global llhttp_version_patch 0 Name: nodejs-%{npm_name} Summary: An HTTP/1.1 client, written from scratch for Node.js -Version: 7.16.0 +Version: 6.19.7 Release: %autorelease License: MIT @@ -25,7 +25,8 @@ Source1: %{npm_name}-%{version}-nm-prod.tgz Source2: %{npm_name}-%{version}-nm-dev.tgz Source3: %{npm_name}-%{version}-bundled-licenses.txt Source4: %{npm_name}-sources.sh -Source5: test-runner.sh + +Patch: 0001-use-system-wasm-opt-if-available.patch # Binary artifacts in this package are aimed at the wasm32-wasi "architecture". %global _binaries_in_noarch_packages_terminate_build 0 @@ -93,10 +94,8 @@ install -p -Dt %{buildroot}%{nodejs_sitelib}/%{npm_name}/ loader.js tar -xzf %{S:2} ln -fsrt node_modules/ node_modules_dev/* ln -fsrt node_modules/.bin/ node_modules_dev/.bin/* - -# Built-in test run using borp. Some tests are ignored on purpose. -# See Source5 aka test-runner.sh for details. -bash %{S:5} || exit +# Depends on the environment/OpenSSL version, etc. Informational only. +npm --offline run test || : %files %doc README.md diff --git a/sources b/sources index c228e69..50c2e59 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ -SHA512 (undici-7.16.0-stripped.tar.gz) = 6ed7e439cc3241089137c9e9e420764cd659337d71c4fbaeec7214df6df31d1d7f0d799215b8ded7dddd7556b80fa5e60b66beeed17136db507d1c0ebd9e354a -SHA512 (undici-7.16.0-nm-prod.tgz) = 53d709c53a27eaca553515246106385c29d27993af969903c14cc6bef26826ea78f84e6b31753ccf06fef0d6e5b5830d53352451e75cc3b68ff51362a3f812ce -SHA512 (undici-7.16.0-nm-dev.tgz) = 0263dcb0ad3e64c8e798e03b4aebb07c265dc03fa538dc58c44fcea818bfbc71928adf38bc1a89696bed699423b30225101ba3f9fb214da177061a8a660813d7 -SHA512 (undici-7.16.0-bundled-licenses.txt) = 3e591adb16e09b1c6fb75eb97a6ac51cd06e0aeae2bd5950a15902346e2c9626cb50203bfd0e15c7e8c98af8f24b81c1ce6617c359e7c0e7d0a6366457c844ba +SHA512 (undici-6.19.7-stripped.tar.gz) = 5bf9c64cb511229f15a7d39cfe8dfe605ebfb375bd15325cecbb32ab24b59b4bec0cc0551d3784851861f7422ce6b0eca406d5301fdde6ac9cef83c1749e8f43 +SHA512 (undici-6.19.7-nm-prod.tgz) = 2cbee320d05fda35a88324bb6d1dd668e5aa73d978ffd7ab0c56117606032a035738b138de567883a500f2924fb87ee010a94a69a47eef61a4d913f7a2459d05 +SHA512 (undici-6.19.7-nm-dev.tgz) = 086dfb64853974a713825d022ea6053d87ab6085fb6118b220f1c09fde97ab4f07284cb66a9b7c11289123f4ab7df3f07bafc217847903ba1cc11871394294be +SHA512 (undici-6.19.7-bundled-licenses.txt) = 3e591adb16e09b1c6fb75eb97a6ac51cd06e0aeae2bd5950a15902346e2c9626cb50203bfd0e15c7e8c98af8f24b81c1ce6617c359e7c0e7d0a6366457c844ba diff --git a/test-runner.sh b/test-runner.sh deleted file mode 100755 index a3d640a..0000000 --- a/test-runner.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -e - -# Comment out for full error trace -declare -a ignored_tests=( - "test/http2.js" # Some issue with custom openSSL engine in nodejs we pack. Error:0A00018F:SSL routines::ee key too small - "test/https.js" # -/- - "test/https2.js" # -/- - "test/connect-pre-shared-session.js" # -/- - "test/h2c-client.js" # -/- - "test/connect-timeout.js" # Nodejs side issue. AssertionError [ERR_ASSERTION]: Failed - "test/pool.js" # @jstanek: fails in Koji, works on my laptop. ¯\_(ツ)_/¯ -) - -# Conditional architecture-specific ignores -ARCH=$(uname -m) - -# Add architecture-specific ignores (when any) -#if [ "$ARCH" == "x86_64" ]; then -# ignored_tests+=("test/arch-specific/x86_64/*.js") # Example: Arch-specific test for x86_64 -#elif [ "$ARCH" == "armv7l" ]; then -# ignored_tests+=("test/arch-specific/armv7l/*.js") # Example: Arch-specific test for armv7l -#fi - -# Run borp command with the ignored tests -echo "Running tests with exclusions..." -IGNORE_ARGS="" -for test in "${ignored_tests[@]}"; do - IGNORE_ARGS="$IGNORE_ARGS --ignore $test" -done - -# Run borp with the specified ignores -exec npx borp --expose-gc -p "test/*.js" $IGNORE_ARGS