Properly handle @group/package deps in nodejs-symlink-deps
Node packages can have dependencies of the for "@group/package" instead of just "package".
Calling symlink() (and thus os.symlink()) in such a case fails when there is no "@group" directory yet.
```
+ /usr/lib/rpm/nodejs-symlink-deps /usr/lib/node_modules
ERROR: the path for dependency "@babel/runtime" already exists
This could mean that bundled modules are being installed. Bundled libraries are
forbidden in Fedora. For more information, see:
<https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries>
It is generally reccomended to remove the entire "node_modules" directory in
%prep when it exists. For more information, see:
<https://fedoraproject.org/wiki/Packaging:Node.js#Removing_bundled_modules>
If you have obtained permission from the Fedora Packaging Committee to bundle
libraries, please use `%nodejs_fixdep -r` in %prep to remove the dependency on
the bundled module. This will prevent an unnecessary dependency on the system
version of the module and eliminate this error.
error: Bad exit status from /var/tmp/rpm-tmp.nn3mkP (%install)
```
The reported error is misleading - the path does not exist yet, but it also can't be created.
os.symlink throws OSError in both cases.
The patch prevents the issue by calling os.makedirs on the group-part of the dependency if there is one.
Signed-off-by: Jan Staněk <jstanek@redhat.com>
Resolves: RHEL-121583
This commit is contained in:
parent
fcfb79fa36
commit
70538358df
@ -30,6 +30,8 @@ import shutil
|
||||
import sys
|
||||
|
||||
def symlink(source, dest):
|
||||
if os.path.sep in dest:
|
||||
os.makedirs(os.path.dirname(dest), exist_ok=True)
|
||||
try:
|
||||
os.symlink(source, dest)
|
||||
except OSError:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user