diff options
author | aiuto <aiuto@google.com> | 2024-04-18 00:25:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 00:25:07 -0400 |
commit | e604010237b87c6acfcdee3e0a41ce0e933b58c5 (patch) | |
tree | 596d955a11965c8dc153cda48078aaddf4cc56e8 | |
parent | dc21c281864f4fb7630f2d2ea34c7a58d8b178b3 (diff) | |
download | rules_pkg-e604010237b87c6acfcdee3e0a41ce0e933b58c5.tar.gz |
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.
-rw-r--r-- | pkg/private/tar/build_tar.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/private/tar/build_tar.py b/pkg/private/tar/build_tar.py index 81ad03f..559c02e 100644 --- a/pkg/private/tar/build_tar.py +++ b/pkg/private/tar/build_tar.py @@ -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, |