File versioned.patch of Package nodejs6.12088

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-v6.14.2/node.gyp
===================================================================
--- node-v6.14.2.orig/node.gyp
+++ node-v6.14.2/node.gyp
@@ -20,8 +20,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%': 'node6',
+    'node_lib_target_name%': 'node6_lib',
     'node_intermediate_lib_type%': 'static_library',
     'library_files': [
       'lib/internal/bootstrap_node.js',
Index: node-v6.14.2/Makefile
===================================================================
--- node-v6.14.2.orig/Makefile
+++ node-v6.14.2/Makefile
@@ -37,10 +37,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 = node6$(EXEEXT)
 NODE ?= ./$(NODE_EXE)
 NODE_G_EXE = node_g$(EXEEXT)
-NPM ?= ./deps/npm/bin/npm-cli.js
+NPM ?= ./deps/npm6/bin/npm-cli.js
 
 # Flags for packaging.
 BUILD_DOWNLOAD_FLAGS ?= --download=all
Index: node-v6.14.2/tools/install.py
===================================================================
--- node-v6.14.2.orig/tools/install.py
+++ node-v6.14.2/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/npm6/'
 
   # don't install npm if the target path is a symlink, it probably means
   # that a dev version of npm is installed there
@@ -92,11 +92,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/npm6')
   if action == uninstall:
-    action([link_path], 'bin/npm')
+    action([link_path], 'bin/npm6')
   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/npm6/bin/npm-cli.js',link_path)
   else:
     assert(0) # unhandled action type
 
@@ -110,7 +110,7 @@ def subdir_files(path, dest, action):
 
 def files(action):
   is_windows = sys.platform == 'win32'
-  output_file = 'node'
+  output_file = 'node6'
   output_prefix = 'out/Release/'
 
   if 'false' == variables.get('node_shared'):
@@ -135,7 +135,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/node6.stp')
 
   action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
   action(['deps/v8/tools/lldbinit'], 'share/doc/node/')
@@ -144,7 +144,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/node6.1')
 
   if 'true' == variables.get('node_install_npm'): npm_files(action)
 
@@ -160,31 +160,31 @@ def headers(action):
     'src/node_buffer.h',
     'src/node_object_wrap.h',
     'src/node_version.h',
-  ], 'include/node/')
+  ], 'include/node6/')
 
   # 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/node6/')
 
-  subdir_files('deps/v8/include', 'include/node/', action)
+  subdir_files('deps/v8/include', 'include/node6/', action)
 
   if 'false' == variables.get('node_shared_cares'):
-    subdir_files('deps/cares/include', 'include/node/', action)
+    subdir_files('deps/cares/include', 'include/node6/', action)
 
   if 'false' == variables.get('node_shared_libuv'):
-    subdir_files('deps/uv/include', 'include/node/', action)
+    subdir_files('deps/uv/include', 'include/node6/', 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/node6/openssl/', action)
+    subdir_files('deps/openssl/config/archs', 'include/node6/openssl/archs', action)
+    action(['deps/openssl/config/opensslconf.h'], 'include/node6/openssl/')
 
   if 'false' == variables.get('node_shared_zlib'):
     action([
       'deps/zlib/zconf.h',
       'deps/zlib/zlib.h',
-    ], 'include/node/')
+    ], 'include/node6/')
 
 def run(args):
   global node_prefix, install_path, target_defaults, variables
Index: node-v6.14.2/doc/node.1
===================================================================
--- node-v6.14.2.orig/doc/node.1
+++ node-v6.14.2/doc/node.1
@@ -26,12 +26,12 @@
 
 .SH NAME
 
-node \- Server-side JavaScript runtime
+node6 \- Server-side JavaScript runtime
 
 
 .SH SYNOPSIS
 
-.B node
+.B node6
 .RI [ options ]
 .RI [ v8\ options ]
 .RI [ script.js \ |
@@ -40,14 +40,14 @@ node \- Server-side JavaScript runtime
 .B [--]
 .RI [ arguments ]
 .br
-.B node debug
+.B node6 debug
 .RI [ script.js " | "
 .B \-e
 .RI \&" script \&"\ |
 .IR <host>:<port> ]
 .I ...
 .br
-.B node
+.B node6
 .RB [ \-\-v8-options ]
 
 Execute without arguments to start the REPL.
Index: node-v6.14.2/src/node.stp
===================================================================
--- node-v6.14.2.orig/src/node.stp
+++ node-v6.14.2/src/node.stp
@@ -1,4 +1,4 @@
-probe node_net_server_connection = process("node").mark("net__server__connection")
+probe node_net_server_connection = process("node6").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("node6").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("node6").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("node6").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("node6").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("node6").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("node6").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("node6").mark("gc__stop")
 {
   scavenge = 1 << 0;
   compact = 1 << 1;
Index: node-v6.14.2/deps/npm/man/man1/npm.1
===================================================================
--- node-v6.14.2.orig/deps/npm/man/man1/npm.1
+++ node-v6.14.2/deps/npm/man/man1/npm.1
@@ -1,11 +1,11 @@
 .TH "NPM" "1" "November 2016" "" ""
 .SH "NAME"
-\fBnpm\fR \- javascript package manager
+\fBnpm6\fR \- javascript package manager
 .SH SYNOPSIS
 .P
 .RS 2
 .nf
-npm <command> [args]
+npm6 <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 \fBnpm6 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 \fBnpm6 install blerg\fP to install the latest version of "blerg"\.  Check out
+npm6 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 \fBnpm6 search\fP command to show everything that's available\.
+Use \fBnpm6 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 npm6 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 npm6 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\.
+\fBnpm6 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
+\fBnpm6 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 \fBnpm6 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 npm6 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 npm6 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 \fBnpm6 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,21 +185,21 @@ i@izs\.me
 .SH SEE ALSO
 .RS 0
 .IP \(bu 2
-npm help help
+npm6 help help
 .IP \(bu 2
 README
 .IP \(bu 2
-npm help 5 package\.json
+npm6 help 5 package\.json
 .IP \(bu 2
-npm help install
+npm6 help install
 .IP \(bu 2
-npm help config
+npm6 help config
 .IP \(bu 2
-npm help 7 config
+npm6 help 7 config
 .IP \(bu 2
-npm help 5 npmrc
+npm6 help 5 npmrc
 .IP \(bu 2
-npm help 7 index
+npm6 help 7 index
 
 .RE
 
Index: node-v6.14.2/src/node_main.cc
===================================================================
--- node-v6.14.2.orig/src/node_main.cc
+++ node-v6.14.2/src/node_main.cc
@@ -1,4 +1,5 @@
 #include "node.h"
+#include <stdlib.h>
 
 #ifdef _WIN32
 #include <windows.h>
@@ -53,6 +54,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", "6", 0);
   setvbuf(stdout, nullptr, _IONBF, 0);
   setvbuf(stderr, nullptr, _IONBF, 0);
   return node::Start(argc, argv);
Index: node-v6.14.2/tools/test.py
===================================================================
--- node-v6.14.2.orig/tools/test.py
+++ node-v6.14.2/tools/test.py
@@ -858,7 +858,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/node6'
     else:
       name = 'out/%s.%s/node' % (arch, mode)