From 2accea2c81353263d2ce8a0cc3f97af266d0dd9c Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 2 Dec 2016 11:14:56 +0100 Subject: [PATCH] Read SOURCE_DATE_EPOCH if it exists --- Makefile | 5 +++-- extra/make-man.hs | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a67b77a..4e932fb 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ PANDOC_MINOR_VERSION=$(shell ghc-pkg latest pandoc | sed 's/.*-//' | cut -d. -f2) -PATAT_BUILD_DATE=$(shell date '+%B %d, %Y' -d "$(shell git log -1 --format=%cd --date=short)") +SOURCE_DATE_EPOCH?=$(shell git log -1 --format=%cd --date=unix) +SOURCE_DATE=$(shell date '+%B %d, %Y' -d "@${SOURCE_DATE_EPOCH}") extra/patat.1: README.md extra/make-man - PATAT_BUILD_DATE="$(PATAT_BUILD_DATE)" ./extra/make-man >$@ + SOURCE_DATE="$(SOURCE_DATE)" ./extra/make-man >$@ extra/make-man: extra/make-man.hs ghc -DPANDOC_MINOR_VERSION=${PANDOC_MINOR_VERSION} -Wall -o $@ $< diff --git a/extra/make-man.hs b/extra/make-man.hs index d358101..bb29131 100644 --- a/extra/make-man.hs +++ b/extra/make-man.hs @@ -83,9 +83,8 @@ main = do Right pandoc0 <- Pandoc.readMarkdown Pandoc.def <$> readFile "README.md" Right template <- Pandoc.getDefaultTemplate Nothing "man" - -- It's important for reproducible builds that we get the date from git. version <- getVersion - date <- getEnv "PATAT_BUILD_DATE" + date <- getEnv "SOURCE_DATE" let writerOptions = Pandoc.def { #if PANDOC_MINOR_VERSION >= 19