From 4591525cb28c4363d0ddd635b364392242fadb31 Mon Sep 17 00:00:00 2001 From: webbuilder_pel7ppc64lebuilder0 Date: Mon, 27 Jul 2020 11:09:11 +0200 Subject: [PATCH] nodejs update to 10.16.3 Signed-off-by: webbuilder_pel7ppc64lebuilder0 --- SOURCES/nodejs-glob-tap.patch | 46 ++++ SOURCES/nodejs-tarball.sh | 185 +++++++++++++++- SOURCES/npmrc | 1 + SPECS/nodejs.spec | 394 ++++++++++++++++++++++++++-------- 4 files changed, 529 insertions(+), 97 deletions(-) create mode 100644 SOURCES/nodejs-glob-tap.patch create mode 100644 SOURCES/npmrc diff --git a/SOURCES/nodejs-glob-tap.patch b/SOURCES/nodejs-glob-tap.patch new file mode 100644 index 0000000..daad26d --- /dev/null +++ b/SOURCES/nodejs-glob-tap.patch @@ -0,0 +1,46 @@ +commit 8829452ae5502eef21846d86609f15dc47c56044 +Author: Tom Hughes +Date: Fri Jan 1 11:19:26 2016 +0000 + + Fix tests to work with older version of tap + +diff --git a/test/global-leakage.js b/test/global-leakage.js +index 238990c..7843495 100644 +--- a/test/global-leakage.js ++++ b/test/global-leakage.js +@@ -1,5 +1,5 @@ + if (require.main === module) +- return require('tap').pass('ok') ++ return require('tap').test('').pass('ok') + + var before = Object.keys(global).sort().filter(function (t) { + return t !== '__coverage__' +diff --git a/test/multiple-weird-error.js b/test/multiple-weird-error.js +index 4a9e45e..9285dfb 100644 +--- a/test/multiple-weird-error.js ++++ b/test/multiple-weird-error.js +@@ -1,4 +1,4 @@ +-var t = require('tap') ++var tap = require('tap') + var fs = require('fs') + fs.readdir = function(path, cb) { cb(new Error('expected')) } + var glob = require('../') +@@ -6,10 +6,12 @@ var glob = require('../') + // also test that silent:true is actually silent! + console.error = function () { throw 'SILENCE, INSECT!' } + +-t.plan(2) +-glob('*', { silent: true }, function(err, files) { +- t.ok(err, 'got first error') +-}) +-glob('*', { silent: true }, function(err, files) { +- t.ok(err, 'got second error') ++tap.test("unexpected errors", function (t) { ++ t.plan(2) ++ glob('*', { silent: true }, function(err, files) { ++ t.ok(err, 'got first error') ++ }) ++ glob('*', { silent: true }, function(err, files) { ++ t.ok(err, 'got second error') ++ }) + }) diff --git a/SOURCES/nodejs-tarball.sh b/SOURCES/nodejs-tarball.sh index 237ae13..582d7c4 100755 --- a/SOURCES/nodejs-tarball.sh +++ b/SOURCES/nodejs-tarball.sh @@ -1,10 +1,187 @@ #!/bin/sh +# Uses Argbash to generate command argument parsing. To update +# arguments, make sure to call +# `argbash nodejs-tarball.sh -o nodejs-tarball.sh` -version=$(rpm -q --specfile --qf='%{version}\n' nodejs.spec | head -n1) -rm -f node-v${version}.tar.gz -wget http://nodejs.org/dist/v${version}/node-v${version}.tar.gz +# 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] []\n' "$0" + printf '\t%s\n' ": 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} -fedpkg new-sources node-v${version}-stripped.tar.gz +# 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 + +# 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 "http-parser" +echo "=========================" +grep "define HTTP_PARSER_VERSION_MAJOR" node-v${version}/deps/http_parser/http_parser.h +grep "define HTTP_PARSER_VERSION_MINOR" node-v${version}/deps/http_parser/http_parser.h +grep "define HTTP_PARSER_VERSION_PATCH" node-v${version}/deps/http_parser/http_parser.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 "libuv" +echo "=========================" +grep "define NGHTTP2_VERSION " node-v${version}/deps/nghttp2/lib/includes/nghttp2/nghttp2ver.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 "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 diff --git a/SOURCES/npmrc b/SOURCES/npmrc new file mode 100644 index 0000000..10437ca --- /dev/null +++ b/SOURCES/npmrc @@ -0,0 +1 @@ +prefix=/usr/local diff --git a/SPECS/nodejs.spec b/SPECS/nodejs.spec index 2813a8a..38200e8 100644 --- a/SPECS/nodejs.spec +++ b/SPECS/nodejs.spec @@ -1,17 +1,16 @@ -%global with_debug 1 - -# PowerPC and s390x segfault during Debug builds -# https://github.com/nodejs/node/issues/20642 -%ifarch %{power64} s390x -%global with_debug 0 -%define _smp_mflags -j16 -%endif - # bundle dependencies that are not available as Fedora modules # %%{!?_with_bootstrap: %%global bootstrap 1} # use bcond for building modules %bcond_with bootstrap +# == Master Relase == +# This is used by both the nodejs package and the npm subpackage thar +# has a separate version - the name is special so that rpmdev-bumpspec +# will bump this rather than adding .1 to the end. +%global baserelease 1 + +%global _smp_mflags -j16 + %{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} # == Node.js Version == @@ -21,14 +20,19 @@ # than a Fedora release lifecycle. %global nodejs_epoch 1 %global nodejs_major 10 -%global nodejs_minor 15 -%global nodejs_patch 0 +%global nodejs_minor 16 +%global nodejs_patch 3 %global nodejs_abi %{nodejs_major}.%{nodejs_minor} +%global nodejs_soversion 64 %global nodejs_version %{nodejs_major}.%{nodejs_minor}.%{nodejs_patch} -%global nodejs_release 1 +%global nodejs_release %{baserelease} + +%global nodejs_datadir %{_datarootdir}/nodejs # == Bundled Dependency Versions == # v8 - from deps/v8/include/v8-version.h +# Epoch is set to ensure clean upgrades from the old v8 package +%global v8_epoch 1 %global v8_major 6 %global v8_minor 8 %global v8_build 275 @@ -36,6 +40,7 @@ # V8 presently breaks ABI at least every x.y release while never bumping SONAME %global v8_abi %{v8_major}.%{v8_minor} %global v8_version %{v8_major}.%{v8_minor}.%{v8_build}.%{v8_patch} +%global v8_release %{nodejs_epoch}.%{nodejs_major}.%{nodejs_minor}.%{nodejs_patch}.%{nodejs_release} # c-ares - from deps/cares/include/ares_version.h # https://github.com/nodejs/node/pull/9332 @@ -52,26 +57,24 @@ # libuv - from deps/uv/include/uv/version.h %global libuv_major 1 -%global libuv_minor 23 -%global libuv_patch 2 +%global libuv_minor 28 +%global libuv_patch 0 %global libuv_version %{libuv_major}.%{libuv_minor}.%{libuv_patch} # nghttp2 - from deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h %global nghttp2_major 1 -%global nghttp2_minor 34 -%global nghttp2_patch 0 +%global nghttp2_minor 39 +%global nghttp2_patch 2 %global nghttp2_version %{nghttp2_major}.%{nghttp2_minor}.%{nghttp2_patch} # ICU - from tools/icu/current_ver.dep -%global icu_major 62 -%global icu_minor 1 +%global icu_major 64 +%global icu_minor 2 %global icu_version %{icu_major}.%{icu_minor} -%if 0%{?fedora} >= 29 -%global icu_flag system-icu -%else -%global icu_flag small-icu -%endif +%global icudatadir %{nodejs_datadir}/icudata +%{!?little_endian: %global little_endian %(%{__python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")} +# " this line just fixes syntax highlighting for vim that is confused by the above and continues literal # punycode - from lib/punycode.js @@ -85,8 +88,8 @@ # npm - from deps/npm/package.json %global npm_epoch 1 %global npm_major 6 -%global npm_minor 4 -%global npm_patch 1 +%global npm_minor 9 +%global npm_patch 0 %global npm_version %{npm_major}.%{npm_minor}.%{npm_patch} # In order to avoid needing to keep incrementing the release version for the @@ -110,8 +113,12 @@ ExclusiveArch: %{nodejs_arches} # nodejs bundles openssl, but we use the system version in Fedora # because openssl contains prohibited code, we remove openssl completely from # the tarball, using the script in Source100 -#Source0: node-v%{nodejs_version}-stripped.tar.gz Source0: http://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz +#Source0: node-v%{nodejs_version}-stripped.tar.gz +Source1: npmrc +Source2: btest402.js +Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz + Source100: %{name}-tarball.sh # The native module Requires generator remains in the nodejs SRPM, so it knows @@ -120,17 +127,23 @@ Source100: %{name}-tarball.sh Source7: nodejs_native.attr # Disable running gyp on bundled deps we don't use -Patch1: 0001-Disable-running-gyp-on-shared-deps.patch +#Patch1: 0001-Disable-running-gyp-on-shared-deps.patch + +# Patch to install both node and libnode.so, using the correct libdir +Patch2: 0002-Install-both-binaries-and-use-libdir.patch + +# Upstream patch to enable auto-detection of full ICU data +# https://github.com/nodejs/node/pull/30825 +Patch3: 0003-build-auto-load-ICU-data-from-with-icu-default-data-.patch -# Suppress the message from npm to run `npm -g update npm` -# This does bad things on an RPM-managed npm. -Patch2: 0002-Suppress-NPM-message-to-run-global-update.patch BuildRequires: python2-devel BuildRequires: python3-devel BuildRequires: zlib-devel BuildRequires: gcc >= 4.9.4 BuildRequires: gcc-c++ >= 4.9.4 +BuildRequires: chrpath +BuildRequires: libatomic #%if ! 0%%{?bootstrap} %if %{with bootstrap} @@ -140,17 +153,13 @@ Provides: bundled(nghttp2) = %{nghttp2_version} %else BuildRequires: nodejs-packaging BuildRequires: systemtap-sdt-devel -BuildRequires: http-parser-devel >= 2.9.0 -Requires: http-parser >= 2.9.0 BuildRequires: libuv-devel >= 1:%{libuv_version} Requires: libuv >= 1:%{libuv_version} BuildRequires: libnghttp2-devel >= %{nghttp2_version} Requires: libnghttp2 >= %{nghttp2_version} -%endif - +BuildRequires: http-parser-devel >= %{http_parser_version} +Requires: http-parser >= %{http_parser_version} -%if 0%{?fedora} >= 29 -BuildRequires: libicu-devel >= 62.1 %endif BuildRequires: openssl-devel @@ -158,6 +167,12 @@ BuildRequires: openssl-devel # we need the system certificate store Requires: ca-certificates +Requires: nodejs-libs%{?_isa} = %{nodejs_epoch}:%{version}-%{release} + +# Pull in the full-icu data by default +#Recommends: nodejs-full-i18n%{?_isa} = %{nodejs_epoch}:%{version}-%{release} + + #we need ABI virtual provides where SONAMEs aren't enough/not present so deps #break when binary compatibility is broken Provides: nodejs(abi) = %{nodejs_abi} @@ -204,12 +219,7 @@ Provides: bundled(v8) = %{v8_version} Provides: bundled(icu) = %{icu_version} # Make sure we keep NPM up to date when we update Node.js -%if 0%{?rhel} -# EPEL doesn't support Recommends, so make it strict Requires: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} -%else -Recommends: npm = %{npm_epoch}:%{npm_version}-%{npm_release}%{?dist} -%endif %description @@ -238,6 +248,49 @@ Requires: libuv-devel%{?_isa} %description devel Development headers for the Node.js JavaScript runtime. +%package libs +Summary: Node.js and v8 libraries + +# Compatibility for obsolete v8 package +%if 0%{?__isa_bits} == 64 +Provides: libv8.so.%{v8_major}()(64bit) +Provides: libv8_libbase.so.%{v8_major}()(64bit) +Provides: libv8_libplatform.so.%{v8_major}()(64bit) +%else +# 32-bits +Provides: libv8.so.%{v8_major} +Provides: libv8_libbase.so.%{v8_major} +Provides: libv8_libplatform.so.%{v8_major} +%endif + +Provides: v8 = %{v8_epoch}:%{v8_version}-%{nodejs_release}%{?dist} +Provides: v8%{?_isa} = %{v8_epoch}:%{v8_version}-%{nodejs_release}%{?dist} +Obsoletes: v8 < 1:6.7.17-10 + +%description libs +Libraries to support Node.js and provide stable v8 interfaces. + + +%package full-i18n +Summary: Non-English locale data for Node.js +Requires: %{name}%{?_isa} = %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} + + +%description full-i18n +Optional data files to provide full-icu support for Node.js. Remove this +package to save space if non-English locales are not needed. + + +%package -n v8-devel +Summary: v8 - development headers +Epoch: %{v8_epoch} +Version: %{v8_version} +Release: %{v8_release}%{?dist} +Requires: %{name}-devel%{?_isa} = %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} + +%description -n v8-devel +Development headers for the v8 runtime. + %package -n npm Summary: Node.js Package Manager Epoch: %{npm_epoch} @@ -267,24 +320,21 @@ BuildArch: noarch # We don't require that the main package be installed to # use the docs, but if it is installed, make sure the # version always matches -Conflicts: %{name} > %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} -Conflicts: %{name} < %{epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +Conflicts: %{name} > %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} +Conflicts: %{name} < %{nodejs_epoch}:%{nodejs_version}-%{nodejs_release}%{?dist} %description docs The API documentation for the Node.js JavaScript runtime. %prep -%setup -q -n node-v%{nodejs_version} +%autosetup -p1 -n node-v%{nodejs_version} # remove bundled dependencies that we aren't building -#%patch1 -p1 #rm -rf deps/zlib -%patch2 -p1 - # Replace any instances of unversioned python' with python2 -#pathfix.py -i %{__python2} -pn $(find -type f) +#pathfix.py -i %{__python2} -pn $(find -type f ! -name "*.js") find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python2~" {} \; find . -type f -exec sed -i "s~/usr\/bin\/python\W~/usr/bin/python2~" {} \; sed -i "s~python~python2~" $(find . -type f | grep "gyp$") @@ -295,15 +345,25 @@ sed -i "s~which('python')~which('python2')~" configure %build +%ifarch s390 s390x %{arm} %ix86 +# Decrease debuginfo verbosity to reduce memory consumption during final +# library linking +%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') +%endif + +export CC='gcc' +export CXX='g++' + + # build with debugging symbols and add defines from libuv (#892601) # Node's v8 breaks with GCC 6 because of incorrect usage of methods on # NULL objects. We need to pass -fno-delete-null-pointer-checks -export CFLAGS='%{optflags} -g \ +export CFLAGS='%{optflags} \ -D_LARGEFILE_SOURCE \ -D_FILE_OFFSET_BITS=64 \ -DZLIB_CONST \ -fno-delete-null-pointer-checks' -export CXXFLAGS='%{optflags} -g \ +export CXXFLAGS='%{optflags} \ -D_LARGEFILE_SOURCE \ -D_FILE_OFFSET_BITS=64 \ -DZLIB_CONST \ @@ -318,26 +378,55 @@ export LDFLAGS="%{__global_ldflags}" #%if ! 0%%{?bootstrap} %if %{with bootstrap} ./configure --prefix=%{_prefix} \ + --libdir=%{_lib} \ + --shared-cares \ --without-dtrace \ --with-intl=small-icu \ --debug-nghttp2 \ %else ./configure --prefix=%{_prefix} \ + --libdir=%{_lib} \ --shared-libuv \ --shared-http-parser \ --shared-nghttp2 \ --with-dtrace \ - --with-intl=%{icu_flag} \ + --with-intl=small-icu \ + --with-icu-default-data-dir=%{icudatadir} \ --debug-nghttp2 \ %endif -%if %{?with_debug} == 1 -# Setting BUILDTYPE=Debug builds both release and debug binaries -make BUILDTYPE=Debug %{?_smp_mflags} -%else make BUILDTYPE=Release %{?_smp_mflags} + + +# Extract the ICU data and convert it to the appropriate endianness +pushd deps/ +tar xfz %SOURCE3 + +pushd icu/source + +mkdir -p converted +%if 0%{?little_endian} +# The little endian data file is included in the ICU sources +install -Dpm0644 data/in/icudt%{icu_major}l.dat converted/ + +%else +# For the time being, we need to build ICU and use the included `icupkg` tool +# to convert the little endian data file into a big-endian one. +# At some point in the future, ICU releases will start including both data +# files and we should switch to those. +mkdir -p data/out/tmp + +%configure +%make_build + +icu_root=$(pwd) +LD_LIBRARY_PATH=./lib ./bin/icupkg -tb data/in/icudt%{icu_major}l.dat \ + converted/icudt%{icu_major}b.dat %endif +popd # icu/source +popd # deps + %install rm -rf %{buildroot} @@ -346,11 +435,20 @@ rm -rf %{buildroot} # Set the binary permissions properly chmod 0755 %{buildroot}/%{_bindir}/node +chrpath --delete %{buildroot}%{_bindir}/node -%if %{?with_debug} == 1 -# Install the debug binary and set its permissions -install -Dpm0755 out/Debug/node %{buildroot}/%{_bindir}/node_g -%endif +# Install library symlink +ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/libnode.so + +# Install v8 compatibility symlinks +for header in %{buildroot}%{_includedir}/node/libplatform %{buildroot}%{_includedir}/node/v8*.h; do + header=$(basename ${header}) + ln -s %{_includedir}/node/${header} %{buildroot}%{_includedir}/${header} +done +for soname in libv8 libv8_libbase libv8_libplatform; do + ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so + ln -s libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major} +done # own the sitelib directory mkdir -p %{buildroot}%{_prefix}/lib/node_modules @@ -385,13 +483,10 @@ cp -pr deps/npm/man/* %{buildroot}%{_mandir}/ rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/man ln -sf %{_mandir} %{buildroot}%{_prefix}/lib/node_modules/npm/man -# Install Markdown and HTML documentation to %{_pkgdocdir} -cp -pr deps/npm/html deps/npm/doc %{buildroot}%{_pkgdocdir}/npm/ -rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/html \ - %{buildroot}%{_prefix}/lib/node_modules/npm/doc - -ln -sf %{_pkgdocdir} %{buildroot}%{_prefix}/lib/node_modules/npm/html -ln -sf %{_pkgdocdir}/npm/html %{buildroot}%{_prefix}/lib/node_modules/npm/doc +# Install Gatsby HTML documentation to %{_pkgdocdir} +cp -pr deps/npm/docs %{buildroot}%{_pkgdocdir}/npm/ +rm -rf %{buildroot}%{_prefix}/lib/node_modules/npm/docs +ln -sf %{_pkgdocdir}/npm %{buildroot}%{_prefix}/lib/node_modules/npm/docs # Node tries to install some python files into a documentation directory @@ -413,31 +508,67 @@ chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/npm-lifecycl chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js +# Drop the NPM default configuration in place +mkdir -p %{buildroot}%{_sysconfdir} +cp %{SOURCE1} %{buildroot}%{_sysconfdir}/npmrc + +# NPM upstream expects it to be in /usr/etc/npmrc, so we'll put a symlink here +# This is done in the interests of keeping /usr read-only. +mkdir -p %{buildroot}%{_prefix}/etc +ln -s %{_sysconfdir}/npmrc %{buildroot}%{_prefix}/etc/npmrc + +# Install the full-icu data files +install -Dpm0644 -t %{buildroot}%{icudatadir} deps/icu/source/converted/* + + %check # Fail the build if the versions don't match -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" -%{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.node, '%{nodejs_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.v8.replace(/-node\.\d+$/, ''), '%{v8_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require('assert').equal(process.versions.ares.replace(/-DEV$/, ''), '%{c_ares_version}')" # Ensure we have punycode and that the version matches -%{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" +LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"punycode\").version, '%{punycode_version}')" # Ensure we have npm and that the version matches -NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" +NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')" + +# Make sure i18n support is working +NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node --icu-data-dir=%{buildroot}%{icudatadir} %{SOURCE2} %pretrans -n npm -p --- Remove all of the symlinks from the bundled npm node_modules directory --- This scriptlet can be removed in Fedora 31 -base_path = "%{_prefix}/lib/node_modules/npm/node_modules/" -d_st = posix.stat(base_path) -if d_st then - for f in posix.files(base_path) do - path = base_path..f - st = posix.stat(path) - if st and st.type == "link" then - os.remove(path) +-- Replace the npm man directory with a symlink +-- Drop this scriptlet when F31 is EOL +path = "%{_prefix}/lib/node_modules/npm/man" +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end + os.rename(path, path .. ".rpmmoved") + end +end + + +%pretrans -n v8-devel -p +-- Replace the v8 libplatform include directory with a symlink +-- Drop this scriptlet when F30 is EOL +path = "%{_includedir}/libplatform" +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) + end + os.rename(path, path .. ".rpmmoved") end end @@ -459,41 +590,118 @@ end %{_rpmconfigdir}/fileattrs/nodejs_native.attr %{_rpmconfigdir}/nodejs_native.req -%license LICENSE %doc AUTHORS CHANGELOG.md COLLABORATOR_GUIDE.md GOVERNANCE.md README.md %doc %{_mandir}/man1/node.1* %files devel -%if %{?with_debug} == 1 -%{_bindir}/node_g -%endif %{_includedir}/node +%{_libdir}/libnode.so %{_datadir}/node/common.gypi %{_pkgdocdir}/gdbinit +%files full-i18n +%dir %{icudatadir} +%{icudatadir}/icudt%{icu_major}*.dat + + +%files libs +%license LICENSE +%{_libdir}/libnode.so.%{nodejs_soversion} +%{_libdir}/libv8.so.%{v8_major} +%{_libdir}/libv8_libbase.so.%{v8_major} +%{_libdir}/libv8_libplatform.so.%{v8_major} +%dir %{nodejs_datadir}/ + + +%files -n v8-devel +%{_includedir}/libplatform +%{_includedir}/v8*.h +%{_libdir}/libv8.so +%{_libdir}/libv8_libbase.so +%{_libdir}/libv8_libplatform.so +%ghost %{_includedir}/libplatform.rpmmoved + + %files -n npm %{_bindir}/npm %{_bindir}/npx %{_prefix}/lib/node_modules/npm -%ghost %{_sysconfdir}/npmrc +%config(noreplace) %{_sysconfdir}/npmrc +%{_prefix}/etc/npmrc %ghost %{_sysconfdir}/npmignore -%doc %{_mandir}/man*/npm* -%doc %{_mandir}/man*/npx* -%doc %{_mandir}/man5/package.json.5* -%doc %{_mandir}/man5/package-lock.json.5* -%doc %{_mandir}/man7/removing-npm.7* +%doc %{_mandir}/man1/npm*.1* +%doc %{_mandir}/man1/npx.1* +%doc %{_mandir}/man5/folders.5* +%doc %{_mandir}/man5/install.5* +%doc %{_mandir}/man5/npmrc.5* +%doc %{_mandir}/man5/package-json.5* +%doc %{_mandir}/man5/package-lock-json.5* +%doc %{_mandir}/man5/package-locks.5* +%doc %{_mandir}/man5/shrinkwrap-json.5* +%doc %{_mandir}/man7/config.7* +%doc %{_mandir}/man7/developers.7* +%doc %{_mandir}/man7/disputes.7* +%doc %{_mandir}/man7/orgs.7* +%doc %{_mandir}/man7/registry.7* +%doc %{_mandir}/man7/removal.7* +%doc %{_mandir}/man7/scope.7* +%doc %{_mandir}/man7/scripts.7* %doc %{_mandir}/man7/semver.7* %files docs %dir %{_pkgdocdir} %{_pkgdocdir}/html -%{_pkgdocdir}/npm/html -%{_pkgdocdir}/npm/doc +%{_pkgdocdir}/npm/docs %changelog +* Fri Feb 07 2020 Stephen Gallagher - 1:10.19.0-1 +- Update to 10.19.0 + +* Fri Aug 16 2019 Stephen Gallagher - 1:10.16.3-1 +- Update to 10.16.3 security release +- Resolves: CVE-2019-9511 "Data Dribble" +- Resolves: CVE-2019-9512 "Ping Flood" +- Resolves: CVE-2019-9513 "Resource Loop" +- Resolves: CVE-2019-9514 "Reset Flood" +- Resolves: CVE-2019-9515 "Settings Flood" +- Resolves: CVE-2019-9516 "0-Length Headers Leak" +- Resolves: CVE-2019-9517 "Internal Data Buffering" +- Resolves: CVE-2019-9518 "Empty Frames Flood" +- https://github.com/nodejs/node/blob/v10.16.3/doc/changelogs/CHANGELOG_V10.md + +* Mon Jun 03 2019 Stephen Gallagher - 1:10.16.0-3 +- Change v8-devel release stream to avoid duplicate NEVRAs + +* Fri May 31 2019 Stephen Gallagher - 1:10.16.0-1 +- Update to 10.16.0 +- https://nodejs.org/en/blog/release/v10.16.0/ + +* Wed Apr 24 2019 Stephen Gallagher - 1:10.15.3-2 +- Fix upgrade bug for v8-devel (BZ #1702609) + +* Tue Apr 09 2019 Stephen Gallagher - 1:10.15.3-1 +- Update to 10.15.3 +- https://nodejs.org/en/blog/release/v10.15.3/ +- Drop upstreamed patch + +* Tue Apr 09 2019 Stephen Gallagher - 1:10.15.2-3 +- Separate nodejs-libs out to its own subpackage +- Clean up compatibility virtual Provides +- Set epoch for v8-devel to maintain upgrade path + +* Sun Mar 17 2019 Elliott Sales de Andrade - 1:10.15.2-2 +- Drop debug executable +- Build with a shared library +- Add v8 compatibility subpackage + +* Fri Mar 01 2019 Stephen Gallagher - 1:10.15.2-1 +- Update to 10.15.2 +- https://nodejs.org/en/blog/release/v10.15.1/ +- https://nodejs.org/en/blog/release/v10.15.2/ + * Wed Jan 02 2019 Stephen Gallagher - 1:10.15.0-1 - Update to 10.15.0 - https://nodejs.org/en/blog/release/v10.15.0/