| 1 |
Description: Make generated manpage date reproducible |
| 2 |
uudoc stamped each generated manpage with the current date (Zoned::now()), |
| 3 |
which made the package unreproducible: rebuilding on a different day produced |
| 4 |
a different .TH date line in every rust-*.1 manpage. |
| 5 |
. |
| 6 |
Honour SOURCE_DATE_EPOCH instead, which Debian derives from the latest |
| 7 |
debian/changelog entry, falling back to the current date when the variable |
| 8 |
is unset (e.g. an upstream build outside dpkg-buildpackage). |
| 9 |
Author: Sylvestre Ledru <[email protected]> |
| 10 |
Bug: https://reproduce.debian.net/i386/api/v1/builds/211467/artifacts/519913/diffoscope |
| 11 |
Forwarded: not-needed |
| 12 |
Last-Update: 2026-06-04 |
| 13 |
=================================================================== |
| 14 |
--- a/src/bin/uudoc.rs |
| 15 |
+++ b/src/bin/uudoc.rs |
| 16 |
@@ -187,8 +187,19 @@ fn gen_manpage<T: Args>( |
| 17 |
// Convert to string for processing |
| 18 |
let manpage = String::from_utf8(buffer).expect("Invalid UTF-8 in manpage"); |
| 19 |
|
| 20 |
- // Post-process the manpage to fix mandoc lint issues |
| 21 |
- let date = Zoned::now().strftime("%Y-%m-%d").to_string(); |
| 22 |
+ // Post-process the manpage to fix mandoc lint issues. |
| 23 |
+ // Honour SOURCE_DATE_EPOCH (set by Debian from the latest debian/changelog |
| 24 |
+ // entry) so the manpage date is reproducible; fall back to the current date. |
| 25 |
+ let date = match std::env::var("SOURCE_DATE_EPOCH") |
| 26 |
+ .ok() |
| 27 |
+ .and_then(|s| s.trim().parse::<i64>().ok()) |
| 28 |
+ { |
| 29 |
+ Some(epoch) => jiff::Timestamp::from_second(epoch) |
| 30 |
+ .expect("invalid SOURCE_DATE_EPOCH") |
| 31 |
+ .strftime("%Y-%m-%d") |
| 32 |
+ .to_string(), |
| 33 |
+ None => Zoned::now().strftime("%Y-%m-%d").to_string(), |
| 34 |
+ }; |
| 35 |
let processed_manpage = post_process_manpage(manpage, &date); |
| 36 |
|
| 37 |
// Write the processed manpage to stdout |