This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a065a5  Reproducible builds. Implement better solution for JARs
2a065a5 is described below

commit 2a065a51d959509c93b95f9fce5979ea39ec10a7
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 23 14:23:04 2021 +0000

    Reproducible builds. Implement better solution for JARs
    
    Ant's jar task (and zip task) has a undocumented attribute that can be
    used to control the last modified time for all the files in the archive.
    Use this instead of switching to the zip task as the zip task does not
    store /META-INF/MANIFEST at the start of the archive as expected by
    JarInputStream
---
 build.xml                   | 110 ++++++++++++++++++--------------------------
 modules/jdbc-pool/build.xml |  20 ++------
 2 files changed, 49 insertions(+), 81 deletions(-)

diff --git a/build.xml b/build.xml
index 60fd8cc..b701195 100644
--- a/build.xml
+++ b/build.xml
@@ -991,13 +991,6 @@
     when loading the ResourceBundles -->
     <native2ascii src="java" dest="${tomcat.classes}" 
includes="**/LocalStrings.properties,**/Messages*.properties" encoding="UTF-8"/>
     <native2ascii src="java" dest="${tomcat.i18n}" 
includes="**/LocalStrings_*.properties" encoding="UTF-8"/>
-
-    <!-- Reproducible builds: consistent timestamps for class files and other
-    files placed in JARs -->
-    <touch datetime="${tstamp.file}" pattern="MM/dd/yyyy hh:mm:ss aa">
-      <fileset dir="${tomcat.classes}"/>
-      <fileset dir="${tomcat.i18n}"/>
-    </touch>
   </target>
 
   <target name="build-manifests" unless="manifests.uptodate"
@@ -1024,11 +1017,6 @@
       <filterset refid="version.filters"/>
       <fileset dir="${tomcat.home}/res/META-INF" />
     </copy>
-
-    <!-- Reproducible builds: consistent timestamps for files in META-INF -->
-    <touch datetime="${tstamp.file}" pattern="MM/dd/yyyy hh:mm:ss aa">
-      <fileset dir="${tomcat.manifests}"/>
-    </touch>
   </target>
 
   <target name="package" depends="compile,build-manifests" >
@@ -1186,115 +1174,105 @@
       addOSGi="true" />
 
     <!-- i18n JARs -->
-    <!-- zip task used rather than jar to control reproducibility -->
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-cs.jar">
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-cs.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_cs.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-de.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-de.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_de.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-es.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-es.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_es.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-fr.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-fr.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_fr.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-ja.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ja.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ja.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-ko.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ko.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ko.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-pt-BR.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-pt-BR.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_pt_BR.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-ru.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ru.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ru.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-zh-CN.jar">
+    </jar>
+    <jar jarfile="${tomcat.build}/lib/tomcat-i18n-zh-CN.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_zh_CN.properties" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
+    </jar>
 
   </target>
 
@@ -2462,7 +2440,9 @@ Apache Tomcat ${version} native binaries for Win64 
AMD64/EMT64 platform.
     </copy>
 
     <!-- Digester and dependencies -->
-    <zip destfile="${tomcat.deployer}/lib/catalina-deployer.jar">
+    <jar jarfile="${tomcat.deployer}/lib/catalina-deployer.jar"
+         manifest="${tomcat.manifests}/default.manifest"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.classes}">
         <include name="org/apache/catalina/startup/DigesterFactory.class" />
         <include name="org/apache/catalina/util/SchemaResolver.class" />
@@ -2487,14 +2467,11 @@ Apache Tomcat ${version} native binaries for Win64 
AMD64/EMT64 platform.
         <exclude name="**/package.html" />
         <exclude name="**/LocalStrings_*" />
       </fileset>
-      <zipfileset file="${tomcat.manifests}" fullpath="META-INF" />
-      <zipfileset file="${tomcat.manifests}/default.manifest"
-        fullpath="META-INF/MANIFEST.MF" />
       <zipfileset file="${tomcat.manifests}/default.notice"
         fullpath="META-INF/NOTICE" />
       <zipfileset file="${tomcat.manifests}/default.license"
         fullpath="META-INF/LICENSE" />
-    </zip>
+    </jar>
 
     <!-- Main build script -->
     <copy todir="${tomcat.deployer}">
@@ -3809,7 +3786,9 @@ Read the Building page on the Apache Tomcat documentation 
site for details on ho
         <srcfiles file="@{license}" />
       </uptodate>
       <sequential unless:true="${jar.uptodate}">
-        <zip destfile="@{jarfile}" filesonly="true" >
+        <jar jarfile="@{jarfile}"
+             manifest="@{manifest}"
+             modificationtime="${tstamp.file}">
           <fileset dir="@{filesDir}">
             <patternset refid="@{filesId}"/>
             <!-- Javadoc exclusions -->
@@ -3817,10 +3796,9 @@ Read the Building page on the Apache Tomcat 
documentation site for details on ho
           </fileset>
           <zipfileset dir="@{meta-inf}" prefix="META-INF/"
                       excludes=".gitignore" />
-          <zipfileset file="@{manifest}" fullpath="META-INF/MANIFEST.MF" />
           <zipfileset file="@{notice}" fullpath="META-INF/NOTICE" />
           <zipfileset file="@{license}" fullpath="META-INF/LICENSE" />
-        </zip>
+        </jar>
         <antcall target="add-osgi" >
           <param name="jarfile" value="@{jarfile}" />
           <param name="addOSGi" value="@{addOSGi}" />
diff --git a/modules/jdbc-pool/build.xml b/modules/jdbc-pool/build.xml
index 3bc8c3d..21372bc 100644
--- a/modules/jdbc-pool/build.xml
+++ b/modules/jdbc-pool/build.xml
@@ -160,21 +160,11 @@
       <include name="org/apache/tomcat/jdbc/**" />
     </javac>
 
-    <!-- Reproducible builds: consistent timestamps for distributed files -->
-    <touch datetime="${tstamp.file}" pattern="MM/dd/yyyy hh:mm:ss aa">
-      <fileset dir="${tomcat.classes}"/>
-      <fileset dir="${tomcat.pool}/resources"/>
-      <fileset dir="${basedir}/src/main/java">
-        <include name="org/apache/tomcat/jdbc/**/*.xml" />
-      </fileset>
-      <fileset refid="license.notice"/>
-    </touch>
-
     <!-- connection pool JAR File -->
-    <zip destfile="${tomcat-jdbc.jar}" update="true">
-      <zipfileset file="${tomcat.pool}/resources" fullpath="META-INF" />
-      <zipfileset file="${tomcat.pool}/resources/MANIFEST.MF"
-        fullpath="META-INF/MANIFEST.MF" />
+    <jar jarfile="${tomcat-jdbc.jar}"
+         update="true"
+         manifest="${tomcat.pool}/resources/MANIFEST.MF"
+         modificationtime="${tstamp.file}">
       <fileset dir="${tomcat.classes}">
         <include name="org/apache/tomcat/jdbc/**" />
       </fileset>
@@ -182,7 +172,7 @@
         <include name="org/apache/tomcat/jdbc/**/*.xml" />
       </fileset>
       <fileset refid="license.notice"/>
-    </zip>
+    </jar>
   </target>
 
   <target name="build-src">

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to