diff --git a/nodejs.spec b/nodejs.spec index dbf31f1..c5ef127 100644 --- a/nodejs.spec +++ b/nodejs.spec @@ -157,6 +157,9 @@ Source100: %{name}-tarball.sh # nodejs-packaging SRPM. Source7: nodejs_native.attr +# Configure npm to look into /etc for configuration +Source8: npmrc.builtin.in + # These are full sources for dependencies included as WASM blobs in the source of Node itself. # Note: These sources would also include pre-compiled WASM blobs… so they are adjusted not to. # Recipes for creating these blobs are included in the sources. @@ -585,15 +588,14 @@ find %{buildroot}%{_prefix}/lib/node_modules/npm \ chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp chmod 0755 %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js +# Drop the NPM builtin configuration in place +sed -e 's#@SYSCONFDIR@#%{_sysconfdir}#g' \ + %{SOURCE8} > %{buildroot}%{_prefix}/lib/node_modules/npm/npmrc + # 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/* @@ -687,7 +689,6 @@ end %{_bindir}/npx %{_prefix}/lib/node_modules/npm %config(noreplace) %{_sysconfdir}/npmrc -%{_prefix}/etc/npmrc %ghost %{_sysconfdir}/npmignore %doc %{_mandir}/man1/npm*.1* %doc %{_mandir}/man1/npx.1* @@ -724,6 +725,8 @@ end - Rebase to 16.20.1 Resolves: rhbz#2188291 Resolves: CVE-2023-30581 CVE-2023-30588 CVE-2023-30589 CVE-2023-30590 +- Replace /usr/etc/npmrc symlink with builtin configuration + Resolves: rhbz#2177781 * Wed May 31 2023 Jan Staněk - 1:16.19.1-2 - Update bundled c-ares to 1.19.1 diff --git a/npmrc.builtin.in b/npmrc.builtin.in new file mode 100644 index 0000000..739a57d --- /dev/null +++ b/npmrc.builtin.in @@ -0,0 +1,5 @@ +# This is the distibution-level configuration file for npm. +# To configure NPM on a system level, use the globalconfig below (defaults to @SYSCONFDIR@/npmrc). +# vim:set filetype=dosini: + +globalconfig=@SYSCONFDIR@/npmrc