Browse Source

FOP-2854: Allow to override CreationDate

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.
pull/65/head
Bernhard M. Wiedemann 3 years ago
parent
commit
0d3f0f9a47
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java

+ 3
- 1
fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java View File

@@ -134,7 +134,9 @@ public class PDFMetadata extends PDFStream {

//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);
}


Loading…
Cancel
Save