You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:22:33 UTC
[buildstream] 01/01: tar.py: Make link target renaming work between
base-dirs
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch tlater/tar-basedir
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 51a92d25053904af8094553965e038f681cd2377
Author: Tristan Maat <tr...@codethink.co.uk>
AuthorDate: Mon Jun 24 17:35:23 2019 +0100
tar.py: Make link target renaming work between base-dirs
Fixes #1052
---
src/buildstream/plugins/sources/tar.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py
index c90de74..b0aed75 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:]