File 14-make-builds-reproducible.patch of Package dvdisaster
From: Carlos Maddela <e7appew@gmail.com>
Date: Mon, 19 Dec 2016 09:39:49 +1100
Subject: Make builds reproducible.
Description: Make builds reproducible.
Use the Debian changelog details to derive a build number and date,
so that we can make reproducible binaries.
Author: Carlos Maddela <e7appew@gmail.com>
Forwarded: not-needed
Last-Update: 2017-08-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---
build.c | 2 +-
closure.c | 2 +-
dvdisaster.h | 2 +-
locale/cs.po | 4 ++--
locale/pt_BR.po | 4 ++--
locale/ru.po | 4 ++--
scripts/time-stamper.bash | 8 ++++----
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/build.c b/build.c
index 0e99b22..65b17cd 100644
--- a/build.c
+++ b/build.c
@@ -25,4 +25,4 @@
/* build is incremented at each make;
make recompile of dependent file as fast as possible */
-int buildCount = BUILD;
+const char *const buildCount = BUILD;
diff --git a/closure.c b/closure.c
index 58ba86f..d633d53 100644
--- a/closure.c
+++ b/closure.c
@@ -442,7 +442,7 @@ void InitClosure()
#define BITNESS_STRING ""
#endif
- Closure->versionString = g_strdup_printf("dvdisaster %s build %d, %s%s",
+ Closure->versionString = g_strdup_printf("dvdisaster %s build %s, %s%s",
Closure->cookedVersion, buildCount, SYS_NAME, BITNESS_STRING);
/* Replace the dot with a locale-resistant separator */
diff --git a/dvdisaster.h b/dvdisaster.h
index a466450..9acd094 100644
--- a/dvdisaster.h
+++ b/dvdisaster.h
@@ -463,7 +463,7 @@ void FreeBitmap(Bitmap*);
*** build.h
***/
-int buildCount;
+extern const char *const buildCount;
/***
*** cacheprobe.h
diff --git a/locale/cs.po b/locale/cs.po
index 4f766a3..453ec07 100644
--- a/locale/cs.po
+++ b/locale/cs.po
@@ -6511,11 +6511,11 @@ msgstr "<i>Novinky v této verzi:</i>"
#~ msgid ""
#~ "\n"
-#~ "dvdisaster version %s build %d\n"
+#~ "dvdisaster version %s build %s\n"
#~ "\n"
#~ msgstr ""
#~ "\n"
-#~ "dvdisaster verze %s sestavení %d\n"
+#~ "dvdisaster verze %s sestavení %s\n"
#~ "\n"
#~ msgid "--prefetch-sectors must be in range 32...8096"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index f3437f3..f7f6af0 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -6232,11 +6232,11 @@ msgstr "<i>Novidades dessa versão:</i>"
#~ msgid ""
#~ "\n"
-#~ "dvdisaster version %s build %d\n"
+#~ "dvdisaster version %s build %s\n"
#~ "\n"
#~ msgstr ""
#~ "\n"
-#~ "dvdisaster, versão %s build %d\n"
+#~ "dvdisaster, versão %s build %s\n"
#~ msgid "--cache-size maximum is 8192MiB."
#~ msgstr "--cache-size máximo é 8192MiB."
diff --git a/locale/ru.po b/locale/ru.po
index 1bc7324..9625a1f 100644
--- a/locale/ru.po
+++ b/locale/ru.po
@@ -6247,11 +6247,11 @@ msgstr "<i>Новое в этой версии:</i>"
#~ msgid ""
#~ "\n"
-#~ "dvdisaster version %s build %d\n"
+#~ "dvdisaster version %s build %s\n"
#~ "\n"
#~ msgstr ""
#~ "\n"
-#~ "dvdisaster версия %s сборка %d\n"
+#~ "dvdisaster версия %s сборка %s\n"
#~ "\n"
#~ msgid "--cache-size maximum is 8192MiB."
diff --git a/scripts/time-stamper.bash b/scripts/time-stamper.bash
index fd28794..4ec3e60 100755
--- a/scripts/time-stamper.bash
+++ b/scripts/time-stamper.bash
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
-build=$(grep BUILD $1 | cut -d\ -f3)
-build=$((build+1))
-echo "#define BUILD $build" >$1
-date=$(date +"%d.%m.%y (%A, %H:%M)")
+# Use Debian changelog details to derive build number and date.
+build=$(echo "${DEB_VERSION}" | cut -f2 -d-)
+echo "#define BUILD \"$build\"" >$1
+date=$(date --date="@${SOURCE_DATE_EPOCH}" --utc +"%d.%m.%y (%A, %H:%M)")
echo "#define BDATE \"$date\"" >>$1