pkg_tar: if symlink starts with ./, keep it absolute (#854)

For the `symlink` attribute of `pkg_tar`, if the path begins
with ./, preserve the path rather than prefixing package_dir.
This allows graceful migration for some uses who rely on
the previous package_dir behavior.
This commit is contained in:
aiuto 2024-04-18 00:25:07 -04:00 committed by GitHub
parent dc21c28186
commit e604010237
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -184,7 +184,10 @@ class TarFile(object):
names: (username, groupname) for the file to set ownership. An empty
file will be created as `destfile` in the layer.
"""
dest = self.normalize_path(symlink)
if not symlink.startswith("./"):
dest = self.normalize_path(symlink)
else:
dest = symlink
self.tarfile.add_file(
dest,
tarfile.SYMTYPE,