From 2a08691cf3d07c737772210e5a7b7f4c0c70c4eb Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 24 Aug 2022 13:08:23 -0400 Subject: [PATCH] Move native module building tools here from Node.js Signed-off-by: Stephen Gallagher --- nodejs-packaging.spec | 18 +++++++++++++++--- nodejs_abi.attr | 2 ++ nodejs_abi.req | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 nodejs_abi.attr create mode 100755 nodejs_abi.req diff --git a/nodejs-packaging.spec b/nodejs-packaging.spec index 84997a2..b1e8275 100644 --- a/nodejs-packaging.spec +++ b/nodejs-packaging.spec @@ -1,8 +1,8 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: nodejs-packaging -Version: 2021.06 -Release: 7%{?dist} +Version: 2022.10 +Release: 1%{?dist} Summary: RPM Macros and Utilities for Node.js Packaging BuildArch: noarch License: MIT @@ -19,13 +19,19 @@ Source0007: nodejs-symlink-deps Source0008: nodejs.attr Source0009: nodejs.prov Source0010: nodejs.req -Source0011: nodejs-packaging-bundler +Source0011: nodejs_abi.attr +Source0012: nodejs_abi.req + +Source0111: nodejs-packaging-bundler # Created with `tar cfz test.tar.gz test` Source0101: test.tar.gz BuildRequires: python3 +# Several of the macros require the /usr/bin/node command, so we need to +# ensure that it is present when packaging. +Requires: /usr/bin/node Requires: redhat-rpm-config %description @@ -59,8 +65,10 @@ popd %install install -Dpm0644 macros.nodejs %{buildroot}%{macrosdir}/macros.nodejs install -Dpm0644 nodejs.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs.attr +install -Dpm0644 nodejs_abi.attr %{buildroot}%{_rpmconfigdir}/fileattrs/nodejs_abi.attr install -pm0755 nodejs.prov %{buildroot}%{_rpmconfigdir}/nodejs.prov install -pm0755 nodejs.req %{buildroot}%{_rpmconfigdir}/nodejs.req +install -pm0755 nodejs_abi.req %{buildroot}%{_rpmconfigdir}/nodejs_abi.req install -pm0755 nodejs-symlink-deps %{buildroot}%{_rpmconfigdir}/nodejs-symlink-deps install -pm0755 nodejs-fixdep %{buildroot}%{_rpmconfigdir}/nodejs-fixdep install -pm0755 nodejs-setversion %{buildroot}%{_rpmconfigdir}/nodejs-setversion @@ -84,6 +92,10 @@ install -Dpm0755 nodejs-packaging-bundler %{buildroot}%{_bindir}/nodejs-packagin %changelog +* Thu Oct 20 2022 Stephen Gallagher - 2022.10-1 +- Move native module building tools here from Node.js +- Add `Requires: /usr/bin/node` + * Tue Oct 18 2022 Davide Cavalca - 2021.06-7 - NPM bundler: recursively bundle modules for all packages found diff --git a/nodejs_abi.attr b/nodejs_abi.attr new file mode 100644 index 0000000..d161239 --- /dev/null +++ b/nodejs_abi.attr @@ -0,0 +1,2 @@ +%__nodejs_native_requires %{_rpmconfigdir}/nodejs_abi.req +%__nodejs_native_path ^/usr/lib.*/node_modules/.*\\.node$ diff --git a/nodejs_abi.req b/nodejs_abi.req new file mode 100755 index 0000000..afc6f3d --- /dev/null +++ b/nodejs_abi.req @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the version from the default Node.js +full_version=$(/usr/bin/node --version) + +# Trim off the leading 'v' +full_version=${full_version:1} + +# Get the different version components +split_version=(${full_version//\./ }) + +# Write out the Virtual Requires +echo "nodejs(abi${split_version[0]}) >= ${split_version[0]}.${split_version[1]}" +