Replace /usr/etc/npmrc symlink with builtin configuration
We want to have the system-level npmrc located at /etc/npmrc. By default, npm looks for it in /usr/etc/npmrc, so we placed a symlink to /etc/npmrc there. However, we are the only known package that has anything in /usr/etc, which confuses and/or breaks various tooling (see related bug). This gets rid of the symlink, and instead uses "builtin"-level configuration of npm to cause it to load the system-level configuration from /etc/npmrc.
This commit is contained in:
parent
c906dcbb97
commit
f02b2fabe5
15
nodejs.spec
15
nodejs.spec
@ -178,6 +178,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.
|
||||
@ -557,15 +560,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#2188289
|
||||
Resolves: CVE-2023-30581 CVE-2023-30588 CVE-2023-30589 CVE-2023-30590
|
||||
- Replace /usr/etc/npmrc symlink with builtin configuration
|
||||
Resolves: rhbz#2222288
|
||||
|
||||
* Wed May 31 2023 Jan Staněk <jstanek@redhat.com> - 1:16.19.1-2
|
||||
- Update bundled c-ares to 1.19.1
|
||||
|
5
npmrc.builtin.in
Normal file
5
npmrc.builtin.in
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user