diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-01-07 13:06:41 +0100 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2021-01-07 13:06:41 +0100 |
commit | 0ea0dacc20c706e258f103cfc925a9a02102ce26 (patch) | |
tree | 8c0bd111d92fd39bc41ba8ac2d8054487c3ab39a /pkgs/build-support | |
parent | 9075da145aedc85467598a61e556f4d1032bd0d1 (diff) | |
parent | f19eb635b4585f6ba4f9f4c3e9e07f56623446f5 (diff) |
Merge branch 'staging-next' into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/docker/examples.nix | 11 | ||||
-rw-r--r-- | pkgs/build-support/docker/stream_layered_image.py | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix index 85ddeb257405..86375a40baa0 100644 --- a/pkgs/build-support/docker/examples.nix +++ b/pkgs/build-support/docker/examples.nix @@ -416,4 +416,15 @@ rec { contents = crossPkgs.hello; }; + # layered image where a store path is itself a symlink + layeredStoreSymlink = + let + target = pkgs.writeTextDir "dir/target" "Content doesn't matter."; + symlink = pkgs.runCommandNoCC "symlink" {} "ln -s ${target} $out"; + in + pkgs.dockerTools.buildLayeredImage { + name = "layeredstoresymlink"; + tag = "latest"; + contents = [ pkgs.bash symlink ]; + } // { passthru = { inherit symlink; }; }; } 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)) |