Skip to content

Commit

Permalink
pkg_tar: if symlink starts with ./, keep it absolute (bazelbuild#854)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aiuto authored Apr 18, 2024
1 parent dc21c28 commit e604010
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/private/tar/build_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ def add_link(self, symlink, destination, mode=None, ids=None, names=None):
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,
Expand Down

0 comments on commit e604010

Please sign in to comment.