Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:bmwiedemann:reproducible:distribution:ring1
xmlgraphics-fop
reproducible.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File reproducible.patch of Package xmlgraphics-fop
https://github.com/apache/xmlgraphics-fop/pull/65 partial fix for https://issues.apache.org/jira/browse/FOP-2854 https://github.com/openSUSE/daps/issues/482 commit 27208260a35415e440b66c1ef4b3d8c116450ffb Author: Bernhard M. Wiedemann <bwiedemann@suse.de> Date: Wed Dec 23 13:53:56 2020 +0100 FOP-2854: Allow to override CreationDate and MetadataDate 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. diff --git a/fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java b/fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java index 107dba9fa..6f93f3da1 100644 --- a/fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java +++ b/fop-core/src/main/java/org/apache/fop/pdf/PDFMetadata.java @@ -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); } diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java index 84e4e3a2c..022a7a7a6 100644 --- a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java @@ -544,7 +544,10 @@ public class IFRenderer extends AbstractPathOrientedRenderer { } else { xmpBasic.setCreatorTool(Version.getVersion()); } - xmpBasic.setMetadataDate(new java.util.Date()); + java.util.Date d = System.getenv("SOURCE_DATE_EPOCH") == null ? + new java.util.Date() : + new java.util.Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); + xmpBasic.setMetadataDate(d); if (getUserAgent().getCreationDate() != null) { xmpBasic.setCreateDate(getUserAgent().getCreationDate()); } else { diff --git a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java index 1f383a29e..281eba87b 100644 --- a/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java +++ b/fop-core/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java @@ -260,7 +260,10 @@ class PDFRenderingUtil { fopXMP.mergeInto(docXMP, exclude); XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(docXMP); //Metadata was changed so update metadata date - xmpBasic.setMetadataDate(new java.util.Date()); + java.util.Date d = System.getenv("SOURCE_DATE_EPOCH") == null ? + new java.util.Date() : + new java.util.Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); + xmpBasic.setMetadataDate(d); PDFMetadata.updateInfoFromMetadata(docXMP, pdfDoc.getInfo()); PDFMetadata pdfMetadata = pdfDoc.getFactory().makeMetadata(
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor