SHA256
1
0
forked from autogits/nodejs21
nodejs21/nodejs-libpath.patch
Adam Majer b1b1d9718b - Update to 21.7.1
* revert "test_runner: do not invoke after hook when test is empty"
  * lib: return directly if udp socket close before lookup
- Changes in 21.7.0
  * util.styleText(format, text): This function returns a
    formatted text considering the format passed.
  * support for multi-line values for .env file
  * sea: support embedding assets
  * vm: support using the default loader to handle dynamic import()
  * crypto: implement crypto.hash()
  * http2: add h2 compat support for appendHeader
- versioned.patch, nodejs-libpath.patch: refreshed
- c-ares-fixes.patch: upstreamed, removed

- Add libalternative config for corepack

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs21?expand=0&rev=21
2024-04-02 14:32:44 +00:00

55 lines
2.1 KiB
Diff

Index: node-v21.7.1/tools/install.py
===================================================================
--- node-v21.7.1.orig/tools/install.py
+++ node-v21.7.1/tools/install.py
@@ -6,6 +6,7 @@ import errno
import os
import shutil
import sys
+from distutils import sysconfig
import re
def abspath(*args):
@@ -66,6 +67,10 @@ def try_copy(options, path, dest):
try_unlink(target_path) # prevent ETXTBSY errors
return shutil.copy2(source_path, target_path)
+def libdir():
+ libdir_fq = sysconfig.get_config_var("LIBDIR")
+ return re.sub("^" + re.escape(node_prefix + "/"), "", libdir_fq)
+
def try_remove(options, path, dest):
source_path, target_path = mkpaths(options, path, dest)
if not options.silent:
@@ -82,7 +87,7 @@ def uninstall(options, paths, dest):
try_remove(options, path, dest)
def package_files(options, action, name, bins):
- target_path = os.path.join('lib/node_modules', name)
+ target_path = os.path.join(libdir(), 'node_modules', name)
# don't install npm if the target path is a symlink, it probably means
# that a dev version of npm is installed there
@@ -103,7 +108,7 @@ def package_files(options, action, name,
if action == uninstall:
action(options, [link_path], os.path.join('bin', bin_name))
elif action == install:
- try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
+ try_symlink(options, os.path.join('..', libdir(), 'node_modules', name, bin_target), link_path)
else:
assert 0 # unhandled action type
Index: node-v21.7.1/lib/internal/modules/cjs/loader.js
===================================================================
--- node-v21.7.1.orig/lib/internal/modules/cjs/loader.js
+++ node-v21.7.1/lib/internal/modules/cjs/loader.js
@@ -1528,7 +1528,7 @@ Module._initPaths = function() {
path.resolve(process.execPath, '..') :
path.resolve(process.execPath, '..', '..');
- const paths = [path.resolve(prefixDir, 'lib', 'node')];
+ const paths = ['/usr/lib/node'];
if (homeDir) {
ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));