On Fri, 2014-09-26 at 19:30 +0200, Guillem Jover wrote:

> Please, see
> <https://wiki.debian.org/Teams/Dpkg/FAQ#Q:_Can_we_add_support_for_new_default_build_flags_to_dpkg-buildflags.3F>
> for the process to include it in the default set.

Thanks for the pointer.

> Although for now I'm fine merging this being disabled by default.

Thanks! The attached patches keep it disabled it by default.
We will submit another patch once the requisite steps have been taken.

> Meanwhile I've added support to dpkg-buildflags to honor feature area
> settings from DEB_BUILD_OPTIONS, so that these can be enabled globally by
> a builder for example for build tests and similar, but will be overridden
> by DEB_BUILD_MAINT_OPTIONS though (in the same way build flags are).

Thanks.

> Please change this to “# Default feature states.”, to make it
> independent of their enabled/disabled state, I've already changed
> the original string where this was copied from.
...
> And move this comment to the other patch.

Good points, done in the attached patches.

> I'm thinking that if this gets accepted by the project at large, then
> it might even make sense to make it an error (-Werror=date-time) at
> some later point, so the name would be wrong. How about 'timeless'?
> Or can you think about some other more appropriate name?

I wasn't aware of the -Werror=date-time flag, thanks for pointing it
out. We should indeed transition to making it an error at some point.
Your proposed name sounds perfect, adopted in the attached patches.

> It would be nice if you could add documentation in the dpkg-buildflags
> man page, a new .SS subsection, with something along the lines of the
> first Hardening paragraph (I had already reworked the common parts out
> of the Hardening subsection for other feature areas, so no need to
> repeat those).

Updated each of the patches to include documentation updates too.

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

From 686a93ce12291b2344d8c8511e8ed2a104a91818 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Wed, 24 Sep 2014 19:41:18 +0800
Subject: [PATCH 1/2] Add infra and docs for build flags related to
 reproducible builds.

Prepare-for: #762683
---
 man/dpkg-buildflags.1         |  5 +++++
 scripts/Dpkg/Vendor/Debian.pm | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/man/dpkg-buildflags.1 b/man/dpkg-buildflags.1
index e3d18ab..cfb3f53 100644
--- a/man/dpkg-buildflags.1
+++ b/man/dpkg-buildflags.1
@@ -318,6 +318,11 @@ architectures (most notably i386) can see performance losses of up to
 15% in very text-segment-heavy application workloads; most workloads
 see less than 1%. Architectures with more general registers (e.g. amd64)
 do not see as high a worst-case penalty.
+.SS Reproducibility
+The compile-time options detailed below can be used to help improve
+build reproducibility or provide additional warning messages during
+compilation. Except as noted below, these are enabled by default for
+architectures that support them.
 .
 .SH ENVIRONMENT
 There are 2 sets of environment variables doing the same operations, the
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 775f3ac..96749c0 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,17 @@ sub add_hardening_flags {
     }
 }
 
+sub add_reproducible_flags {
+    my ($self, $flags) = @_;
+
+    # Default feature states.
+    my %use_feature = (
+    );
+
+    # Store the feature usage.
+    while (my ($feature, $enabled) = each %use_feature) {
+	$flags->set_feature('reproducible', $feature, $enabled);
+    }
+}
+
 1;
-- 
2.1.0

From b2f9fce092a50cc5e3e6bf060af066eda12526b6 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Wed, 24 Sep 2014 19:41:46 +0800
Subject: [PATCH 2/2] Add option to warn about using __TIME__, __DATE__ and
 __TIMESTAMP__ macros.

Closes: #762683
---
 man/dpkg-buildflags.1         | 7 +++++++
 scripts/Dpkg/Vendor/Debian.pm | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/man/dpkg-buildflags.1 b/man/dpkg-buildflags.1
index cfb3f53..4b3ee22 100644
--- a/man/dpkg-buildflags.1
+++ b/man/dpkg-buildflags.1
@@ -323,6 +323,13 @@ The compile-time options detailed below can be used to help improve
 build reproducibility or provide additional warning messages during
 compilation. Except as noted below, these are enabled by default for
 architectures that support them.
+.TP
+.B timeless
+This setting (disabled by default) adds
+.B \-Wdate\-time
+to \fBCPPFLAGS\fP.
+This will cause warnings when the \fB__TIME__\fP, \fB__DATE__\fP and
+\fB__TIMESTAMP__\fP macros are used.
 .
 .SH ENVIRONMENT
 There are 2 sets of environment variables doing the same operations, the
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 96749c0..b9744b9 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -229,8 +229,14 @@ sub add_reproducible_flags {
 
     # Default feature states.
     my %use_feature = (
+	timeless => 0,
     );
 
+    # Warnings when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used
+    if ($use_feature{timeless}) {
+	$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
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to