This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository maven.
commit d90d8384cdfbfd9ccf1f5c8f20bc24d17b521019 Author: Emmanuel Bourg <[email protected]> Date: Tue Apr 26 15:41:23 2016 +0200 Set the maven.build.timestamp variable to the date defined by SOURCE_DATE_EPOCH --- debian/changelog | 2 + debian/patches/reproducible-build-timestamp.patch | 50 +++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 53 insertions(+) diff --git a/debian/changelog b/debian/changelog index ad0fdc4..811ae98 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ maven (3.3.9-4) UNRELEASED; urgency=medium * Team upload. + * Set the maven.build.timestamp variable to the date defined by the + SOURCE_DATE_EPOCH environment variable to make the Maven builds reproducible * Build depend on libplexus-component-metadata-java (>= 1.6) instead of libplexus-containers1.5-java * libmaven3-core-java now depends on libplexus-component-annotations-java diff --git a/debian/patches/reproducible-build-timestamp.patch b/debian/patches/reproducible-build-timestamp.patch new file mode 100644 index 0000000..2ee694d --- /dev/null +++ b/debian/patches/reproducible-build-timestamp.patch @@ -0,0 +1,50 @@ +Description: Set the maven.build.timestamp variable to the date defined by + the SOURCE_DATE_EPOCH environment variable to make the Maven builds reproducible. +Author: Emmanuel Bourg <[email protected]> +Forwarded: no +--- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java ++++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java +@@ -51,7 +51,15 @@ + { + if ( formattedDate == null && startTime != null ) + { +- formattedDate = new SimpleDateFormat( format ).format( startTime ); ++ if ( System.getenv( "SOURCE_DATE_EPOCH" ) == null ) { ++ formattedDate = new SimpleDateFormat( format ).format( startTime ); ++ } else { ++ // Use the SOURCE_DATE_EPOCH timestamp and make the format locale insensitive ++ SimpleDateFormat fmt = new SimpleDateFormat( format, java.util.Locale.ENGLISH ); ++ fmt.setTimeZone( java.util.TimeZone.getTimeZone( "UTC" ) ); ++ Date date = new Date( 1000 * Long.parseLong( System.getenv( "SOURCE_DATE_EPOCH" ) ) ); ++ formattedDate = fmt.format( date ); ++ } + } + + return formattedDate; +--- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java ++++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java +@@ -22,6 +22,7 @@ + import java.text.SimpleDateFormat; + import java.util.Date; + import java.util.GregorianCalendar; ++import java.util.Locale; + import java.util.Properties; + import java.util.TimeZone; + +@@ -61,7 +62,15 @@ + { + time = new Date(); + } +- SimpleDateFormat dateFormat = new SimpleDateFormat( timestampFormat ); ++ ++ Locale locale = Locale.getDefault(); ++ if ( System.getenv( "SOURCE_DATE_EPOCH" ) != null ) ++ { ++ time = new Date( 1000 * Long.parseLong( System.getenv( "SOURCE_DATE_EPOCH" ) ) ); ++ locale = Locale.ENGLISH; ++ } ++ ++ SimpleDateFormat dateFormat = new SimpleDateFormat( timestampFormat, locale ); + dateFormat.setCalendar( new GregorianCalendar() ); + dateFormat.setTimeZone( DEFAULT_BUILD_TIME_ZONE ); + formattedTimestamp = dateFormat.format( time ); diff --git a/debian/patches/series b/debian/patches/series index e7c38f1..1d5d7b8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ plugins_version.diff dep_versions.diff modello-configuration.patch build-offline.patch +reproducible-build-timestamp.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

