Symlink Modules Not Archived
Opened this issue · 0 comments
Summary
Hello, I came cross an issue when moving to Speculate from an old build process.
Basically, we have a NodeJS project which makes use of file:
dependencies.
After an npm install
, those dependencies are present in node_modules
as symlinks:
# ls -ld node_modules/bbcid-vertex-logger
lrwxrwxrwx 1 jenkins jenkins 48 Jun 19 15:47 node_modules/bbcid-vertex-logger -> ../../apigee-vertex/packages/bbcid-vertex-logger
However, the contents of files under that symlink never make it into the SOURCES/*.tar.gz
file. Instead, only the symlink itself is copied into the archive:
# tar -tf SOURCES/bbcidv5-openam-apigee.tar.gz | grep bbcid-vertex-logger
node_modules/bbcid-vertex-logger
Potential Solution?
I suspect that the archiving function of speculate is deciding not to follow the symlinks. I believe that instead, any links should be followed and the files pointed to should be archived (similar to the -h (--dereference)
flag of the TAR utility.
Would this be possible by setting options.dereference
to true in archiver.js
? (docs). This could even be placed behind a flag like --follow-symlinks
if it isn't the desired ordinary behaviour.
Workaround
Use rsync
to copy out all the links first of all. I used this in my Makefile:
rsync --archive --verbose --copy-links ./node_modules/ ./node_modules_no_symlinks/
rm -r ./node_modules/
mv ./node_modules_no_symlinks/ ./node_modules/