Revert to absolute symlinks if relative link generation fails #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
IFS experiments fail on Atos from ecbundle 2.2.1 onwards due to #16, because the link path and target path see different representations of the filesystem when linking
bundle.ymlandarch:This massively overcomplicates the link, but more importantly the result is invalid because the two representations of the same directory have different depths.
As a workaround, if an absolute target path is converted to a relative path, check if the resulting link is valid; if not, repeat with the original, absolute path.
(An alternative workaround would be
target = os.path.relpath(target, os.path.dirname(os.path.realpath(link_name))), but when generating internal project links such asthis produces
ifs_dp -> ../../../../../../../../../ec/fws2/...which, though valid, is barely any better.)If the link to bundle.yml fails, ecbundle-create still succeeds, but any build which invokes options defined in the bundle will fail with seemingly unrelated errors, e.g.
because the build couldn't find bundle.yml, and so these options were never defined. (Not finding the arch file is also obviously bad, for other reasons.) Therefore I've added an extra check to abort if the final symlink is invalid, to prevent builds continuing in an untenable state.
Contributor Declaration
By opening this pull request, I affirm the following: