mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-22 08:30:57 +00:00
[24.05 backport] nodejs changes (#336570)
* nodejs_18: pin to Python 3.11, fix tests with OpenSSL 3.0.14 (cherry picked from commit7c1177c514) * nodejs: use upstream patch instead of custom one (cherry picked from commitf75d50324f) * nodejs_22: 22.4.1 -> 22.5.1 (cherry picked from commit070791fba6) * nodejs: use .finalPackage for ease of overriding Previously, the nodejs `passthru.pkgs` attribute refers to the package fixed point derived in the current context, without considering potential overrides to the main nodejs package. This is fixed here with the `.finalPackage` attribute, which refers to the final package fixed point, after potential overrides. For example, previously, after overriding nodejs with `nodejs.override`, `nodejs.pkgs` would still refer to the original package, instead of the overridden one. After this fix, `nodejs.pkgs` would be correctly based on the overridden `nodejs` package. (cherry picked from commitee9a623f89) * nodejs: fix tests and disable parallel checking (cherry picked from commitd7f46fbb5c) * nodejs: disable failing tests on x86_64-darwin (cherry picked from commit31d238110c) * nodejs: skip tests failing in sandbox in all platformsce685a8422added list of tests failing on sandbox, but for some reason only for Darwin. We should skip those tests on all platforms otherwise OfBorg builds are failing. (cherry picked from commitf5846d25a1) * nodejs_20: 20.15.1 -> 20.16.0 (cherry picked from commit35b556d314) * nodejs: 22.5.1 -> 22.6.0 (#333210) (cherry picked from commit4c38d8a846) * nodejs_22: 22.6.0 -> 22.7.0 (#336556) (cherry picked from commitc455cc3170) * nodejs_20: 20.16.0 -> 20.17.0 (#336388) (cherry picked from commit45db1ff7c1) * nodejs_22: 22.7.0 -> 22.8.0 (cherry picked from commit235ae9c70f) --------- Co-authored-by: K900 <me@0upti.me> Co-authored-by: Bryan Lai <bryanlais@gmail.com> Co-authored-by: Ivan Trubach <mr.trubach@icloud.com>
This commit is contained in:
@@ -45,7 +45,13 @@ let
|
||||
(builtins.attrNames sharedLibDeps);
|
||||
|
||||
extraConfigFlags = lib.optionals (!enableNpm) [ "--without-npm" ];
|
||||
self = stdenv.mkDerivation {
|
||||
|
||||
package = stdenv.mkDerivation (finalAttrs:
|
||||
let
|
||||
/** the final package fixed point, after potential overrides */
|
||||
self = finalAttrs.finalPackage;
|
||||
in
|
||||
{
|
||||
inherit pname version;
|
||||
|
||||
src = fetchurl {
|
||||
@@ -55,10 +61,17 @@ let
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
env = lib.optionalAttrs (stdenv.isDarwin && stdenv.isx86_64) {
|
||||
env = {
|
||||
# Tell ninja to avoid ANSI sequences, otherwise we don’t see build
|
||||
# progress in Nix logs.
|
||||
#
|
||||
# Note: do not set TERM=dumb environment variable globally, it is used in
|
||||
# test-ci-js test suite to skip tests that otherwise run fine.
|
||||
NINJA = "TERM=dumb ninja";
|
||||
} // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) {
|
||||
# Make sure libc++ uses `posix_memalign` instead of `aligned_alloc` on x86_64-darwin.
|
||||
# Otherwise, nodejs would require the 11.0 SDK and macOS 10.15+.
|
||||
NIX_CFLAGS_COMPILE = "-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=101300";
|
||||
NIX_CFLAGS_COMPILE = "-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=101300 -Wno-macro-redefined";
|
||||
};
|
||||
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc openssl libuv zlib icu ];
|
||||
@@ -138,6 +151,9 @@ let
|
||||
# Note that currently stdenv does not run check phase if build ≠ host.
|
||||
doCheck = true;
|
||||
|
||||
# See https://github.com/nodejs/node/issues/22006
|
||||
enableParallelChecking = false;
|
||||
|
||||
# Some dependencies required for tools/doc/node_modules (and therefore
|
||||
# test-addons, jstest and others) target are not included in the tarball.
|
||||
# Run test targets that do not require network access.
|
||||
@@ -176,11 +192,6 @@ let
|
||||
"test-tls-cli-max-version-1.3"
|
||||
"test-tls-client-auth"
|
||||
"test-tls-sni-option"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# Disable tests that don’t work under macOS sandbox.
|
||||
"test-macos-app-sandbox"
|
||||
"test-os"
|
||||
"test-os-process-priority"
|
||||
# This is a bit weird, but for some reason fs watch tests fail with
|
||||
# sandbox.
|
||||
"test-fs-promises-watch"
|
||||
@@ -201,6 +212,16 @@ let
|
||||
"test-runner-run"
|
||||
"test-runner-watch-mode"
|
||||
"test-watch-mode-files_watcher"
|
||||
] ++ lib.optionals stdenv.buildPlatform.isDarwin [
|
||||
# Disable tests that don’t work under macOS sandbox.
|
||||
"test-macos-app-sandbox"
|
||||
"test-os"
|
||||
"test-os-process-priority"
|
||||
] ++ lib.optionals (stdenv.buildPlatform.isDarwin && stdenv.buildPlatform.isx86_64) [
|
||||
# These tests fail on x86_64-darwin (even without sandbox).
|
||||
# TODO: revisit at a later date.
|
||||
"test-fs-readv"
|
||||
"test-fs-readv-sync"
|
||||
])}"
|
||||
];
|
||||
|
||||
@@ -295,5 +316,5 @@ let
|
||||
};
|
||||
|
||||
passthru.python = python; # to ensure nodeEnv uses the same version
|
||||
};
|
||||
in self
|
||||
});
|
||||
in package
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
`/usr/bin/env` is not available.
|
||||
|
||||
--- old/test/common/assertSnapshot.js
|
||||
+++ new/test/common/assertSnapshot.js
|
||||
@@ -81,2 +81,2 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ...
|
||||
- const executable = tty ? 'tools/pseudo-tty.py' : process.execPath;
|
||||
- const args = tty ? [process.execPath, ...flags, filename] : [...flags, filename];
|
||||
+ const executable = tty ? 'python3' : process.execPath;
|
||||
+ const args = tty ? ['tools/pseudo-tty.py', process.execPath, ...flags, filename] : [...flags, filename];
|
||||
--- old/test/parallel/test-child-process-default-options.js
|
||||
+++ new/test/parallel/test-child-process-default-options.js
|
||||
@@ -35 +35 @@ if (isWindows) {
|
||||
|
||||
24
pkgs/development/web/nodejs/v18-openssl-3.0.14.patch
Normal file
24
pkgs/development/web/nodejs/v18-openssl-3.0.14.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js
|
||||
index 522dd34ad2..3f0ee2a0f9 100644
|
||||
--- a/test/parallel/test-tls-alpn-server-client.js
|
||||
+++ b/test/parallel/test-tls-alpn-server-client.js
|
||||
@@ -195,7 +195,8 @@ function TestALPNCallback() {
|
||||
|
||||
// Callback picks 2nd preference => undefined => ALPN rejected:
|
||||
assert.strictEqual(results[1].server, undefined);
|
||||
- assert.strictEqual(results[1].client.error.code, 'ECONNRESET');
|
||||
+ const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
|
||||
+ assert.ok(allowedErrors.includes(results[1].client.error.code), `'${results[1].client.error.code}' was not one of ${allowedErrors}.`);
|
||||
|
||||
TestBadALPNCallback();
|
||||
});
|
||||
@@ -218,7 +219,8 @@ function TestBadALPNCallback() {
|
||||
runTest(clientsOptions, serverOptions, function(results) {
|
||||
// Callback returns 'http/5' => doesn't match client ALPN => error & reset
|
||||
assert.strictEqual(results[0].server, undefined);
|
||||
- assert.strictEqual(results[0].client.error.code, 'ECONNRESET');
|
||||
+ const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
|
||||
+ assert.ok(allowedErrors.includes(results[0].client.error.code), `'${results[0].client.error.code}' was not one of ${allowedErrors}.`);
|
||||
|
||||
TestALPNOptionsCallback();
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, fetchpatch2, enableNpm ? true }:
|
||||
{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python311, fetchpatch2, enableNpm ? true }:
|
||||
|
||||
let
|
||||
# Clang 16+ cannot build Node v18 due to -Wenum-constexpr-conversion errors.
|
||||
@@ -14,7 +14,7 @@ let
|
||||
inherit openssl;
|
||||
stdenv = ensureCompatibleCC pkgs;
|
||||
buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; };
|
||||
python = python3;
|
||||
python = python311;
|
||||
};
|
||||
|
||||
gypPatches = callPackage ./gyp-patches.nix { } ++ [
|
||||
@@ -32,9 +32,19 @@ buildNodejs {
|
||||
./node-npm-build-npm-package-logic.patch
|
||||
./trap-handler-backport.patch
|
||||
./use-correct-env-in-tests.patch
|
||||
./v18-openssl-3.0.14.patch
|
||||
(fetchpatch2 {
|
||||
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
|
||||
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
|
||||
})
|
||||
(fetchpatch2 {
|
||||
url = "https://github.com/nodejs/node/commit/87598d4b63ef2c827a2bebdfa0f1540c35718519.patch";
|
||||
hash = "sha256-JJi8z9aaWnu/y3nZGOSUfeNzNSCYzD9dzoHXaGkeaEA=";
|
||||
includes = ["test/common/assertSnapshot.js"];
|
||||
})
|
||||
(fetchpatch2 {
|
||||
url = "https://github.com/nodejs/node/commit/d0a6b605fba6cd69a82e6f12ff0363eef8fe1ee9.patch";
|
||||
hash = "sha256-TfYal/PikRZHL6zpAlC3SmkYXCe+/8Gs83dLX/X/P/k=";
|
||||
})
|
||||
] ++ gypPatches;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ callPackage, fetchpatch2, openssl, python3, enableNpm ? true }:
|
||||
{ callPackage, openssl, python3, enableNpm ? true }:
|
||||
|
||||
let
|
||||
buildNodejs = callPackage ./nodejs.nix {
|
||||
@@ -12,16 +12,12 @@ let
|
||||
in
|
||||
buildNodejs {
|
||||
inherit enableNpm;
|
||||
version = "20.15.1";
|
||||
sha256 = "sha256-/dU6VynZNmkaKhFRBG+0iXchy4sPyir5V4I6m0D+DDQ=";
|
||||
version = "20.17.0";
|
||||
sha256 = "9abf03ac23362c60387ebb633a516303637145cb3c177be3348b16880fd8b28c";
|
||||
patches = [
|
||||
./disable-darwin-v8-system-instrumentation-node19.patch
|
||||
./bypass-darwin-xcrun-node16.patch
|
||||
./node-npm-build-npm-package-logic.patch
|
||||
./use-correct-env-in-tests.patch
|
||||
(fetchpatch2 {
|
||||
url = "https://github.com/nodejs/node/commit/534c122de166cb6464b489f3e6a9a544ceb1c913.patch";
|
||||
hash = "sha256-4q4LFsq4yU1xRwNsM1sJoNVphJCnxaVe2IyL6AeHJ/I=";
|
||||
})
|
||||
] ++ gypPatches;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ callPackage, fetchpatch2, openssl, python3, enableNpm ? true }:
|
||||
{ callPackage, openssl, python3, enableNpm ? true }:
|
||||
|
||||
let
|
||||
buildNodejs = callPackage ./nodejs.nix {
|
||||
@@ -12,8 +12,8 @@ let
|
||||
in
|
||||
buildNodejs {
|
||||
inherit enableNpm;
|
||||
version = "22.4.1";
|
||||
sha256 = "sha256-ZfyFf1qoJWqvyQCzRMARXJrq4loCVB/Vzg29Tf0cX7k=";
|
||||
version = "22.8.0";
|
||||
sha256 = "f130e82176d1ee0702d99afc1995d0061bf8ed357c38834a32a08c9ef74f1ac7";
|
||||
patches = [
|
||||
./disable-darwin-v8-system-instrumentation-node19.patch
|
||||
./bypass-darwin-xcrun-node16.patch
|
||||
|
||||
Reference in New Issue
Block a user