summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2019-06-24 17:35:23 +0100
committerTristan Maat <tristan.maat@codethink.co.uk>2019-06-28 16:50:39 +0100
commit51a92d25053904af8094553965e038f681cd2377 (patch)
treead31f0f7110925d5c0140f3648ba3fc17c51d409
parent248786e481bed8dc4c21f70ce42b29f520bee770 (diff)
downloadbuildstream-tlater/tar-basedir.tar.gz
tar.py: Make link target renaming work between base-dirstlater/tar-basedir
Fixes #1052
-rw-r--r--src/buildstream/plugins/sources/tar.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py
index c90de74ea..b0aed75c6 100644
--- a/src/buildstream/plugins/sources/tar.py
+++ b/src/buildstream/plugins/sources/tar.py
@@ -132,18 +132,12 @@ class TarSource(DownloadableFileSource):
# First, ensure that a member never starts with `./`
if member.path.startswith('./'):
member.path = member.path[2:]
+ if member.islnk() and member.linkname.startswith('./'):
+ member.linkname = member.linkname[2:]
# Now extract only the paths which match the normalized path
if member.path.startswith(base_dir):
-
- # If it's got a link name, give it the same treatment, we
- # need the link targets to match up with what we are staging
- #
- # NOTE: Its possible this is not perfect, we may need to
- # consider links which point outside of the chosen
- # base directory.
- #
- if member.type == tarfile.LNKTYPE:
+ if member.islnk() and member.linkname.startswith(base_dir):
member.linkname = member.linkname[L:]
member.path = member.path[L:]