summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorArnout Engelen <arnout@bzzt.net>2020-12-03 20:03:20 +0100
committerArnout Engelen <arnout@bzzt.net>2020-12-04 09:24:37 +0100
commit777cb35eb82b1e26613e7b16717cf78b4a959354 (patch)
tree8981099c31a4106a7a57718cad1f60a7571cf3cd /pkgs/build-support/setup-hooks
parent6cea12ccff6e279f0bc1f91aa6a898d642e03320 (diff)
downloadnixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar.gz
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar.bz2
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar.lz
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar.xz
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.tar.zst
nixpkgs-777cb35eb82b1e26613e7b16717cf78b4a959354.zip
compress-man-pages: symlink compressed manpages deterministically
For example graphviz has chained symlinked manpages: dot2gxl.1 is
a symlink to gv2gxl.1 which is a symlink to gxl2gv.1

The second loop replaces each non-compressed symlink to a compressed
symlink. The target is determined with 'readlink -f', which follows
links recursively until the first name that is not a link (so either
the 'target name' or the first 'dangling' symlink).

This means that if the loop converted dot2gxl.1 before converting
gv2gxl.1 it would add a symlink `dot2gxl.1.gz->gxl2gv.1.gz`. When
it converted gv2gxl.1 first, it would then add a
`dot2gxl.1.gz->gv2gxl.1.gz` symlink.

Both are 'correct', but it's weird the result depends on the order
in which 'find' returns the files. This PR makes the behaviour
deterministic.

fixes #104708
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/compress-man-pages.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkgs/build-support/setup-hooks/compress-man-pages.sh b/pkgs/build-support/setup-hooks/compress-man-pages.sh
index 82e48cd8aa7..f5af76e8168 100644
--- a/pkgs/build-support/setup-hooks/compress-man-pages.sh
+++ b/pkgs/build-support/setup-hooks/compress-man-pages.sh
@@ -21,6 +21,7 @@ compressManPages() {
 
     # Point symlinks to compressed manpages.
     find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 \
+        | sort -z \
         | while IFS= read -r -d $'\0' f
     do
         local target