2
0
forked from pool/nodejs21

- node-gyp-addon-gypi.patch: fix misapplied patch (bsc#1217424)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs21?expand=0&rev=8
This commit is contained in:
Adam Majer 2023-11-23 10:50:30 +00:00 committed by Git OBS Bridge
parent f1bab96069
commit 6ad92ba65e
3 changed files with 66 additions and 55 deletions

View File

@ -1,7 +1,7 @@
Index: node-v21.2.0/addon-rpm.gypi Index: node-v20.10.0/addon-rpm.gypi
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ node-v21.2.0/addon-rpm.gypi +++ node-v20.10.0/addon-rpm.gypi
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
+{ +{
+ 'target_defaults': { + 'target_defaults': {
@ -38,51 +38,41 @@ Index: node-v21.2.0/addon-rpm.gypi
+ ] + ]
+ } + }
+} +}
Index: node-v21.2.0/deps/npm/node_modules/node-gyp/lib/configure.js Index: node-v20.10.0/deps/npm/node_modules/node-gyp/lib/configure.js
=================================================================== ===================================================================
--- node-v21.2.0.orig/deps/npm/node_modules/node-gyp/lib/configure.js --- node-v20.10.0.orig/deps/npm/node_modules/node-gyp/lib/configure.js
+++ node-v21.2.0/deps/npm/node_modules/node-gyp/lib/configure.js +++ node-v20.10.0/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -32,28 +32,11 @@ async function configure (gyp, argv) { @@ -36,10 +36,6 @@ async function configure (gyp, argv) {
nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir()) if ('v' + release.version !== process.version) {
log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir) // if --target was given, then determine a target version to compile for
} else { log.verbose('get node dir', 'compiling against --target node version: %s', release.version)
- // if no --nodedir specified, ensure node dependencies are installed
- if ('v' + release.version !== process.version) {
- // if --target was given, then determine a target version to compile for
- log.verbose('get node dir', 'compiling against --target node version: %s', release.version)
- } else { - } else {
- // if no --target was specified then use the current host node version - // if no --target was specified then use the current host node version
- log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version) - log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', release.version)
- } - }
-
- if (!release.semver) { if (!release.semver) {
- // could not parse the version string with semver // could not parse the version string with semver
- throw new Error('Invalid version number: ' + release.version) @@ -54,6 +50,12 @@ async function configure (gyp, argv) {
- }
- log.verbose('get node dir', 'target node version installed:', release.versionDir)
- // If the tarball option is set, always remove and reinstall the headers nodeDir = path.resolve(gyp.devDir, release.versionDir)
- // into devdir. Otherwise only install if they're not already there. + } else {
- gyp.opts.ensure = !gyp.opts.tarball
-
- await gyp.commands.install([release.version])
-
- log.verbose('get node dir', 'target node version installed:', release.versionDir)
- nodeDir = path.resolve(gyp.devDir, release.versionDir)
+ // if no --target was specified then use RPM-installed headers + // if no --target was specified then use RPM-installed headers
+ log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers') + log.verbose('get node dir', 'no --target version specified, falling back to RPM installed headers')
+ nodeDir = '/usr/include/node21' + nodeDir = '/usr/include/node21'
+ createBuildDir() + createBuildDir()
+ + }
} }
return createBuildDir() return createBuildDir()
@@ -201,7 +184,8 @@ async function configure (gyp, argv) { @@ -201,7 +203,8 @@ async function configure (gyp, argv) {
// this logic ported from the old `gyp_addon` python file // this logic ported from the old `gyp_addon` python file
const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py') const gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
- const addonGypi = path.resolve(__dirname, '..', 'addon.gypi') - const addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
+ const addon_gypi_file = gyp.opts.target || gyp.opts.nodedir ? 'addon.gypi' : 'addon-rpm.gypi' + let addon_gypi_file = gyp.opts.target || gyp.opts.nodedir ? 'addon.gypi' : 'addon-rpm.gypi'
+ let addonGypi = path.resolve(__dirname, '..', addon_gypi_file) + var addonGypi = path.resolve(__dirname, '..', addon_gypi_file)
let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi') let commonGypi = path.resolve(nodeDir, 'include/node/common.gypi')
try { try {
await fs.stat(commonGypi) await fs.stat(commonGypi)

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Nov 23 10:44:16 UTC 2023 - Adam Majer <adam.majer@suse.de>
- node-gyp-addon-gypi.patch: fix misapplied patch (bsc#1217424)
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Nov 15 15:18:00 UTC 2023 - Adam Majer <adam.majer@suse.de> Wed Nov 15 15:18:00 UTC 2023 - Adam Majer <adam.majer@suse.de>

View File

@ -1,7 +1,7 @@
# #
# spec file for package nodejs21 # spec file for package nodejs21
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -15,7 +15,17 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
###########################################################
#
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
#
# This spec file is generated from a template hosted at
# https://github.com/AdamMajer/nodejs-packaging
#
###########################################################
# Fedora doesn't have rpm-config-SUSE which provides
# ext_man in /usr/lib/rpm/macros.d/macros.obs
%if 0%{?fedora_version} %if 0%{?fedora_version}
%define ext_man .gz %define ext_man .gz
%endif %endif
@ -135,6 +145,8 @@ Patch5: sle12_python3_compat.patch
Patch7: manual_configure.patch Patch7: manual_configure.patch
Patch13: openssl_binary_detection.patch Patch13: openssl_binary_detection.patch
## Patches specific to SUSE and openSUSE ## Patches specific to SUSE and openSUSE
Patch100: linker_lto_jobs.patch Patch100: linker_lto_jobs.patch
# PATCH-FIX-OPENSUSE -- set correct path for dtrace if it is built # PATCH-FIX-OPENSUSE -- set correct path for dtrace if it is built
@ -161,8 +173,8 @@ Patch305: qemu_timeouts_arches.patch
Patch308: node-gyp-config.patch Patch308: node-gyp-config.patch
Patch309: gcc13.patch Patch309: gcc13.patch
BuildRequires: fdupes
BuildRequires: pkg-config BuildRequires: pkg-config
BuildRequires: fdupes
BuildRequires: procps BuildRequires: procps
BuildRequires: xz BuildRequires: xz
BuildRequires: zlib-devel BuildRequires: zlib-devel
@ -182,10 +194,10 @@ BuildRequires: config(netcfg)
%if 0%{?suse_version} == 1110 %if 0%{?suse_version} == 1110
# GCC 5 is only available in the SUSE:SLE-11:SP4:Update repository (SDK). # GCC 5 is only available in the SUSE:SLE-11:SP4:Update repository (SDK).
%if %node_version_number >= 8 %if %node_version_number >= 8
BuildRequires: gcc5-c++ BuildRequires: gcc5-c++
%define forced_gcc_version 5 %define forced_gcc_version 5
%else %else
BuildRequires: gcc48-c++ BuildRequires: gcc48-c++
%define forced_gcc_version 4.8 %define forced_gcc_version 4.8
%endif %endif
%endif %endif
@ -195,15 +207,15 @@ BuildRequires: gcc48-c++
# for SLE-12:Update targets # for SLE-12:Update targets
%if 0%{?suse_version} == 1315 %if 0%{?suse_version} == 1315
%if %node_version_number >= 17 %if %node_version_number >= 17
BuildRequires: gcc12-c++ BuildRequires: gcc12-c++
%define forced_gcc_version 12 %define forced_gcc_version 12
%else %else
%if %node_version_number >= 14 %if %node_version_number >= 14
BuildRequires: gcc9-c++ BuildRequires: gcc9-c++
%define forced_gcc_version 9 %define forced_gcc_version 9
%else %else
%if %node_version_number >= 8 %if %node_version_number >= 8
BuildRequires: gcc7-c++ BuildRequires: gcc7-c++
%define forced_gcc_version 7 %define forced_gcc_version 7
%endif %endif
%endif %endif
@ -212,7 +224,7 @@ BuildRequires: gcc7-c++
%if 0%{?suse_version} == 1500 %if 0%{?suse_version} == 1500
%if %node_version_number >= 17 %if %node_version_number >= 17
BuildRequires: gcc12-c++ BuildRequires: gcc12-c++
%define forced_gcc_version 12 %define forced_gcc_version 12
%endif %endif
%endif %endif
@ -223,6 +235,7 @@ BuildRequires: gcc12-c++
BuildRequires: gcc-c++ BuildRequires: gcc-c++
%endif %endif
# Python dependencies # Python dependencies
%if %node_version_number >= 14 %if %node_version_number >= 14
@ -248,8 +261,8 @@ BuildRequires: python
%endif %endif
%if 0%{?suse_version} >= 1500 && %{node_version_number} >= 10 %if 0%{?suse_version} >= 1500 && %{node_version_number} >= 10
BuildRequires: group(nobody)
BuildRequires: user(nobody) BuildRequires: user(nobody)
BuildRequires: group(nobody)
%endif %endif
# shared openssl # shared openssl
@ -264,10 +277,11 @@ BuildRequires: openssl >= %{openssl_req_ver}
BuildRequires: (libopenssl1_1-hmac if libopenssl-1_1-devel) BuildRequires: (libopenssl1_1-hmac if libopenssl-1_1-devel)
BuildRequires: (libopenssl3-hmac if libopenssl-3-devel) BuildRequires: (libopenssl3-hmac if libopenssl-3-devel)
%else %else
BuildRequires: libopenssl1_1-hmac
BuildRequires: openssl-1_1 >= %{openssl_req_ver} BuildRequires: openssl-1_1 >= %{openssl_req_ver}
BuildRequires: libopenssl1_1-hmac
%endif %endif
# /suse_version # /suse_version
%endif %endif
@ -311,7 +325,7 @@ BuildRequires: valgrind
%if %{with libalternatives} %if %{with libalternatives}
Suggests: alts Suggests: alts
%else %else
Requires(postun):%{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives
%endif %endif
# either for update-alternatives, or their removal # either for update-alternatives, or their removal
Requires(post): %{_sbindir}/update-alternatives Requires(post): %{_sbindir}/update-alternatives
@ -350,8 +364,8 @@ ExclusiveArch: not_buildable
%endif %endif
%endif %endif
Provides: bundled(libuv) = 1.46.0
Provides: bundled(uvwasi) = 0.0.19 Provides: bundled(uvwasi) = 0.0.19
Provides: bundled(libuv) = 1.46.0
Provides: bundled(v8) = 11.8.172.17 Provides: bundled(v8) = 11.8.172.17
%if %{with intree_brotli} %if %{with intree_brotli}
Provides: bundled(brotli) = 1.0.9 Provides: bundled(brotli) = 1.0.9
@ -359,9 +373,10 @@ Provides: bundled(brotli) = 1.0.9
BuildRequires: pkgconfig(libbrotlidec) BuildRequires: pkgconfig(libbrotlidec)
%endif %endif
Provides: bundled(base64) = 0.5.1
Provides: bundled(llhttp) = 9.1.3 Provides: bundled(llhttp) = 9.1.3
Provides: bundled(ngtcp2) = 0.8.1 Provides: bundled(ngtcp2) = 0.8.1
Provides: bundled(base64) = 0.5.1
Provides: bundled(simdutf) = 3.2.18 Provides: bundled(simdutf) = 3.2.18
# bundled url-ada parser, not ada # bundled url-ada parser, not ada
Provides: bundled(ada) = 2.7.2 Provides: bundled(ada) = 2.7.2
@ -385,8 +400,8 @@ provided by npm.
Summary: Development headers for NodeJS 21.x Summary: Development headers for NodeJS 21.x
Group: Development/Languages/NodeJS Group: Development/Languages/NodeJS
Provides: nodejs-devel = %{version} Provides: nodejs-devel = %{version}
Requires: %{name} = %{version}
Requires: npm21 = %{version} Requires: npm21 = %{version}
Requires: %{name} = %{version}
%description devel %description devel
This package provides development headers for Node.js needed for creation This package provides development headers for Node.js needed for creation
@ -403,12 +418,12 @@ Requires: nodejs-common
Requires: nodejs21 = %{version} Requires: nodejs21 = %{version}
Provides: nodejs-npm = %{version} Provides: nodejs-npm = %{version}
Obsoletes: nodejs-npm < 4.0.0 Obsoletes: nodejs-npm < 4.0.0
Provides: npm = %{version}
Provides: npm(npm) = 10.2.3 Provides: npm(npm) = 10.2.3
Provides: npm = %{version}
%if 0%{?suse_version} >= 1500 %if 0%{?suse_version} >= 1500
%if %{node_version_number} >= 10 %if %{node_version_number} >= 10
Requires: group(nobody)
Requires: user(nobody) Requires: user(nobody)
Requires: group(nobody)
%endif %endif
%endif %endif
Provides: bundled(node-abbrev) = 2.0.0 Provides: bundled(node-abbrev) = 2.0.0
@ -575,9 +590,9 @@ Provides: bundled(node-spdx-exceptions) = 2.3.0
Provides: bundled(node-spdx-expression-parse) = 3.0.1 Provides: bundled(node-spdx-expression-parse) = 3.0.1
Provides: bundled(node-spdx-license-ids) = 3.0.16 Provides: bundled(node-spdx-license-ids) = 3.0.16
Provides: bundled(node-ssri) = 10.0.5 Provides: bundled(node-ssri) = 10.0.5
Provides: bundled(node-string_decoder) = 1.3.0
Provides: bundled(node-string-width) = 4.2.3 Provides: bundled(node-string-width) = 4.2.3
Provides: bundled(node-string-width) = 5.1.2 Provides: bundled(node-string-width) = 5.1.2
Provides: bundled(node-string_decoder) = 1.3.0
Provides: bundled(node-strip-ansi) = 6.0.1 Provides: bundled(node-strip-ansi) = 6.0.1
Provides: bundled(node-strip-ansi) = 7.1.0 Provides: bundled(node-strip-ansi) = 7.1.0
Provides: bundled(node-supports-color) = 9.4.0 Provides: bundled(node-supports-color) = 9.4.0
@ -701,6 +716,8 @@ find -name \*~ -print0 -delete
# abnormalities from patching # abnormalities from patching
find \( -name \*.js.orig -or -name \*.md.orig -or -name \*.1.orig \) -delete find \( -name \*.js.orig -or -name \*.md.orig -or -name \*.1.orig \) -delete
%build %build
# normalize shebang # normalize shebang
%if %{node_version_number} >= 12 %if %{node_version_number} >= 12
@ -1060,7 +1077,6 @@ update-alternatives --remove npm-default %{_bindir}/npm%{node_version_number}
update-alternatives --remove npx-default %{_bindir}/npx%{node_version_number} update-alternatives --remove npx-default %{_bindir}/npx%{node_version_number}
%else %else
%pre %pre
# remove files that are no longer owned but provided by update-alternatives # remove files that are no longer owned but provided by update-alternatives
if ! [ -L %{_mandir}/man1/node.1%{ext_man} ]; then if ! [ -L %{_mandir}/man1/node.1%{ext_man} ]; then