File 0001-pass-SOURCE_DATE_EPOCH-into-build-env.patch of Package build

From fde2121c9bbb1817dc259dab5ae14b2c07e5fcf6 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Fri, 11 Mar 2016 14:37:20 +0100
Subject: [PATCH] pass SOURCE_DATE_EPOCH into build env

to allow reproducible builds

for this to work from osc build, you need to add SOURCE_DATE_EPOCH
to the Defaults env_keep line in /etc/sudoers
---
 build | 2 ++
 1 file changed, 2 insertions(+)

Index: obs-build-20161206/build
===================================================================
--- obs-build-20161206.orig/build
+++ obs-build-20161206/build
@@ -438,6 +438,9 @@ shellquote() {
 # through /bin/su -c
 toshellscript() {
     echo "#!/bin/sh -x"
+    SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH//[^0-9]/} # sanitize
+    test -n "$SOURCE_DATE_EPOCH" && \
+    echo "export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
     echo -n exec
     shellquote "$@"
     echo
Index: obs-build-20161206/build-vm
===================================================================
--- obs-build-20161206.orig/build-vm
+++ obs-build-20161206/build-vm
@@ -776,6 +776,7 @@ vm_first_stage() {
     test "$VM_TYPE" = lxc -o "$VM_TYPE" = docker && PERSONALITY=0
     echo "PERSONALITY='$PERSONALITY'" >> $BUILD_ROOT/.build/build.data
     echo "MYHOSTNAME='`hostname`'" >> $BUILD_ROOT/.build/build.data
+    echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $BUILD_ROOT/.build/build.data
     echo -n "definesnstuff=(" >> $BUILD_ROOT/.build/build.data
     shellquote "${definesnstuff[@]}" >> $BUILD_ROOT/.build/build.data
     echo ")" >> $BUILD_ROOT/.build/build.data