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

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


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

commit 017f2fa045d851591569c489de45f19cbbb658a5
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
    # Conflicts:
    #   build.xml
---
 build.xml                   | 92 ++++++++++++++++++---------------------------
 modules/jdbc-pool/build.xml | 20 +++-------
 2 files changed, 41 insertions(+), 71 deletions(-)

diff --git a/build.xml b/build.xml
index 9c23c75..0f8a7af 100644
--- a/build.xml
+++ b/build.xml
@@ -732,13 +732,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"
@@ -759,11 +752,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" >
@@ -895,91 +883,83 @@
       filesId="files.tomcat-dbcp" />
 
     <!-- i18n JARs -->
-    <!-- zip task used rather than jar to control reproducibility -->
-    <zip destfile="${tomcat.build}/lib/tomcat-i18n-de.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-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>
 
@@ -2111,7 +2091,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" />
@@ -2136,14 +2118,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}">
@@ -3391,7 +3370,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 -->
@@ -3399,10 +3380,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>
       </sequential>
     </sequential>
   </macrodef>
diff --git a/modules/jdbc-pool/build.xml b/modules/jdbc-pool/build.xml
index c9a2444..3394e18 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