Create subdirectories for links if necessary.
Collect packages in a set() instead of a list
Ugly hack to drop subpackages and only link their parent packages/directories.