Bug#913021: carbon-c-relay: make the build reproducible

2018-11-06 Thread Chris Lamb
Hi Nicholas,

> The attached patch changes the build system to first attempt to use
> the SOURCE_DATE_EPOCH envvar
> (https://reproducible-builds.org/specs/source-date-epoch/) to
> determine build date, then falls back to the git commit date, then the
> current date.

Good idea. Fancy forwarding this upstream? Looks like they have a Github repo 
here:

  https://github.com/grobian/carbon-c-relay

… which should make it straightforward enough. You can the use the
BTS "forwarded" command to link them together:

  https://www.debian.org/Bugs/server-control#forwarded


Best wishes,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-



Bug#913021: carbon-c-relay: make the build reproducible

2018-11-05 Thread Nicholas M Gregory
Source: carbon-c-relay
Version: 3.2-1
Severity: wishlist
Tags: patch
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi there,

While working on the reproducible builds project
(https://wiki.debian.org/ReproducibleBuilds), we noticed that
carbon-c-relay could not be built reproducibly.

The attached patch changes the build system to first attempt to use
the SOURCE_DATE_EPOCH envvar
(https://reproducible-builds.org/specs/source-date-epoch/) to
determine build date, then falls back to the git commit date, then the
current date.

Best,
-Nick Gregory

 begin patch 
--- Makefile.am.orig 2017-10-21 10:39:41.0 -0400
+++ Makefile.am 2018-11-05 22:45:30.772368908 -0500
@@ -16,7 +16,11 @@

 CFLAGS ?= -O2 -Wall -Wshadow -pipe

-GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always
2>/dev/null || date +%F)
+GIT_VERSION := $(shell \
+ date -u -d "@${SOURCE_DATE_EPOCH}" "+%F" 2>/dev/null || \
+ date -u -r "${SOURCE_DATE_EPOCH}" "+%F" 2>/dev/null || \
+ git describe --abbrev=6 --dirty --always 2>/dev/null || \
+ date +%F)
 GVCFLAGS = -DGIT_VERSION=\"$(GIT_VERSION)\"

 override CFLAGS += $(GVCFLAGS) -pthread