import nodejs-16.14.0-4.el9_0

This commit is contained in:
CentOS Sources 2022-05-17 04:42:19 -04:00 committed by Stepan Oksanichenko
commit 3e3166622a
10 changed files with 2110 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
SOURCES/icu4c-70_1-src.tgz
SOURCES/node-v16.14.0-stripped.tar.gz

2
.nodejs.metadata Normal file
View File

@ -0,0 +1,2 @@
f7c1363edee6be7de8b624ffbb801892b3417d4e SOURCES/icu4c-70_1-src.tgz
31555f8ebd7aaf06fe98409799e6a873a855ad3a SOURCES/node-v16.14.0-stripped.tar.gz

View File

@ -0,0 +1,29 @@
From b0b4d1ddbc720db73fb8ab13cdbbf1ce6524eebd Mon Sep 17 00:00:00 2001
From: Zuzana Svetlikova <zsvetlik@redhat.com>
Date: Fri, 17 Apr 2020 12:59:44 +0200
Subject: [PATCH 1/2] Disable running gyp on shared deps
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 93d63110ae2e3928a95d24036b86d11885ab240f..79caaec2112cefa8f6a1c947375b517e9676f176 100644
--- a/Makefile
+++ b/Makefile
@@ -136,11 +136,11 @@ endif
.PHONY: test-code-cache
with-code-cache test-code-cache:
$(warning '$@' target is a noop)
out/Makefile: config.gypi common.gypi node.gyp \
- deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
+ deps/llhttp/llhttp.gyp \
tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
$(PYTHON) tools/gyp_node.py -f make
# node_version.h is listed because the N-API version is taken from there
--
2.29.2

View File

@ -0,0 +1,397 @@
From 730dd78c897a28c3df0468ed1fc42d5817badefe Mon Sep 17 00:00:00 2001
From: Ruy Adorno <ruyadorno@hotmail.com>
Date: Wed, 2 Feb 2022 22:10:22 -0500
Subject: [PATCH] fix(ci): lock file validation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Make sure to validate any lock file (either package-lock.json or
npm-shrinkwrap.json) against the current install. This will properly
throw an error in case any of the dependencies being installed don't
match the dependencies that are currently listed in the lock file.
Fixes: https://github.com/npm/cli/issues/2701
Fixes: https://github.com/npm/cli/issues/3947
Signed-off-by: Jan Staněk <jstanek@redhat.com>
---
deps/npm/lib/commands/ci.js | 23 ++++++
deps/npm/lib/utils/validate-lockfile.js | 29 +++++++
.../smoke-tests/index.js.test.cjs | 11 +++
.../test/lib/commands/ci.js.test.cjs | 13 +++
.../lib/utils/validate-lockfile.js.test.cjs | 35 ++++++++
deps/npm/test/lib/commands/ci.js | 82 +++++++++++++++++++
deps/npm/test/lib/utils/validate-lockfile.js | 82 +++++++++++++++++++
7 files changed, 275 insertions(+)
create mode 100644 deps/npm/lib/utils/validate-lockfile.js
create mode 100644 deps/npm/tap-snapshots/test/lib/commands/ci.js.test.cjs
create mode 100644 deps/npm/tap-snapshots/test/lib/utils/validate-lockfile.js.test.cjs
create mode 100644 deps/npm/test/lib/utils/validate-lockfile.js
diff --git a/deps/npm/lib/commands/ci.js b/deps/npm/lib/commands/ci.js
index 2c2f8da..376a85d 100644
--- a/deps/npm/lib/commands/ci.js
+++ b/deps/npm/lib/commands/ci.js
@@ -6,6 +6,7 @@ const runScript = require('@npmcli/run-script')
const fs = require('fs')
const readdir = util.promisify(fs.readdir)
const log = require('../utils/log-shim.js')
+const validateLockfile = require('../utils/validate-lockfile.js')
const removeNodeModules = async where => {
const rimrafOpts = { glob: false }
@@ -55,6 +56,28 @@ class CI extends ArboristWorkspaceCmd {
}),
removeNodeModules(where),
])
+
+ // retrieves inventory of packages from loaded virtual tree (lock file)
+ const virtualInventory = new Map(arb.virtualTree.inventory)
+
+ // build ideal tree step needs to come right after retrieving the virtual
+ // inventory since it's going to erase the previous ref to virtualTree
+ await arb.buildIdealTree()
+
+ // verifies that the packages from the ideal tree will match
+ // the same versions that are present in the virtual tree (lock file)
+ // throws a validation error in case of mismatches
+ const errors = validateLockfile(virtualInventory, arb.idealTree.inventory)
+ if (errors.length) {
+ throw new Error(
+ '`npm ci` can only install packages when your package.json and ' +
+ 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' +
+ 'update your lock file with `npm install` ' +
+ 'before continuing.\n\n' +
+ errors.join('\n') + '\n'
+ )
+ }
+
await arb.reify(opts)
const ignoreScripts = this.npm.config.get('ignore-scripts')
diff --git a/deps/npm/lib/utils/validate-lockfile.js b/deps/npm/lib/utils/validate-lockfile.js
new file mode 100644
index 0000000..29161ec
--- /dev/null
+++ b/deps/npm/lib/utils/validate-lockfile.js
@@ -0,0 +1,29 @@
+// compares the inventory of package items in the tree
+// that is about to be installed (idealTree) with the inventory
+// of items stored in the package-lock file (virtualTree)
+//
+// Returns empty array if no errors found or an array populated
+// with an entry for each validation error found.
+function validateLockfile (virtualTree, idealTree) {
+ const errors = []
+
+ // loops through the inventory of packages resulted by ideal tree,
+ // for each package compares the versions with the version stored in the
+ // package-lock and adds an error to the list in case of mismatches
+ for (const [key, entry] of idealTree.entries()) {
+ const lock = virtualTree.get(key)
+
+ if (!lock) {
+ errors.push(`Missing: ${entry.name}@${entry.version} from lock file`)
+ continue
+ }
+
+ if (entry.version !== lock.version) {
+ errors.push(`Invalid: lock file's ${lock.name}@${lock.version} does ` +
+ `not satisfy ${entry.name}@${entry.version}`)
+ }
+ }
+ return errors
+}
+
+module.exports = validateLockfile
diff --git a/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs b/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs
index c1316e0..5fa3977 100644
--- a/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs
+++ b/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs
@@ -40,6 +40,17 @@ Configuration fields: npm help 7 config
npm {CWD}
+`
+
+exports[`smoke-tests/index.js TAP npm ci > should throw mismatch deps in lock file error 1`] = `
+npm ERR! \`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing.
+npm ERR!
+npm ERR! Invalid: lock file's abbrev@1.0.4 does not satisfy abbrev@1.1.1
+npm ERR!
+
+npm ERR! A complete log of this run can be found in:
+
+
`
exports[`smoke-tests/index.js TAP npm diff > should have expected diff output 1`] = `
diff --git a/deps/npm/tap-snapshots/test/lib/commands/ci.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/ci.js.test.cjs
new file mode 100644
index 0000000..d6a7471
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/commands/ci.js.test.cjs
@@ -0,0 +1,13 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/commands/ci.js TAP should throw error when ideal inventory mismatches virtual > must match snapshot 1`] = `
+\`npm ci\` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with \`npm install\` before continuing.
+
+Invalid: lock file's foo@1.0.0 does not satisfy foo@2.0.0
+
+`
diff --git a/deps/npm/tap-snapshots/test/lib/utils/validate-lockfile.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/validate-lockfile.js.test.cjs
new file mode 100644
index 0000000..98a5126
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/utils/validate-lockfile.js.test.cjs
@@ -0,0 +1,35 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/utils/validate-lockfile.js TAP extra inventory items on idealTree > should have missing entries error 1`] = `
+Array [
+ "Missing: baz@3.0.0 from lock file",
+]
+`
+
+exports[`test/lib/utils/validate-lockfile.js TAP extra inventory items on virtualTree > should have no errors if finding virtualTree extra items 1`] = `
+Array []
+`
+
+exports[`test/lib/utils/validate-lockfile.js TAP identical inventory for both idealTree and virtualTree > should have no errors on identical inventories 1`] = `
+Array []
+`
+
+exports[`test/lib/utils/validate-lockfile.js TAP mismatching versions on inventory > should have errors for each mismatching version 1`] = `
+Array [
+ "Invalid: lock file's foo@1.0.0 does not satisfy foo@2.0.0",
+ "Invalid: lock file's bar@2.0.0 does not satisfy bar@3.0.0",
+]
+`
+
+exports[`test/lib/utils/validate-lockfile.js TAP missing virtualTree inventory > should have errors for each mismatching version 1`] = `
+Array [
+ "Missing: foo@1.0.0 from lock file",
+ "Missing: bar@2.0.0 from lock file",
+ "Missing: baz@3.0.0 from lock file",
+]
+`
diff --git a/deps/npm/test/lib/commands/ci.js b/deps/npm/test/lib/commands/ci.js
index 537d078..e077c99 100644
--- a/deps/npm/test/lib/commands/ci.js
+++ b/deps/npm/test/lib/commands/ci.js
@@ -19,6 +19,17 @@ t.test('should ignore scripts with --ignore-scripts', async t => {
this.reify = () => {
REIFY_CALLED = true
}
+ this.buildIdealTree = () => {}
+ this.virtualTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
+ this.idealTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
},
})
@@ -99,6 +110,17 @@ t.test('should use Arborist and run-script', async t => {
this.reify = () => {
t.ok(true, 'reify is called')
}
+ this.buildIdealTree = () => {}
+ this.virtualTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
+ this.idealTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
},
rimraf: (path, ...args) => {
actualRimrafs++
@@ -138,6 +160,17 @@ t.test('should pass flatOptions to Arborist.reify', async t => {
this.reify = async (options) => {
t.equal(options.production, true, 'should pass flatOptions to Arborist.reify')
}
+ this.buildIdealTree = () => {}
+ this.virtualTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
+ this.idealTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
},
})
const npm = mockNpm({
@@ -218,6 +251,17 @@ t.test('should remove existing node_modules before installing', async t => {
const nodeModules = contents.filter((path) => path.startsWith('node_modules'))
t.same(nodeModules, ['node_modules'], 'should only have the node_modules directory')
}
+ this.buildIdealTree = () => {}
+ this.virtualTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
+ this.idealTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
},
})
@@ -231,3 +275,41 @@ t.test('should remove existing node_modules before installing', async t => {
await ci.exec(null)
})
+
+t.test('should throw error when ideal inventory mismatches virtual', async t => {
+ const CI = t.mock('../../../lib/commands/ci.js', {
+ '../../../lib/utils/reify-finish.js': async () => {},
+ '@npmcli/run-script': ({ event }) => {},
+ '@npmcli/arborist': function () {
+ this.loadVirtual = async () => {}
+ this.reify = () => {}
+ this.buildIdealTree = () => {}
+ this.virtualTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ]),
+ }
+ this.idealTree = {
+ inventory: new Map([
+ ['foo', { name: 'foo', version: '2.0.0' }],
+ ]),
+ }
+ },
+ })
+
+ const npm = mockNpm({
+ globalDir: 'path/to/node_modules/',
+ prefix: 'foo',
+ config: {
+ global: false,
+ 'ignore-scripts': true,
+ },
+ })
+ const ci = new CI(npm)
+
+ try {
+ await ci.exec([])
+ } catch (err) {
+ t.matchSnapshot(err.message)
+ }
+})
diff --git a/deps/npm/test/lib/utils/validate-lockfile.js b/deps/npm/test/lib/utils/validate-lockfile.js
new file mode 100644
index 0000000..25939c5
--- /dev/null
+++ b/deps/npm/test/lib/utils/validate-lockfile.js
@@ -0,0 +1,82 @@
+const t = require('tap')
+const validateLockfile = require('../../../lib/utils/validate-lockfile.js')
+
+t.test('identical inventory for both idealTree and virtualTree', async t => {
+ t.matchSnapshot(
+ validateLockfile(
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ]),
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ])
+ ),
+ 'should have no errors on identical inventories'
+ )
+})
+
+t.test('extra inventory items on idealTree', async t => {
+ t.matchSnapshot(
+ validateLockfile(
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ]),
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ['baz', { name: 'baz', version: '3.0.0' }],
+ ])
+ ),
+ 'should have missing entries error'
+ )
+})
+
+t.test('extra inventory items on virtualTree', async t => {
+ t.matchSnapshot(
+ validateLockfile(
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ['baz', { name: 'baz', version: '3.0.0' }],
+ ]),
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ])
+ ),
+ 'should have no errors if finding virtualTree extra items'
+ )
+})
+
+t.test('mismatching versions on inventory', async t => {
+ t.matchSnapshot(
+ validateLockfile(
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ]),
+ new Map([
+ ['foo', { name: 'foo', version: '2.0.0' }],
+ ['bar', { name: 'bar', version: '3.0.0' }],
+ ])
+ ),
+ 'should have errors for each mismatching version'
+ )
+})
+
+t.test('missing virtualTree inventory', async t => {
+ t.matchSnapshot(
+ validateLockfile(
+ new Map([]),
+ new Map([
+ ['foo', { name: 'foo', version: '1.0.0' }],
+ ['bar', { name: 'bar', version: '2.0.0' }],
+ ['baz', { name: 'baz', version: '3.0.0' }],
+ ])
+ ),
+ 'should have errors for each mismatching version'
+ )
+})
--
2.35.1

View File

@ -0,0 +1,61 @@
diff --git a/configure.py b/configure.py
index 895a0869cb..791c3e4a62 100755
--- a/configure.py
+++ b/configure.py
@@ -722,6 +722,12 @@ parser.add_argument('--shared',
help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)')
+parser.add_argument('--libdir',
+ action='store',
+ dest='libdir',
+ default='lib',
+ help='a directory to install the shared library into')
+
parser.add_argument('--without-v8-platform',
action='store_true',
dest='without_v8_platform',
@@ -1293,6 +1299,7 @@ def configure_node(o):
o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_shared'] = b(options.shared)
+ o['variables']['libdir'] = options.libdir
node_module_version = getmoduleversion.get_version()
if options.dest_os == 'android':
diff --git a/tools/install.py b/tools/install.py
index 045d406d84..b3ef454199 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -121,22 +121,19 @@ def subdir_files(path, dest, action):
def files(action):
is_windows = sys.platform == 'win32'
- output_file = 'node'
output_prefix = 'out/Release/'
+ output_libprefix = output_prefix
- if 'false' == variables.get('node_shared'):
- if is_windows:
- output_file += '.exe'
+ if is_windows:
+ output_bin = 'node.exe'
+ output_lib = 'node.dll'
else:
- if is_windows:
- output_file += '.dll'
- else:
- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix')
+ output_bin = 'node'
+ output_lib = 'libnode.' + variables.get('shlib_suffix')
- if 'false' == variables.get('node_shared'):
- action([output_prefix + output_file], 'bin/' + output_file)
- else:
- action([output_prefix + output_file], 'lib/' + output_file)
+ action([output_prefix + output_bin], 'bin/' + output_bin)
+ if 'true' == variables.get('node_shared'):
+ action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib)
if 'true' == variables.get('node_use_dtrace'):
action(['out/Release/node.d'], 'lib/dtrace/node.d')

151
SOURCES/btest402.js Normal file
View File

@ -0,0 +1,151 @@
// Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
// This file is part of the Node.JS ICU enablement work
// https://github.com/joyent/node/pull/7719
// and is under the same license.
//
// This is a very, very, very basic test of es402
//
// URL: https://github.com/srl295/btest402
// Author: Steven R. Loomis <srl@icu-project.org>
//
// for a complete test, see http://test262.ecmascript.org
//
// Usage: node btest402.js
try {
console.log("You have console.log.");
} catch(e) {
// this works on d8
console = { log: print };
console.log("Now you have console.log.");
}
function runbtest() {
var summary = {};
try {
var i = Intl;
summary.haveIntl = true;
console.log("+ Congrats, you have the Intl object.");
} catch(e) {
console.log("You don't have the Intl object: " + e);
}
if(summary.haveIntl) {
var locs = [ "en", "mt", "ja","tlh"];
var d = new Date(196400000);
for ( var n=0; n<locs.length; n++ ) {
var loc = locs[n];
var lsummary = summary[loc] = {};
console.log(loc+":");
var sl=null;
try {
sl = Intl.DateTimeFormat.supportedLocalesOf([loc]);
if( sl.length > 0 ) {
lsummary.haveSlo = true;
}
} catch (e) {
console.log("SLO err: " + e);
}
var dstr = "ERR";
try {
lsummary.dstr = d.toLocaleString(loc,{month: "long",day:"numeric",weekday:"long",year:"numeric"});
console.log(" date: (supported:"+sl+") " + lsummary.dstr);
} catch (e) {
console.log(" Date Format err: " + e);
}
try {
new Intl.v8BreakIterator();
console.log(" Intl.v8BreakIterator:" +
Intl.v8BreakIterator.supportedLocalesOf(loc) + " Supported, first()==" +
new Intl.v8BreakIterator(loc).first() );
lsummary.brkOk = true;
} catch ( e) {
console.log(" Intl.v8BreakIterator error (NOT part of EcmaScript402): " + e);
}
console.log();
}
}
// print summary
console.log();
console.log("--------- Analysis ---------");
stxt = "";
if( summary.haveIntl ) {
console.log("* You have the 'Intl' object. Congratulations! You have the possibility of being EcmaScript 402 compliant.");
stxt += "Have Intl, ";
if ( !summary.en.haveSlo ) {
stxt += "Date:no EN, ";
console.log("* English isn't a supported language by the date formatter. Perhaps the data isn't installed properly?");
}
if ( !summary.tlh.haveSlo ) {
stxt += "Date:no 'tlh', ";
console.log("* Klingon isn't a supported language by the date formatter. It is without honor!");
}
// now, what is it actually saying
if( summary.en.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'en', ";
console.log("* the English date format text looks bad to me. Doesn't even have the year.");
} else {
if( summary.en.dstr.indexOf("Jan") == -1) {
stxt += "Date:bad 'en', ";
console.log("* The English date format text looks bad to me. Doesn't have the right month.");
}
}
if( summary.mt.dstr == summary.en.dstr ) {
stxt += "Date:'mt'=='en', ";
console.log("* The English and Maltese look the same to me. Probably a 'small' build.");
} else if( summary.mt.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'mt', ";
console.log("* the Maltese date format text looks bad to me. Doesn't even have the year. (This data is missing from the Chromium ICU build)");
} else {
if( summary.mt.dstr.indexOf("Jann") == -1) {
stxt += "Date:bad 'mt', ";
console.log("* The Maltese date format text looks bad to me. Doesn't have the right month. (This data is missing from the Chromium ICU build)");
}
}
if ( !summary.ja.haveSlo ) {
stxt += "Date:no 'ja', ";
console.log("* Japanese isn't a supported language by the date formatter. Could be a 'small' build.");
} else {
if( summary.ja.dstr.indexOf("1970") == -1) {
stxt += "Date:bad 'ja', ";
console.log("* the Japanese date format text looks bad to me. Doesn't even have the year.");
} else {
if( summary.ja.dstr.indexOf("日") == -1) {
stxt += "Date:bad 'ja', ";
console.log("* The Japanese date format text looks bad to me.");
}
}
}
if ( summary.en.brkOk ) {
stxt += "FYI: v8Brk:have 'en', ";
console.log("* You have Intl.v8BreakIterator support. (Note: not part of ES402.)");
}
} else {
console.log("* You don't have the 'Intl' object. You aren't EcmaScript 402 compliant.");
stxt += " NO Intl. ";
}
// 1-liner.
console.log();
console.log("----------------");
console.log( "SUMMARY:" + stxt );
}
var dorun = true;
try {
if(btest402_noautorun) {
dorun = false;
}
} catch(e) {}
if(dorun) {
console.log("Running btest..");
runbtest();
}

203
SOURCES/nodejs-tarball.sh Executable file
View File

@ -0,0 +1,203 @@
#!/bin/sh
# Uses Argbash to generate command argument parsing. To update
# arguments, make sure to call
# `argbash nodejs-tarball.sh -o nodejs-tarball.sh`
# ARG_POSITIONAL_SINGLE([version],[Node.js release version],[""])
# ARG_DEFAULTS_POS([])
# ARG_HELP([Tool to aid in Node.js packaging of new releases])
# ARGBASH_GO()
# needed because of Argbash --> m4_ignore([
### START OF CODE GENERATED BY Argbash v2.8.1 one line above ###
# Argbash is a bash code generator used to get arguments parsing right.
# Argbash is FREE SOFTWARE, see https://argbash.io for more info
die()
{
local _ret=$2
test -n "$_ret" || _ret=1
test "$_PRINT_HELP" = yes && print_help >&2
echo "$1" >&2
exit ${_ret}
}
begins_with_short_option()
{
local first_option all_short_options='h'
first_option="${1:0:1}"
test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
}
# THE DEFAULTS INITIALIZATION - POSITIONALS
_positionals=()
_arg_version=""
# THE DEFAULTS INITIALIZATION - OPTIONALS
print_help()
{
printf '%s\n' "Tool to aid in Node.js packaging of new releases"
printf 'Usage: %s [-h|--help] [<version>]\n' "$0"
printf '\t%s\n' "<version>: Node.js release version (default: '""')"
printf '\t%s\n' "-h, --help: Prints help"
}
parse_commandline()
{
_positionals_count=0
while test $# -gt 0
do
_key="$1"
case "$_key" in
-h|--help)
print_help
exit 0
;;
-h*)
print_help
exit 0
;;
*)
_last_positional="$1"
_positionals+=("$_last_positional")
_positionals_count=$((_positionals_count + 1))
;;
esac
shift
done
}
handle_passed_args_count()
{
test "${_positionals_count}" -le 1 || _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect between 0 and 1, but got ${_positionals_count} (the last one was: '${_last_positional}')." 1
}
assign_positional_args()
{
local _positional_name _shift_for=$1
_positional_names="_arg_version "
shift "$_shift_for"
for _positional_name in ${_positional_names}
do
test $# -gt 0 || break
eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1
shift
done
}
parse_commandline "$@"
handle_passed_args_count
assign_positional_args 1 "${_positionals[@]}"
# OTHER STUFF GENERATED BY Argbash
### END OF CODE GENERATED BY Argbash (sortof) ### ])
# [ <-- needed because of Argbash
set -e
echo $_arg_version
if [ x$_arg_version != x ]; then
version=$_arg_version
else
version=$(rpm -q --specfile --qf='%{version}\n' nodejs.spec | head -n1)
fi
rm -f node-v${version}.tar.gz node-v${version}-stripped.tar.gz
wget http://nodejs.org/dist/v${version}/node-v${version}.tar.gz \
http://nodejs.org/dist/v${version}/SHASUMS256.txt
sha256sum -c SHASUMS256.txt --ignore-missing
tar -zxf node-v${version}.tar.gz
rm -rf node-v${version}/deps/openssl
tar -zcf node-v${version}-stripped.tar.gz node-v${version}
# Download the matching version of ICU
rm -f icu4c*-src.tgz icu.md5
ICUMD5=$(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].md5')
wget $(cat node-v${version}/tools/icu/current_ver.dep |jq -r '.[0].url')
ICUTARBALL=$(ls -1 icu4c*-src.tgz)
echo "$ICUMD5 $ICUTARBALL" > icu.md5
md5sum -c icu.md5
rm -f icu.md5 SHASUMS256.txt
#fedpkg new-sources node-v${version}-stripped.tar.gz icu4c*-src.tgz
rm -f node-v${version}.tar.gz
set +e
# Determine the bundled versions of the various packages
echo "Bundled software versions"
echo "-------------------------"
echo
echo "libnode shared object version"
echo "========================="
grep "define NODE_MODULE_VERSION" node-v${version}/src/node_version.h
echo
echo "V8"
echo "========================="
grep "define V8_MAJOR_VERSION" node-v${version}/deps/v8/include/v8-version.h
grep "define V8_MINOR_VERSION" node-v${version}/deps/v8/include/v8-version.h
grep "define V8_BUILD_NUMBER" node-v${version}/deps/v8/include/v8-version.h
grep "define V8_PATCH_LEVEL" node-v${version}/deps/v8/include/v8-version.h
echo
echo "c-ares"
echo "========================="
grep "define ARES_VERSION_MAJOR" node-v${version}/deps/cares/include/ares_version.h
grep "define ARES_VERSION_MINOR" node-v${version}/deps/cares/include/ares_version.h
grep "define ARES_VERSION_PATCH" node-v${version}/deps/cares/include/ares_version.h
echo
echo "llhttp"
echo "========================="
grep "define LLHTTP_VERSION_MAJOR" node-v${version}/deps/llhttp/include/llhttp.h
grep "define LLHTTP_VERSION_MINOR" node-v${version}/deps/llhttp/include/llhttp.h
grep "define LLHTTP_VERSION_PATCH" node-v${version}/deps/llhttp/include/llhttp.h
echo
echo "libuv"
echo "========================="
grep "define UV_VERSION_MAJOR" node-v${version}/deps/uv/include/uv/version.h
grep "define UV_VERSION_MINOR" node-v${version}/deps/uv/include/uv/version.h
grep "define UV_VERSION_PATCH" node-v${version}/deps/uv/include/uv/version.h
echo
echo "nghttp2"
echo "========================="
grep "define NGHTTP2_VERSION " node-v${version}/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
echo
echo "nghttp3"
echo "========================="
grep "define NGHTTP3_VERSION " node-v${version}/deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
echo
echo "ngtcp2"
echo "========================="
grep "define NGTCP2_VERSION " node-v${version}/deps/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h
echo
echo "ICU"
echo "========================="
grep "url" node-v${version}/tools/icu/current_ver.dep
echo
echo "punycode"
echo "========================="
grep "'version'" node-v${version}/lib/punycode.js
echo
echo "uvwasi"
echo "========================="
grep "define UVWASI_VERSION_MAJOR" node-v${version}/deps/uvwasi/include/uvwasi.h
grep "define UVWASI_VERSION_MINOR" node-v${version}/deps/uvwasi/include/uvwasi.h
grep "define UVWASI_VERSION_PATCH" node-v${version}/deps/uvwasi/include/uvwasi.h
echo
echo "npm"
echo "========================="
grep "\"version\":" node-v${version}/deps/npm/package.json
echo
echo "Make sure these versions match what is in the RPM spec file"
rm -rf node-v${version}
# ] <-- needed because of Argbash

View File

@ -0,0 +1,2 @@
%__nodejs_native_requires %{_rpmconfigdir}/nodejs_native.req
%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$

2
SOURCES/npmrc Normal file
View File

@ -0,0 +1,2 @@
prefix=/usr/local
python=/usr/bin/python3

1261
SPECS/nodejs.spec Normal file

File diff suppressed because it is too large Load Diff