diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-06-28 15:11:31 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-06-28 15:11:31 +0900 |
commit | 9ae1e1a290f67628d4e68632618b0aa9aa92b4e3 (patch) | |
tree | ba9055654d074eaf46b6e71c2ed0f449c161b57b | |
parent | b99d697e740d1236cda7596d981023010ae9d9f4 (diff) | |
download | buildstream-9ae1e1a290f67628d4e68632618b0aa9aa92b4e3.tar.gz |
utils.py: Additional fix to _relative_symlink_target()
Since we merged MR 29 with a fix for resolving symlinks to realpaths,
we should also use the real path of the staging directory to produce
a relative path properly.
If we are considering that staged symlinks link to symlinked paths
inside the staging target, we must also consider that the staging
area itself can be in a symliked directory.
-rw-r--r-- | buildstream/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py index b48d2a34e..fed3864b3 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -491,9 +491,14 @@ def _relative_symlink_target(root, symlink, target): # is located, not from the symlink itself. symlinkdir, _ = os.path.split(os.path.realpath(symlink)) + # Since we are asking for a relative path of a realpath() on + # the symlink, we also need a realpath() of the staging area + # (the build directory can also have leading symlinks) + real_root = os.path.realpath(root) + # Create a full path to the target, including the leading staging # directory - fulltarget = os.path.join(root, target) + fulltarget = os.path.join(real_root, target) # now get the relative path from the directory where the symlink # is located within the staging root, to the target within the same |