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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
     new 966090094c Ensure zip files use UTC times. By default zip uses local 
time.
966090094c is described below

commit 966090094cc5fb43d2aec66704239775e031530a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Aug 11 15:57:29 2022 +0100

    Ensure zip files use UTC times. By default zip uses local time.
---
 build.xml                                          | 45 ++++++++++++----------
 .../apache/tomcat/buildutil/ForceUtcTimeZone.java  | 30 +++++++++++++++
 webapps/docs/changelog.xml                         |  8 ++++
 3 files changed, 63 insertions(+), 20 deletions(-)

diff --git a/build.xml b/build.xml
index 15dd8b1714..f4e80409c0 100644
--- a/build.xml
+++ b/build.xml
@@ -249,7 +249,7 @@
     <format property="today" pattern="MMM d yyyy" locale="en" timezone="UTC"/>
     <format property="today-iso-8601" pattern="yyyy-MM-dd" locale="en" 
timezone="UTC"/>
     <format property="tstamp" pattern="HH:mm:ss" locale="en" timezone="UTC"/>
-    <format property="tstamp.file" pattern="yyyy-MM-dd HH:mm:ss"/>
+    <format property="tstamp.file" pattern="yyyy-MM-dd HH:mm:ss" 
timezone="UTC"/>
     <format property="tstamp.iso.release" pattern="yyyy-MM-dd'T'HH:mm:ssX" 
timezone="UTC"/>
   </tstamp>
   <filterset id="version.filters">
@@ -1183,7 +1183,7 @@
     <!-- i18n JARs -->
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-cs.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_cs.properties" />
       </fileset>
@@ -1194,7 +1194,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-de.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_de.properties" />
       </fileset>
@@ -1205,7 +1205,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-es.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_es.properties" />
       </fileset>
@@ -1216,7 +1216,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-fr.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_fr.properties" />
       </fileset>
@@ -1227,7 +1227,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ja.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ja.properties" />
       </fileset>
@@ -1238,7 +1238,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ko.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ko.properties" />
       </fileset>
@@ -1249,7 +1249,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-pt-BR.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_pt_BR.properties" />
       </fileset>
@@ -1260,7 +1260,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-ru.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_ru.properties" />
       </fileset>
@@ -1271,7 +1271,7 @@
     </jar>
     <jar jarfile="${tomcat.build}/lib/tomcat-i18n-zh-CN.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.i18n}">
         <include name="**/LocalStrings_zh_CN.properties" />
       </fileset>
@@ -1781,7 +1781,7 @@
     </fixcrlf>
 
     <zip destfile="${tomcat.embed}/${final.name}-embed.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <fileset dir="${tomcat.embed}">
         <include name="**" />
@@ -2347,7 +2347,7 @@ Apache Tomcat ${version} native binaries for Win64 
AMD64/EMT64 platform.
     <!-- Digester and dependencies -->
     <jar jarfile="${tomcat.deployer}/lib/catalina-deployer.jar"
          manifest="${tomcat.manifests}/default.manifest"
-         modificationtime="${tstamp.file}">
+         modificationtime="${tstamp.iso.release}">
       <fileset dir="${tomcat.classes}">
         <include name="org/apache/catalina/startup/DigesterFactory.class" />
         <include name="org/apache/catalina/util/SchemaResolver.class" />
@@ -2721,7 +2721,12 @@ asf.ldap.username=${release.asfusername}
   </target>
 
   <!-- Sets properties only required for releases -->
-  <target name="release-init" depends="gpg-init-1,gpg-init-2" />
+  <target name="release-init" depends="gpg-init-1,gpg-init-2,compile" >
+    <taskdef name="forceUtcTimeZone"
+             classname="org.apache.tomcat.buildutil.ForceUtcTimeZone"
+             classpath="${tomcat.classes}" />
+    <forceUtcTimeZone />
+  </target>
 
   <target name="gpg-init-1">
     <available file="${gpg.exec}" property="gpg.exec.available"/>
@@ -2741,7 +2746,7 @@ asf.ldap.username=${release.asfusername}
     </fixcrlf>
 
     <zip zipfile="${tomcat.release}/v${version}/bin/${final.name}.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset file="${tomcat.dist}" fullpath="${final.name}"/>
       <zipfileset dir="${tomcat.dist}" prefix="${final.name}">
@@ -2778,7 +2783,7 @@ asf.ldap.username=${release.asfusername}
 
     <!-- Windows x86 package -->
     <zip 
zipfile="${tomcat.release}/v${version}/bin/${final.name}-windows-x86.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset file="${tomcat.dist}" fullpath="${final.name}"/>
       <zipfileset dir="${tomcat.dist}" prefix="${final.name}">
@@ -2806,7 +2811,7 @@ asf.ldap.username=${release.asfusername}
 
     <!-- Windows x64 package -->
     <zip 
zipfile="${tomcat.release}/v${version}/bin/${final.name}-windows-x64.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset file="${tomcat.dist}" fullpath="${final.name}"/>
       <zipfileset dir="${tomcat.dist}" prefix="${final.name}">
@@ -2850,7 +2855,7 @@ asf.ldap.username=${release.asfusername}
     </fixcrlf>
 
     <zip zipfile="${tomcat.release}/v${version}/bin/${final.name}-deployer.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset file="${tomcat.deployer}" fullpath="${final.name}-deployer"/>
       <zipfileset dir="${tomcat.deployer}" prefix="${final.name}-deployer" 
includes="**" />
@@ -3002,7 +3007,7 @@ asf.ldap.username=${release.asfusername}
     </fixcrlf>
 
     <zip zipfile="${tomcat.release}/v${version}/src/${final-src.name}.zip"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset file="${tomcat.dist}/src" fullpath="${final-src.name}" />
       <zipfileset dir="${tomcat.dist}/src" prefix="${final-src.name}" />
@@ -3872,7 +3877,7 @@ Read the Building page on the Apache Tomcat documentation 
site for details on ho
       <sequential unless:true="${jar.uptodate}">
         <jar jarfile="@{jarfile}"
              manifest="@{manifest}"
-             modificationtime="${tstamp.file}">
+             modificationtime="${tstamp.iso.release}">
           <fileset dir="@{filesDir}">
             <patternset refid="@{filesId}"/>
             <!-- Javadoc exclusions -->
@@ -3928,7 +3933,7 @@ Read the Building page on the Apache Tomcat documentation 
site for details on ho
     <fixcrlf srcdir="${tomcat.graal}/${graalPrefix}" eol="lf"
         encoding="ISO-8859-1" fixlast="false" />
     <zip destfile="${jarfile}" update="true" filesonly="true"
-         modificationtime="${tstamp.file}"
+         modificationtime="${tstamp.iso.release}"
          encoding="UTF8">
       <zipfileset dir="${tomcat.graal}/${graalPrefix}" 
prefix="META-INF/native-image/${graalPrefix}" includes="*.*"/>
     </zip>
diff --git a/java/org/apache/tomcat/buildutil/ForceUtcTimeZone.java 
b/java/org/apache/tomcat/buildutil/ForceUtcTimeZone.java
new file mode 100644
index 0000000000..d4e4529798
--- /dev/null
+++ b/java/org/apache/tomcat/buildutil/ForceUtcTimeZone.java
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tomcat.buildutil;
+
+import java.util.TimeZone;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+public class ForceUtcTimeZone extends Task {
+
+    @Override
+    public void execute() throws BuildException {
+        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+    }
+}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 444c8b1de4..c1726e38d0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Other">
+    <changelog>
+      <fix>
+        Ensure that zip archives use UTC for file modification times to ensure
+        repeatable builds across time zones. (markt)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 10.0.23 (markt)" rtext="2022-07-27">
   <subsection name="Catalina">


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

Reply via email to