Skip to content

Commit

Permalink
FOP-2854: Allow to override CreationDate
Browse files Browse the repository at this point in the history
Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This patch was done while working on reproducible builds for openSUSE.
  • Loading branch information
bmwiedemann committed Dec 23, 2020
1 parent 655ac8b commit 0d3f0f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public static Metadata createXMPFromPDFDocument(PDFDocument pdfDoc) {

//Set creation date if not available, yet
if (info.getCreationDate() == null) {
Date d = new Date();
Date d = System.getenv("SOURCE_DATE_EPOCH") == null ?
new Date() :
new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
info.setCreationDate(d);
}

Expand Down

0 comments on commit 0d3f0f9

Please sign in to comment.