Package: libdpkg-perl
Severity: wishlist
Tags: patch
Usertags: sentpatch
User: [email protected]
Usertags: toolchain timestamps
X-Debbugs-CC: [email protected]

The attached pair of patches add support for adding build flags that
help with build reproducibility and add the -Wdate-time flag, which
causes warnings when the time related macros are used. This has the
potential to cause FTBFS in conjunction with -Werror so we are willing
to do package rebuilds with this patch in order to test the theory.

https://wiki.debian.org/ReproducibleBuilds#Usage_of___DATE__.2C___TIME__.2C___TIMESTAMP___C_pre-processor_macros

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

From d5538d91bb35d489ef2aaa5f9b8cf62fbed676cb Mon Sep 17 00:00:00 2001
From: Paul Wise <[email protected]>
Date: Wed, 24 Sep 2014 19:41:18 +0800
Subject: [PATCH 1/2] Add a function for adding flags related to reproducible
 builds.

---
 scripts/Dpkg/Vendor/Debian.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 775f3ac..b59cba2 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -68,6 +68,7 @@ sub run_hook {
 	}
     } elsif ($hook eq 'update-buildflags') {
 	$self->add_hardening_flags(@params);
+	$self->add_reproducible_flags(@params);
     } else {
         return $self->SUPER::run_hook($hook, @params);
     }
@@ -223,4 +224,18 @@ sub add_hardening_flags {
     }
 }
 
+sub add_reproducible_flags {
+    my ($self, $flags) = @_;
+
+    # Features enabled by default for all builds.
+    my %use_feature = (
+    );
+
+    # Warnings when __TIME__ __DATE__ __TIMESTAMP__ macros used
+    # Store the feature usage.
+    while (my ($feature, $enabled) = each %use_feature) {
+	$flags->set_feature('reproducible', $feature, $enabled);
+    }
+}
+
 1;
-- 
2.1.0

From 3644a69a3770eb1b7ed7c119c940ddd04c89b5e3 Mon Sep 17 00:00:00 2001
From: Paul Wise <[email protected]>
Date: Wed, 24 Sep 2014 19:41:46 +0800
Subject: [PATCH 2/2] Warn about the use of __TIME__, __DATE__ and
 __TIMESTAMP__ macros.

---
 scripts/Dpkg/Vendor/Debian.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index b59cba2..10aa7eb 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -229,9 +229,14 @@ sub add_reproducible_flags {
 
     # Features enabled by default for all builds.
     my %use_feature = (
+	warntime => 1,
     );
 
     # Warnings when __TIME__ __DATE__ __TIMESTAMP__ macros used
+    if ($use_feature{warntime}) {
+	$flags->append('CPPFLAGS', '-Wdate-time');
+    }
+
     # Store the feature usage.
     while (my ($feature, $enabled) = each %use_feature) {
 	$flags->set_feature('reproducible', $feature, $enabled);
-- 
2.1.0

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Reproducible-builds mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to