ant/reproducible-build-manifest.patch

33 lines
1.5 KiB
Diff

Use Java major version for manifest's Created-by
No need of detailed version such java.vm.version. Java's jar command
uses java.version when it fills the manifest's "Created-by" field,
let's make ant do the same.
Using a detailed version makes that every Java release triggers a
new publication for ant-based applications, only because a line in
manifest has changed - not because the binary or dependencies have
changed. Using a less detailed version reduces these publications.
Using a less detailed version also prevents more subtle problems
such as in boo#1110024: noarch packages differ depending on the
builder architecture, when Java vm version contains an architecture
information (which is the case for openSUSE, though it's probably
not relevant).
--
--- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
@@ -760,10 +760,7 @@
defManifest);
}
Manifest defaultManifest = new Manifest(new InputStreamReader(in, JAR_CHARSET));
- String version = System.getProperty("java.runtime.version");
- if (version == null) {
- version = System.getProperty("java.vm.version");
- }
+ String version = System.getProperty("java.version");
Attribute createdBy = new Attribute("Created-By", version
+ " (" + System.getProperty("java.vm.vendor") + ")");
defaultManifest.getMainSection().storeAttribute(createdBy);