This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository maven-bundle-plugin.
commit 1dc866ccd0e3551e444a6f5eb116dec0fd3db98d Author: Emmanuel Bourg <[email protected]> Date: Mon Jun 29 10:52:51 2015 +0200 Use the DEB_CHANGELOG_DATETIME variable for the timstamp in pom.properties --- debian/changelog | 9 +++ debian/patches/series | 1 + ...hangelog-date-as-pom.properties-timestamp.patch | 94 ++++++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/debian/changelog b/debian/changelog index c5a55ae..3490818 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +maven-bundle-plugin (2.4.0-2) UNRELEASED; urgency=medium + + * Team upload. + * The date set in the DEB_CHANGELOG_DATETIME environment variable is now used + for the timestamp in the pom.properties file embedded in the jar files + generated by maven-bundle-plugin to make the builds reproducible. + + -- Emmanuel Bourg <[email protected]> Mon, 29 Jun 2015 10:49:54 +0200 + maven-bundle-plugin (2.4.0-1) experimental; urgency=medium * Team upload. diff --git a/debian/patches/series b/debian/patches/series index decc8e4..d56fe56 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ remove_bndlib_spring_support.diff support_plexus_utils_1_5.diff backward-compatibility.patch +use-changelog-date-as-pom.properties-timestamp.patch diff --git a/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch b/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch new file mode 100644 index 0000000..930c2c1 --- /dev/null +++ b/debian/patches/use-changelog-date-as-pom.properties-timestamp.patch @@ -0,0 +1,94 @@ +Description: Use the date specified by the DEB_CHANGELOG_DATETIME variable when generating the header of pom.properties +Author: Emmanuel Bourg <[email protected]> +Forwarded: not-needed +--- /dev/null ++++ b/src/main/java/org/apache/felix/bundleplugin/TimestampedProperties.java +@@ -0,0 +1,48 @@ ++package org.apache.felix.bundleplugin; ++ ++import java.io.*; ++import java.text.*; ++import java.util.*; ++import java.util.regex.*; ++ ++/** ++ * Properties file timestamped with a specified date. ++ */ ++class TimestampedProperties extends Properties ++{ ++ private Date date; ++ ++ public TimestampedProperties(Date date) { ++ this.date = date; ++ } ++ ++ @Override ++ public void store(OutputStream out, String comments) throws IOException { ++ store(new OutputStreamWriter(out, "ISO-8859-1"), comments); ++ } ++ ++ @Override ++ public void store(Writer out, String comments) throws IOException { ++ // store the properties file in memory ++ StringWriter buffer = new StringWriter(); ++ super.store(buffer, comments); ++ ++ // Replace the date on the second line of the file ++ SimpleDateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); ++ fmt.setTimeZone(TimeZone.getTimeZone("UTC")); ++ String[] lines = buffer.toString().split(Pattern.quote(System.getProperty("line.separator"))); ++ lines[1] = "#" + fmt.format(date); ++ ++ // write the file ++ BufferedWriter writer = new BufferedWriter(out); ++ try { ++ for (String line : lines) { ++ writer.write(line); ++ writer.newLine(); ++ } ++ writer.flush(); ++ } finally { ++ writer.close(); ++ } ++ } ++} +--- /dev/null ++++ b/src/main/java/org/apache/felix/bundleplugin/DebianUtils.java +@@ -0,0 +1,25 @@ ++package org.apache.felix.bundleplugin; ++ ++import java.text.ParseException; ++import java.text.SimpleDateFormat; ++import java.util.Date; ++ ++class DebianUtils { ++ ++ /** ++ * 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", java.util.Locale.ENGLISH).parse(envVariable); ++ } catch (ParseException e) { ++ throw new IllegalArgumentException("maven-bundle-plugin: " + envName + " not in recognised format", e); ++ } ++ } ++} +--- a/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java ++++ b/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +@@ -1028,7 +1028,8 @@ + File pomFile = new File( currentProject.getBasedir(), "pom.xml" ); + jar.putResource( path + "/pom.xml", new FileResource( pomFile ) ); + +- Properties p = new Properties(); ++ java.util.Date buildDate = DebianUtils.getDebianBuildDate(); ++ Properties p = buildDate == null ? new Properties() : new TimestampedProperties(buildDate); + p.put( "version", currentProject.getVersion() ); + p.put( "groupId", currentProject.getGroupId() ); + p.put( "artifactId", currentProject.getArtifactId() ); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-bundle-plugin.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

