Use stream-specific ABI dependency generator

Until now, the nodejs_abi dependency generator has lived in
nodejs-packaging. However, it depends on (an uses only) /usr/bin/node,
thus only working and being accurate for the default stream.

Moving the generator into a specific stream and modifying it to use
the versioned binary should ensure that it is valid for whatever stream
is used for compiling the binary extension in question.

Related: RHEL-67814
Signed-off-by: Jan Staněk <jstanek@redhat.com>
This commit is contained in:
Jan Staněk 2025-02-24 13:42:20 +01:00
parent b57548da40
commit bb7c0670b2
No known key found for this signature in database
GPG Key ID: 2972F2037B243B6D
3 changed files with 14 additions and 0 deletions

View File

@ -161,6 +161,8 @@ Source200: nodejs-tarball.sh
Source201: npmrc.builtin.in
Source202: nodejs.pc.in
Source203: v8.pc.in
Source204: nodejs22_abi.req
Source205: nodejs22_abi.attr
Patch: 0001-Remove-unused-OpenSSL-config.patch
@ -778,6 +780,10 @@ sed -e 's#@PREFIX@#%{_prefix}#g' \
-e 's#@V8_VERSION@#%{v8_version}#g' \
%{SOURCE203} > %{buildroot}%{_libdir}/pkgconfig/v8-%{v8_major}.%{v8_minor}.pc
# Install automatic ABI requirements generator for dependent packages
install -Dpm0755 %{SOURCE204} %{buildroot}%{_rpmconfigdir}/nodejs%{nodejs_pkg_major}_abi.req
install -Dpm0644 %{SOURCE204} %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs%{nodejs_pkg_major}_abi.attr
%check
# Fail the build if the versions don't match
@ -856,6 +862,8 @@ end
%{nodejs_datadir}/common.gypi
%{_pkgdocdir}/gdbinit
%{_libdir}/pkgconfig/nodejs-%{nodejs_pkg_major}.pc
%{_rpmconfigdir}/fileattrs/nodejs%{nodejs_pkg_major}*.attr
%{_rpmconfigdir}/nodejs%{nodejs_pkg_major}*
%files -n %{pkgname}-full-i18n

2
nodejs22_abi.attr Normal file
View File

@ -0,0 +1,2 @@
%__nodejs22_native_requires %{_rpmconfigdir}/nodejs22_abi.req
%__nodejs22_native_path ^/usr/lib.*/node_modules_22/.*\\.node$

4
nodejs22_abi.req Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# Require ABI version of the current interpreter
printf 'nodejs(abi) = %s\n' "$(/usr/bin/node-22 -p 'process.versions.modules')"