Add pretrans scriptlet for node_modules
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
parent
cc73e226d4
commit
e518e262b3
@ -733,7 +733,7 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{nodejs_private_s
|
||||
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} < 8
|
||||
%pretrans npm -p <lua>
|
||||
%pretrans %{pkgname}-npm -p <lua>
|
||||
-- Remove all of the symlinks from the bundled npm node_modules directory
|
||||
base_path = "%{_prefix}/lib/node_modules/npm/node_modules/"
|
||||
d_st = posix.stat(base_path)
|
||||
@ -748,6 +748,22 @@ if d_st then
|
||||
end
|
||||
%endif
|
||||
|
||||
# This can be removed once F37 is EOL
|
||||
%pretrans -n %{pkgname} -p <lua>
|
||||
path = "/usr/lib/node_modules"
|
||||
st = posix.stat(path)
|
||||
if st and st.type == "directory" then
|
||||
status = os.rename(path, path .. ".rpmmoved")
|
||||
if not status then
|
||||
suffix = 0
|
||||
while not status do
|
||||
suffix = suffix + 1
|
||||
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
|
||||
end
|
||||
os.rename(path, path .. ".rpmmoved")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%files -n %{pkgname}
|
||||
%doc AUTHORS CHANGELOG.md onboarding.md GOVERNANCE.md README.md
|
||||
|
Loading…
Reference in New Issue
Block a user