ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject ant git commit: <zip> up-to-date check doesn't work properly on NTFS
Date Thu, 19 May 2016 04:39:49 GMT
Repository: ant
Updated Branches:
  refs/heads/1.9.x 5c24a75a7 -> 0edf3ca25


<zip> up-to-date check doesn't work properly on NTFS

https://bz.apache.org/bugzilla/show_bug.cgi?id=59562

Patch by Gilles QUERRET


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0edf3ca2
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0edf3ca2
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0edf3ca2

Branch: refs/heads/1.9.x
Commit: 0edf3ca2524323395d9de340dc1927cb5f3ee267
Parents: 5c24a75
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Thu May 19 06:31:42 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Thu May 19 06:31:42 2016 +0200

----------------------------------------------------------------------
 CONTRIBUTORS                                     |  1 +
 WHATSNEW                                         |  4 ++++
 contributors.xml                                 |  4 ++++
 src/etc/testcases/taskdefs/zip.xml               | 19 +++++++++++++++++++
 src/main/org/apache/tools/ant/taskdefs/Zip.java  |  9 +++++++--
 .../org/apache/tools/ant/taskdefs/ZipTest.java   |  8 ++++++++
 6 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 74d6c63..8e47e05 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -136,6 +136,7 @@ Georges-Etienne Legendre
 Gero Vermaas
 Gerrit Riessen
 Gilbert Rebhan
+Gilles Querret
 Gilles Scokart
 Glenn McAllister
 Glenn Twiggs

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 68338fc..e01128c 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -15,6 +15,10 @@ Fixed bugs:
  * <get>'s quiet attribute was broken, it didn't suppress any messages.
    Bugzilla Report 59379
 
+ * <zip>'s check whether an archive is already up-to-date failed on
+   NTFS filesystems and re-created archives more often than necessary.
+   Bugzilla Report 59562
+
 Other changes:
 --------------
 

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/contributors.xml
----------------------------------------------------------------------
diff --git a/contributors.xml b/contributors.xml
index 85066b7..2bfa1b0 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -570,6 +570,10 @@
   </name>
   <name>
     <first>Gilles</first>
+    <last>Querret</last>
+  </name>
+  <name>
+    <first>Gilles</first>
     <last>Scokart</last>
   </name>
   <name>

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/etc/testcases/taskdefs/zip.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/zip.xml b/src/etc/testcases/taskdefs/zip.xml
index 4fa6de6..61a54a3 100644
--- a/src/etc/testcases/taskdefs/zip.xml
+++ b/src/etc/testcases/taskdefs/zip.xml
@@ -283,5 +283,24 @@
     <zip destFile="${output}/test3.zip" basedir="${output}/ziptest" update="true"/>
   </target>
 
+  <target name="testRegexpMapper1">
+    <mkdir dir="${output}/regexp.src"/>
+    <touch file="${output}/regexp.src/file1"/>
+    <zip destFile="${output}/regexp.zip">
+      <mappedresources>
+       <fileset dir="${output}/regexp.src" includes="file1" />
+       <regexpmapper from="^(([a-z][a-z]).*)" to="\2/\1.r" />
+      </mappedresources>
+    </zip>
+  </target>
+  <target name="testRegexpMapper2">
+    <sleep seconds="3" />
+    <zip destFile="${output}/regexp.zip">
+      <mappedresources>
+       <fileset dir="${output}/regexp.src" includes="file1" />
+       <regexpmapper from="^(([a-z][a-z]).*)" to="\2/\1.r" />
+      </mappedresources>
+    </zip>
+  </target>
 
 </project>

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/main/org/apache/tools/ant/taskdefs/Zip.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java
index ddc9bd4..91e28b9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Zip.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java
@@ -78,7 +78,11 @@ import org.apache.tools.zip.ZipOutputStream.UnicodeExtraFieldPolicy;
  */
 public class Zip extends MatchingTask {
     private static final int BUFFER_SIZE = 8 * 1024;
-    private static final int ROUNDUP_MILLIS = 1999; // 2 seconds - 1
+    /**
+     * The granularity of timestamps inside a ZIP archive.
+     */
+    private static final int ZIP_FILE_TIMESTAMP_GRANULARITY = 2000;
+    private static final int ROUNDUP_MILLIS = ZIP_FILE_TIMESTAMP_GRANULARITY - 1;
     // CheckStyle:VisibilityModifier OFF - bc
 
     protected File zipFile;
@@ -1548,7 +1552,8 @@ public class Zip extends MatchingTask {
         final Resource[] rs = selectFileResources(initial);
         Resource[] result =
             ResourceUtils.selectOutOfDateSources(this, rs, mapper,
-                                                 getZipScanner());
+                                                 getZipScanner(),
+                                                 ZIP_FILE_TIMESTAMP_GRANULARITY);
         if (!doFilesonly) {
             final Union u = new Union();
             u.addAll(Arrays.asList(selectDirectoryResources(initial)));

http://git-wip-us.apache.org/repos/asf/ant/blob/0edf3ca2/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
index 5a7a359..efa9f77 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -297,4 +297,12 @@ public class ZipTest {
         }
     }
 
+    @Test
+    public void testRegexpMapper() throws IOException {
+        buildRule.executeTarget("testRegexpMapper1");
+        File testFile = new File(buildRule.getOutputDir(), "regexp.zip");
+        long l = testFile.lastModified();
+        buildRule.executeTarget("testRegexpMapper2");
+        assertEquals(l, testFile.lastModified());
+    }
 }


Mime
View raw message