ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38918] New: - Add 'real' overwrite support to Zip-based tasks
Date Fri, 10 Mar 2006 10:47:11 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38918>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38918

           Summary: Add 'real' overwrite support to Zip-based tasks
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: hmacias@ubiquitysoftware.com


When dealing with duplicated zipentries, Zip checks modification times before
overwriting the zipentry. If you specify duplicate="add", zipentries will be
overwriten only if the present zipentry is older than the one you're trying to add.

In some situations it would be nice to override this behaviour and force zip to
overwrite zipentries even if the file you're adding is older than the zipentry
in the zip file.

The following patch should do the trick (please shout if there is a better way
of submitting patch suggestions):

Index: src/main/org/apache/tools/ant/taskdefs/Zip.java

===================================================================

--- src/main/org/apache/tools/ant/taskdefs/Zip.java	(revision 384498)

+++ src/main/org/apache/tools/ant/taskdefs/Zip.java	(working copy)

@@ -1130,11 +1130,15 @@

                 resources = selectFileResources(resources);
             }
 
-            newerResources[i] =
-                ResourceUtils.selectOutOfDateSources(this,
+            if(duplicate.equals("overwrite")){
+                newerResources[i] = resources;
+            } else {
+                newerResources[i] =
+                    ResourceUtils.selectOutOfDateSources(this,
                                                      resources,
                                                      myMapper,
                                                      getZipScanner());
+            }
             needsUpdate = needsUpdate || (newerResources[i].length > 0);
 
             if (needsUpdate && !doUpdate) {
@@ -1647,7 +1651,7 @@

          * @see EnumeratedAttribute#getValues()
          */
         public String[] getValues() {
-            return new String[] {"add", "preserve", "fail"};
+            return new String[] {"add", "preserve", "fail", "overwrite"};
         }
     }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message