debian/dash.postinst: reproducible symlink mtime if SOURCE_DATE_EPOCH is set
If the postinst is executed while SOURCE_DATE_EPOCH is set, then this is not a regular installation but the postinst is called as part of building a reproducible chroot tarball or image. Since man-db stores symlink modification times in its index.db we need to set a reproducible mtime.
As of Debian Bullseye only three items are left to be solved to make creating a Priority:standard chroot bit-by-bit reproducible:
- unreproducible fontconfig cache was solved via NMU a few days ago
- unreproducible pyc files can be solved by backporting a patch that will be released with Python 3.11
- man-db creates unreproducible index.db files because it stores the mtimes of symlinks. The man-db maintainer would rather see the symlink mtimes become reproducible than changing man-db if SOURCE_DATE_EPOCH is set.
This MR solves the last item. Most symlinks are created by dpkg's update-alternatives and I have a separate patch for that. But the man-page symlinks created in the dash postinst are then the only remaining piece left to make a Debian Priority:standard chroot bit-by-bit reproducible.
Also see https://wiki.debian.org/ReproducibleInstalls