Copy directory symlinks. #228
I'm not actually sure this is the correct solution.
This hardlinking behavior was introduced in 9ab33879057ae857e92c9ebe340abd3990d25190. Prior to that commit, it looks like symlinked directories were created but not populated (though I could be mistaken).
The referenced commit caused symlinked directories to be hard linked (at least on some systems) which resulted in including them in the final package and introduced a bug where the original directories get wiped out.
The behavior introduced in this pull request follows the comments, which state "Symlinks should be copied as symlinks." I think that comment doesn't match the actual behavior, though.
I did some more virtualenv packaging testing after opening this pull request and the linking behavior seems inconsistent. Symlinked files are hard linked and the source of the file is included in the resulting package (this doesn't match the claimed behavior of copying a symlink), while directories are copied as symlinks and thus the generated packages aren't necessarily portable since the package now includes a symlink to a local directory.
As it stands, you shouldn't merge this since the behavior is inconsistent. I will fix my pull request, but I don't know what the actually correct behavior should be. I think it is to create the directory and copy its contents rather than symlink it, but I'd like your opinion first.
Perhaps the correct solution is to add a flag (--follow-symlinks or --dereference-symlinks) which follows all symlinks and includes the target files and directories in the package. By default, symlinks could be left as symlinks for both files and directories (which means that File.link should be replaced with FileUtils.copy_entry by default, since it preserves symlinks).
I'm not familiar enough with fpm to suggest a default which doesn't break expected behavior, though.
The hardlink implementation was made as a space-saving measure. File copying is stupid complex ;)
I think perhaps the best way to handle this would be to come up with examples that fail currently - as you have now. fpm invocations that do the wrong thing, etc.