[maven2-core] 01/01: Set maven.build.timestamp to the date of the latest entry in debian/changelog

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Wed May 13 10:01:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository maven2-core.

commit 601e18da2d274310a140d1f313000a3f4f849c14
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Wed May 13 11:10:42 2015 +0200

    Set maven.build.timestamp to the date of the latest entry in debian/changelog
---
 debian/changelog                                   |  9 +++++
 .../0006-reproducible-built-timestamp.patch        | 43 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 53 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index f29865d..048a969 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+maven2-core (2.2.1-19) unstable; urgency=medium
+
+  * Team upload.
+  * Set the maven.build.timestamp variable to the date of the latest entry
+    in debian/changelog when building a Debian package to make the builds
+    reproducible.
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Wed, 13 May 2015 10:13:33 +0200
+
 maven2-core (2.2.1-18) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/patches/0006-reproducible-built-timestamp.patch b/debian/patches/0006-reproducible-built-timestamp.patch
new file mode 100644
index 0000000..5e07df3
--- /dev/null
+++ b/debian/patches/0006-reproducible-built-timestamp.patch
@@ -0,0 +1,43 @@
+Description: Set the maven.build.timestamp variable to the date of the latest entry
+ in debian/changelog when building a Debian package to make the builds reproducible.
+Author: Emmanuel Bourg <ebourg at pache.org>
+Forwarded: not-needed
+--- a/maven-project/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java
++++ b/maven-project/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java
+@@ -51,7 +51,14 @@
+         {
+             if ( formattedDate == null && startTime != null )
+             {
+-                formattedDate = new SimpleDateFormat( format ).format( startTime );
++                SimpleDateFormat fmt = new SimpleDateFormat( format );
++                Date debianBuildDate = getDebianBuildDate();
++                if ( debianBuildDate == null ) {
++                    formattedDate = fmt.format( startTime );
++                } else {
++                    fmt.setTimeZone(java.util.TimeZone.getTimeZone( "UTC" ));
++                    formattedDate = fmt.format( debianBuildDate );
++                }
+             }
+             
+             return formattedDate;
+@@ -60,4 +67,20 @@
+         return null;
+     }
+ 
++    /**
++     * Returns the Debian build date specified by the DEB_CHANGELOG_DATETIME environment variable.
++     */
++    static Date getDebianBuildDate() {
++        String envName = "DEB_CHANGELOG_DATETIME";
++        String envVariable = System.getenv(envName);
++        if (envVariable == null) {
++            return null;
++        }
++
++        try {
++            return new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz").parse(envVariable);
++        } catch (Exception e) {
++            throw new IllegalArgumentException(envName + " not in recognised format", e);
++        }
++    }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 1b06805..5ca293e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 0003-update-plexus-utils.patch
 0004-remove-backport-util-concurrent.patch
 0005-secure-maven-central-access.patch
+0006-reproducible-built-timestamp.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven2-core.git



More information about the pkg-java-commits mailing list