diff options
author | Sarah Brofeldt <sarah@qtr.dk> | 2021-01-04 19:39:21 +0100 |
---|---|---|
committer | Sarah Brofeldt <sarah@qtr.dk> | 2021-01-04 19:47:34 +0100 |
commit | 08b0d02944eb94359726ac61af3c3ab84b53ee7d (patch) | |
tree | 73379e03c2d60c92bce0d3a5f6e9cbab3f912cbc /pkgs/build-support | |
parent | 56bb1b0f7a33e5d487dc2bf2e846794f4dcb4d01 (diff) |
dockerTools: Fix streamLayeredImage for symlinks
When archiving `/nix/store/foo` and `foo` is itself a symlink, we must
not traverse the symlink target, but archive the `foo` symlink itself
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/docker/stream_layered_image.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/stream_layered_image.py b/pkgs/build-support/docker/stream_layered_image.py index cbae0f723f92..e35bd0b0e8c0 100644 --- a/pkgs/build-support/docker/stream_layered_image.py +++ b/pkgs/build-support/docker/stream_layered_image.py @@ -83,7 +83,11 @@ def archive_paths_to(obj, paths, mtime): for path in paths: path = pathlib.Path(path) - files = itertools.chain([path], path.rglob("*")) + if path.is_symlink(): + files = [path] + else: + files = itertools.chain([path], path.rglob("*")) + for filename in sorted(files): ti = append_root(tar.gettarinfo(filename)) |