File versioned.patch of Package nodejs4.7018

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-v4.8.7/node.gyp
===================================================================
--- node-v4.8.7.orig/node.gyp
+++ node-v4.8.7/node.gyp
@@ -19,7 +19,7 @@
     'node_v8_options%': '',
     'node_enable_v8_vtunejit%': 'false',
     'node_target_type%': 'executable',
-    'node_core_target_name%': 'node',
+    'node_core_target_name%': 'node4',
     'node_module_version%': '',
     'library_files': [
       'src/node.js',
@@ -690,10 +690,10 @@
             {
               'action_name': 'node_dtrace_provider_o',
               'inputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace.o',
+                '<(OBJ_DIR)/node4/src/node_dtrace.o',
               ],
               'outputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
+                '<(OBJ_DIR)/node4/src/node_dtrace_provider.o'
               ],
               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
                 '<@(_inputs)', '-o', '<@(_outputs)' ]
@@ -743,7 +743,7 @@
                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
               ],
               'outputs': [
-                '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
+                '<(OBJ_DIR)/node4/src/node_dtrace_ustack.o'
               ],
               'conditions': [
                 [ 'target_arch=="ia32"', {
Index: node-v4.8.7/Makefile
===================================================================
--- node-v4.8.7.orig/Makefile
+++ node-v4.8.7/Makefile
@@ -33,10 +33,10 @@ BUILDTYPE_LOWER := $(shell echo $(BUILDT
 EXEEXT := $(shell $(PYTHON) -c \
 		"import sys; print('.exe' if sys.platform == 'win32' else '')")
 
-NODE_EXE = node$(EXEEXT)
+NODE_EXE = node4$(EXEEXT)
 NODE ?= ./$(NODE_EXE)
 NODE_G_EXE = node_g$(EXEEXT)
-NPM ?= ./deps/npm/bin/npm-cli.js
+NPM ?= ./deps/npm4/bin/npm-cli.js
 
 # Flags for packaging.
 BUILD_DOWNLOAD_FLAGS ?= --download=all
Index: node-v4.8.7/tools/install.py
===================================================================
--- node-v4.8.7.orig/tools/install.py
+++ node-v4.8.7/tools/install.py
@@ -82,7 +82,7 @@ def update_shebang(path, shebang):
   open(path, 'w').write(s)
 
 def npm_files(action):
-  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm/'
+  target_path = sysconfig.get_config_var("LIB") + '/node_modules/npm4/'
 
   # don't install npm if the target path is a symlink, it probably means
   # that a dev version of npm is installed there
@@ -96,11 +96,11 @@ 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/npm4')
   if action == uninstall:
-    action([link_path], 'bin/npm')
+    action([link_path], 'bin/npm4')
   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/npm4/bin/npm-cli.js',link_path)
   else:
     assert(0) # unhandled action type
 
@@ -114,7 +114,7 @@ def subdir_files(path, dest, action):
 
 def files(action):
   is_windows = sys.platform == 'win32'
-  output_file = 'node'
+  output_file = 'node4'
   output_prefix = 'out/Release/'
 
   if 'false' == variables.get('node_shared'):
@@ -136,14 +136,14 @@ 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/node4.stp')
 
   action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
 
   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/node4.1')
 
   if 'true' == variables.get('node_install_npm'): npm_files(action)
 
@@ -157,28 +157,28 @@ def headers(action):
     'src/node_buffer.h',
     'src/node_object_wrap.h',
     'src/node_version.h',
-  ], 'include/node/')
+  ], 'include/node4/')
 
   # Add the expfile that is created on AIX
   if sys.platform.startswith('aix'):
     action(['out/Release/node.exp'], 'include/node/')
 
-  subdir_files('deps/cares/include', 'include/node/', action)
-  subdir_files('deps/v8/include', 'include/node/', action)
+  subdir_files('deps/cares/include', 'include/node4/', action)
+  subdir_files('deps/v8/include', 'include/node4/', action)
 
   if 'false' == variables.get('node_shared_libuv'):
-    subdir_files('deps/uv/include', 'include/node/', action)
+    subdir_files('deps/uv/include', 'include/node4/', action)
 
   if '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/node4/openssl/', action)
+    subdir_files('deps/openssl/config/archs', 'include/node4/openssl/archs', action)
+    action(['deps/openssl/config/opensslconf.h'], 'include/node4/openssl/')
 
   if 'false' == variables.get('node_shared_zlib'):
     action([
       'deps/zlib/zconf.h',
       'deps/zlib/zlib.h',
-    ], 'include/node/')
+    ], 'include/node4/')
 
 def run(args):
   global node_prefix, install_path, target_defaults, variables
Index: node-v4.8.7/doc/node.1
===================================================================
--- node-v4.8.7.orig/doc/node.1
+++ node-v4.8.7/doc/node.1
@@ -26,12 +26,12 @@
 
 .SH NAME
 
-node \- Server-side JavaScript runtime
+node4 \- Server-side JavaScript runtime
 
 
 .SH SYNOPSIS
 
-.B node
+.B node4
 .RI [ options ]
 .RI [ v8\ options ]
 .RI [ script.js \ |
@@ -39,14 +39,14 @@ node \- Server-side JavaScript runtime
 .RI \&" script \&"]
 .RI [ arguments ]
 .br
-.B node debug
+.B node4 debug
 .RI [ script.js " | "
 .B \-e
 .RI \&" script \&"\ |
 .IR <host>:<port> ]
 .I ...
 .br
-.B node
+.B node4
 .RB [ \-\-v8-options ]
 
 Execute without arguments to start the REPL.
Index: node-v4.8.7/src/node.stp
===================================================================
--- node-v4.8.7.orig/src/node.stp
+++ node-v4.8.7/src/node.stp
@@ -1,4 +1,4 @@
-probe node_net_server_connection = process("node").mark("net__server__connection")
+probe node_net_server_connection = process("node4").mark("net__server__connection")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -11,7 +11,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("node4").mark("net__stream__end")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -24,7 +24,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("node4").mark("http__server__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -41,7 +41,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("node4").mark("http__server__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -54,7 +54,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("node4").mark("http__client__request")
 {
   remote = user_string($arg3);
   port = $arg4;
@@ -71,7 +71,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("node4").mark("http__client__response")
 {
   remote = user_string($arg2);
   port = $arg3;
@@ -84,7 +84,7 @@ probe node_http_client_response = proces
     fd);
 }
 
-probe node_gc_start = process("node").mark("gc__start")
+probe node_gc_start = process("node4").mark("gc__start")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
@@ -104,7 +104,7 @@ probe node_gc_start = process("node").ma
     flags);
 }
 
-probe node_gc_stop = process("node").mark("gc__stop")
+probe node_gc_stop = process("node4").mark("gc__stop")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
Index: node-v4.8.7/deps/npm/man/man1/npm.1
===================================================================
--- node-v4.8.7.orig/deps/npm/man/man1/npm.1
+++ node-v4.8.7/deps/npm/man/man1/npm.1
@@ -1,11 +1,11 @@
 .TH "NPM" "1" "October 2016" "" ""
 .SH "NAME"
-\fBnpm\fR \- javascript package manager
+\fBnpm4\fR \- javascript package manager
 .SH SYNOPSIS
 .P
 .RS 2
 .nf
-npm <command> [args]
+npm4 <command> [args]
 .fi
 .RE
 .SH VERSION
@@ -21,16 +21,16 @@ 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 \fBnpm4 help\fP to get a list of available commands\.
 .SH INTRODUCTION
 .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 \fBnpm\-install\fP for more info\.  It can do a lot of stuff\.
+Use \fBnpm4 install blerg\fP to install the latest version of "blerg"\.  Check out
+npm4 help \fBnpm\-install\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 \fBnpm4 search\fP command to show everything that's available\.
+Use \fBnpm4 ls\fP to show everything you've installed\.
 .SH DEPENDENCIES
 .P
 If a package references to another package with a git URL, npm depends
@@ -48,7 +48,7 @@ the node\-gyp repository \fIhttps://gith
 the node\-gyp Wiki \fIhttps://github\.com/TooTallNate/node\-gyp/wiki\fR\|\.
 .SH DIRECTORIES
 .P
-See npm help 5 \fBnpm\-folders\fP to learn about where npm puts stuff\.
+See npm4 help 5 \fBnpm\-folders\fP to learn about where npm puts stuff\.
 .P
 In particular, npm has two modes of operation:
 .RS 0
@@ -75,24 +75,24 @@ following help topics:
 .RS 0
 .IP \(bu 2
 json:
-Make a package\.json file\.  See npm help 5 \fBpackage\.json\fP\|\.
+Make a package\.json file\.  See npm4 help 5 \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\.
+\fBnpm4 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
+\fBnpm4 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 \fBnpm4 publish\fP command to upload your code to the registry\.
 
 .RE
 .SH CONFIGURATION
@@ -133,14 +133,14 @@ lib/utils/config\-defs\.js\.  These must
 
 .RE
 .P
-See npm help 7 \fBnpm\-config\fP for much much more information\.
+See npm4 help 7 \fBnpm\-config\fP for much much more information\.
 .SH CONTRIBUTIONS
 .P
 Patches welcome!
 .RS 0
 .IP \(bu 2
 code:
-Read through npm help 7 \fBnpm\-coding\-style\fP if you plan to submit code\.
+Read through npm4 help 7 \fBnpm\-coding\-style\fP if you plan to submit code\.
 You don't have to agree with it, but you do have to follow it\.
 .IP \(bu 2
 docs:
@@ -150,7 +150,7 @@ file in the "doc" folder\.  (Don't worry
 .RE
 .P
 Contributors are listed in npm's \fBpackage\.json\fP file\.  You can view them
-easily by doing \fBnpm view npm contributors\fP\|\.
+easily by doing \fBnpm4 view npm contributors\fP\|\.
 .P
 If you would like to contribute, but don't know what to work on, read
 the contributing guidelines and check the issues list\.
@@ -185,23 +185,23 @@ i@izs\.me
 .SH SEE ALSO
 .RS 0
 .IP \(bu 2
-npm help help
+npm4 help help
 .IP \(bu 2
-npm help 7 faq
+npm4 help 7 faq
 .IP \(bu 2
 README
 .IP \(bu 2
-npm help 5 package\.json
+npm4 help 5 package\.json
 .IP \(bu 2
-npm help install
+npm4 help install
 .IP \(bu 2
-npm help config
+npm4 help config
 .IP \(bu 2
-npm help 7 config
+npm4 help 7 config
 .IP \(bu 2
-npm help 5 npmrc
+npm4 help 5 npmrc
 .IP \(bu 2
-npm help 7 index
+npm4 help 7 index
 .IP \(bu 2
 npm apihelp npm
 
Index: node-v4.8.7/deps/npm/bin/npm-cli.js
===================================================================
--- node-v4.8.7.orig/deps/npm/bin/npm-cli.js
+++ node-v4.8.7/deps/npm/bin/npm-cli.js
@@ -1,4 +1,4 @@
-#!/usr/bin/env node
+#!/usr/bin/env node4
 ;(function () { // wrapper in case we're in module_context mode
 
 // windows: running "npm blah" in this folder will invoke WSH, not node.
Index: node-v4.8.7/src/node_main.cc
===================================================================
--- node-v4.8.7.orig/src/node_main.cc
+++ node-v4.8.7/src/node_main.cc
@@ -44,6 +44,7 @@ int wmain(int argc, wchar_t *wargv[]) {
 int main(int argc, char *argv[]) {
   // Disable stdio buffering, it interacts poorly with printf()
   // calls elsewhere in the program (e.g., any logging from V8.)
+  setenv("NODE_VERSION", "4", 0);
   setvbuf(stdout, nullptr, _IONBF, 0);
   setvbuf(stderr, nullptr, _IONBF, 0);
   return node::Start(argc, argv);
Index: node-v4.8.7/tools/test.py
===================================================================
--- node-v4.8.7.orig/tools/test.py
+++ node-v4.8.7/tools/test.py
@@ -881,7 +881,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/node4'
     else:
       name = 'out/%s.%s/node' % (arch, mode)
openSUSE Build Service is sponsored by