File versioned.patch of Package nodejs8.18412

Author: Adam Majer <amajer@suse.de>
Date: Tue Jul  4 15:54:34 CEST 2017
Summary: Generate versioned binaries

Generate versioned binaries and install paths
so we can allow concurrent installations and
management via update_alternatives.

This is also important for generation of binary
modules for multiple versions of NodeJS
Index: node-v8.17.0/Makefile
===================================================================
--- node-v8.17.0.orig/Makefile
+++ node-v8.17.0/Makefile
@@ -46,7 +46,7 @@ BUILDTYPE_LOWER := $(shell echo $(BUILDT
 EXEEXT := $(shell $(PYTHON) -c \
 		"import sys; print('.exe' if sys.platform == 'win32' else '')")
 
-NODE_EXE = node$(EXEEXT)
+NODE_EXE = node8$(EXEEXT)
 NODE ?= ./$(NODE_EXE)
 NODE_G_EXE = node_g$(EXEEXT)
 NPM ?= ./deps/npm/bin/npm-cli.js
Index: node-v8.17.0/tools/install.py
===================================================================
--- node-v8.17.0.orig/tools/install.py
+++ node-v8.17.0/tools/install.py
@@ -78,7 +78,7 @@ def install(paths, dst): map(lambda path
 def uninstall(paths, dst): map(lambda path: try_remove(path, dst), paths)
 
 def npm_files(action):
-  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm/'
+  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm8/'
 
   # don't install npm if the target path is a symlink, it probably means
   # that a dev version of npm is installed there
@@ -92,20 +92,20 @@ def npm_files(action):
     action(paths, target_path + dirname[9:] + '/')
 
   # create/remove symlink
-  link_path = abspath(install_path, 'bin/npm')
+  link_path = abspath(install_path, 'bin/npm8')
   if action == uninstall:
-    action([link_path], 'bin/npm')
+    action([link_path], 'bin/npm8')
   elif action == install:
-    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm/bin/npm-cli.js',link_path)
+    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm8/bin/npm-cli.js',link_path)
   else:
     assert(0) # unhandled action type
 
   # create/remove symlink
-  link_path = abspath(install_path, 'bin/npx')
+  link_path = abspath(install_path, 'bin/npx8')
   if action == uninstall:
-    action([link_path], 'bin/npx')
+    action([link_path], 'bin/npx8')
   elif action == install:
-    try_symlink('../lib/node_modules/npm/bin/npx-cli.js', link_path)
+    try_symlink("../" + sysconfig.get_config_var("LIB") + '/node_modules/npm8/bin/npx-cli.js', link_path)
   else:
     assert(0) # unhandled action type
 
@@ -119,7 +119,7 @@ def subdir_files(path, dest, action):
 
 def files(action):
   is_windows = sys.platform == 'win32'
-  output_file = 'node'
+  output_file = 'node8'
   output_prefix = 'out/Release/'
 
   if 'false' == variables.get('node_shared'):
@@ -144,7 +144,7 @@ def files(action):
     action(['out/Release/node.d'], sysconfig.get_config_var("LIB") + '/dtrace/node.d')
 
   # behave similarly for systemtap
-  action(['src/node.stp'], 'share/systemtap/tapset/')
+  action(['src/node.stp'], 'share/systemtap/tapset/node8.stp')
 
   action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
   action(['deps/v8/tools/lldbinit'], 'share/doc/node/')
@@ -153,7 +153,7 @@ def files(action):
   if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
     action(['doc/node.1'], 'man/man1/')
   else:
-    action(['doc/node.1'], 'share/man/man1/')
+    action(['doc/node.1'], 'share/man/man1/node8.1')
 
   if 'true' == variables.get('node_install_npm'): npm_files(action)
 
@@ -169,28 +169,28 @@ def headers(action):
     'src/node_buffer.h',
     'src/node_object_wrap.h',
     'src/node_version.h',
-  ], 'include/node/')
+  ], 'include/node8/')
 
   # Add the expfile that is created on AIX
   if sys.platform.startswith('aix'):
-    action(['out/Release/node.exp'], 'include/node/')
+    action(['out/Release/node.exp'], 'include/node8/')
 
-  subdir_files('deps/v8/include', 'include/node/', action)
+  subdir_files('deps/v8/include', 'include/node8/', action)
 
   if 'false' == variables.get('node_shared_libuv'):
-    subdir_files('deps/uv/include', 'include/node/', action)
+    subdir_files('deps/uv/include', 'include/node8/', action)
 
   if 'true' == variables.get('node_use_openssl') and \
      'false' == variables.get('node_shared_openssl'):
-    subdir_files('deps/openssl/openssl/include/openssl', 'include/node/openssl/', action)
-    subdir_files('deps/openssl/config/archs', 'include/node/openssl/archs', action)
-    action(['deps/openssl/config/opensslconf.h'], 'include/node/openssl/')
+    subdir_files('deps/openssl/openssl/include/openssl', 'include/node8/openssl/', action)
+    subdir_files('deps/openssl/config/archs', 'include/node8/openssl/archs', action)
+    action(['deps/openssl/config/opensslconf.h'], 'include/node8/openssl/')
 
   if 'false' == variables.get('node_shared_zlib'):
     action([
       'deps/zlib/zconf.h',
       'deps/zlib/zlib.h',
-    ], 'include/node/')
+    ], 'include/node8/')
 
 def run(args):
   global node_prefix, install_path, target_defaults, variables
Index: node-v8.17.0/doc/node.1
===================================================================
--- node-v8.17.0.orig/doc/node.1
+++ node-v8.17.0/doc/node.1
@@ -26,12 +26,12 @@
 
 .SH NAME
 
-node \- Server-side JavaScript runtime
+node8 \- Server-side JavaScript runtime
 
 
 .SH SYNOPSIS
 
-.B node
+.B node8
 .RI [ options ]
 .RI [ v8\ options ]
 .RI [ script.js \ |
@@ -43,14 +43,14 @@ node \- Server-side JavaScript runtime
 .B [--]
 .RI [ arguments ]
 .br
-.B node debug
+.B node8 debug
 .RI [ script.js " | "
 .B \-e
 .RI \&" script \&"\ |
 .IR <host>:<port> ]
 .I ...
 .br
-.B node
+.B node8
 .RB [ \-\-v8-options ]
 
 Execute without arguments to start the REPL.
Index: node-v8.17.0/src/node.stp
===================================================================
--- node-v8.17.0.orig/src/node.stp
+++ node-v8.17.0/src/node.stp
@@ -19,7 +19,7 @@
 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 // USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-probe node_net_server_connection = process("node").mark("net__server__connection")
+probe node_net_server_connection = process("node8").mark("net__server__connection")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -32,7 +32,7 @@ probe node_net_server_connection = proce
     fd);
 }
 
-probe node_net_stream_end = process("node").mark("net__stream__end")
+probe node_net_stream_end = process("node8").mark("net__stream__end")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -45,7 +45,7 @@ probe node_net_stream_end = process("nod
     fd);
 }
 
-probe node_http_server_request = process("node").mark("http__server__request")
+probe node_http_server_request = process("node8").mark("http__server__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -62,7 +62,7 @@ probe node_http_server_request = process
     fd);
 }
 
-probe node_http_server_response = process("node").mark("http__server__response")
+probe node_http_server_response = process("node8").mark("http__server__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -75,7 +75,7 @@ probe node_http_server_response = proces
     fd);
 }
 
-probe node_http_client_request = process("node").mark("http__client__request")
+probe node_http_client_request = process("node8").mark("http__client__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -92,7 +92,7 @@ probe node_http_client_request = process
     fd);
 }
 
-probe node_http_client_response = process("node").mark("http__client__response")
+probe node_http_client_response = process("node8").mark("http__client__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -105,7 +105,7 @@ probe node_http_client_response = proces
     fd);
 }
 
-probe node_gc_start = process("node").mark("gc__start")
+probe node_gc_start = process("node8").mark("gc__start")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
@@ -125,7 +125,7 @@ probe node_gc_start = process("node").ma
     flags);
 }
 
-probe node_gc_stop = process("node").mark("gc__stop")
+probe node_gc_stop = process("node8").mark("gc__stop")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
Index: node-v8.17.0/deps/npm/man/man1/npm.1
===================================================================
--- node-v8.17.0.orig/deps/npm/man/man1/npm.1
+++ node-v8.17.0/deps/npm/man/man1/npm.1
@@ -1,11 +1,11 @@
 .TH "NPM" "1" "July 2021" "" ""
 .SH "NAME"
-\fBnpm\fR \- javascript package manager
+\fBnpm8\fR \- javascript package manager
 .SS Synopsis
 .P
 .RS 2
 .nf
-npm <command> [args]
+npm8 <command> [args]
 .fi
 .RE
 .SS Version
@@ -21,7 +21,7 @@ It is extremely configurable to support
 Most commonly, it is used to publish, discover, install, and develop node
 programs\.
 .P
-Run \fBnpm help\fP to get a list of available commands\.
+Run \fBnpm8 help\fP to get a list of available commands\.
 .SS Important
 .P
 npm is configured to use npm, Inc\.'s public registry at
@@ -35,11 +35,11 @@ terms of use\.
 .P
 You probably got npm because you want to install stuff\.
 .P
-Use \fBnpm install blerg\fP to install the latest version of "blerg"\.  Check out
-npm help \fBinstall\fP for more info\.  It can do a lot of stuff\.
+Use \fBnpm8 install blerg\fP to install the latest version of "blerg"\.  Check out
+npm8 help \fBinstall\fP for more info\.  It can do a lot of stuff\.
 .P
-Use the \fBnpm search\fP command to show everything that's available\.
-Use \fBnpm ls\fP to show everything you've installed\.
+Use the \fBnpm8 search\fP command to show everything that's available\.
+Use \fBnpm8 ls\fP to show everything you've installed\.
 .SS Dependencies
 .P
 If a package references to another package with a git URL, npm depends
@@ -56,7 +56,7 @@ the node\-gyp repository \fIhttps://gith
 the node\-gyp Wiki \fIhttps://github\.com/nodejs/node\-gyp/wiki\fR\|\.
 .SS Directories
 .P
-See npm help \fBfolders\fP to learn about where npm puts stuff\.
+See npm8 help \fBfolders\fP to learn about where npm puts stuff\.
 .P
 In particular, npm has two modes of operation:
 .RS 0
@@ -81,24 +81,24 @@ following help topics:
 .RS 0
 .IP \(bu 2
 json:
-Make a package\.json file\.  See npm help \fBpackage\.json\fP\|\.
+Make a package\.json file\.  See npm8 help \fBpackage\.json\fP\|\.
 .IP \(bu 2
 link:
 For linking your current working code into Node's path, so that you
 don't have to reinstall every time you make a change\.  Use
-\fBnpm link\fP to do this\.
+\fBnpm8 link\fP to do this\.
 .IP \(bu 2
 install:
 It's a good idea to install things if you don't need the symbolic link\.
 Especially, installing other peoples code from the registry is done via
-\fBnpm install\fP
+\fBnpm8 install\fP
 .IP \(bu 2
 adduser:
 Create an account or log in\.  Credentials are stored in the
 user config file\.
 .IP \(bu 2
 publish:
-Use the \fBnpm publish\fP command to upload your code to the registry\.
+Use the \fBnpm8 publish\fP command to upload your code to the registry\.
 
 .RE
 .SS Configuration
@@ -134,7 +134,7 @@ lib/utils/config\-defs\.js\.  These must
 
 .RE
 .P
-See npm help \fBconfig\fP for much much more information\.
+See npm8 help \fBconfig\fP for much much more information\.
 .SS Contributions
 .P
 Patches welcome!
@@ -171,14 +171,14 @@ i@izs\.me
 .SS See Also
 .RS 0
 .IP \(bu 2
-npm help help
+npm8 help help
 .IP \(bu 2
-npm help package\.json
+npm8 help package\.json
 .IP \(bu 2
-npm help install
+npm8 help install
 .IP \(bu 2
-npm help config
+npm8 help config
 .IP \(bu 2
-npm help npmrc
+npm8 help npmrc
 
 .RE
Index: node-v8.17.0/node.gyp
===================================================================
--- node-v8.17.0.orig/node.gyp
+++ node-v8.17.0/node.gyp
@@ -21,8 +21,8 @@
     'node_shared_openssl%': 'false',
     'node_v8_options%': '',
     'node_enable_v8_vtunejit%': 'false',
-    'node_core_target_name%': 'node',
-    'node_lib_target_name%': 'node_lib',
+    'node_core_target_name%': 'node8',
+    'node_lib_target_name%': 'node8_lib',
     'node_intermediate_lib_type%': 'static_library',
     'library_files': [
       'lib/internal/bootstrap_node.js',
Index: node-v8.17.0/src/node_main.cc
===================================================================
--- node-v8.17.0.orig/src/node_main.cc
+++ node-v8.17.0/src/node_main.cc
@@ -21,6 +21,7 @@
 
 #include "node.h"
 #include <stdio.h>
+#include <stdlib.h>
 
 #ifdef _WIN32
 #include <windows.h>
@@ -119,6 +120,7 @@ int main(int argc, char *argv[]) {
 #endif
   // Disable stdio buffering, it interacts poorly with printf()
   // calls elsewhere in the program (e.g., any logging from V8.)
+  setenv("NODE_VERSION", "8", 0);
   setvbuf(stdout, nullptr, _IONBF, 0);
   setvbuf(stderr, nullptr, _IONBF, 0);
   return node::Start(argc, argv);
Index: node-v8.17.0/tools/test.py
===================================================================
--- node-v8.17.0.orig/tools/test.py
+++ node-v8.17.0/tools/test.py
@@ -873,7 +873,7 @@ class Context(object):
 
   def GetVm(self, arch, mode):
     if arch == 'none':
-      name = 'out/Debug/node' if mode == 'debug' else 'out/Release/node'
+      name = 'out/Debug/node' if mode == 'debug' else 'out/Release/node8'
     else:
       name = 'out/%s.%s/node' % (arch, mode)
 
openSUSE Build Service is sponsored by