1
0

Accepting request 735873 from home:bmwiedemann:reproducible:test

Add reproducible-footer.patch to override build date (boo#1047218)

OBS-URL: https://build.opensuse.org/request/show/735873
OBS-URL: https://build.opensuse.org/package/show/Java:packages/maven-javadoc-plugin?expand=0&rev=8
This commit is contained in:
Tomáš Chvátal 2019-10-07 14:54:00 +00:00 committed by Git OBS Bridge
parent 9d532c15b5
commit 06b09cabda
3 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Oct 7 13:50:06 UTC 2019 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add reproducible-footer.patch to override build date (boo#1047218)
-------------------------------------------------------------------
Sat Apr 6 22:38:49 UTC 2019 - Jan Engelhardt <jengelh@inai.de>

View File

@ -33,6 +33,8 @@ Source0: https://repo1.maven.org/maven2/org/apache/maven/plugins/%{base_n
Source1: %{base_name}-build.xml
Patch0: %{base_name}-bootstrap-resources.patch
Patch1: 0001-Port-to-current-plexus-utils.patch
# PATCH-FIX-OPENSUSE bmwiedemann -- https://issues.apache.org/jira/browse/MJAVADOC-619
Patch2: reproducible-footer.patch
BuildRequires: apache-commons-cli
BuildRequires: apache-commons-io
BuildRequires: apache-commons-lang3
@ -121,6 +123,7 @@ cp %{SOURCE1} build.xml
%endif
%patch1 -p1
%patch2 -p1
%pom_remove_plugin :maven-enforcer-plugin

29
reproducible-footer.patch Normal file
View File

@ -0,0 +1,29 @@
https://salsa.debian.org/java-team/maven-javadoc-plugin/blob/master/debian/patches/reproducible-footer.patch
for https://issues.apache.org/jira/browse/MJAVADOC-619
Description: Use the SOURCE_DATE_EPOCH variable to set the current year displayed in the javadoc footer
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -2821,6 +2821,20 @@
private String getBottomText()
{
int currentYear = Calendar.getInstance().get( Calendar.YEAR );
+ if ( System.getenv("SOURCE_DATE_EPOCH") != null )
+ {
+ try
+ {
+ Calendar calendar = Calendar.getInstance( java.util.TimeZone.getTimeZone("UTC") );
+ calendar.setTimeInMillis(Long.parseLong( System.getenv("SOURCE_DATE_EPOCH") ) * 1000);
+ currentYear = calendar.get( Calendar.YEAR );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
String year = String.valueOf( currentYear );
String inceptionYear = project.getInceptionYear();