ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r828141 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Tar.java src/tests/antunit/taskdefs/tar-test.xml
Date Wed, 21 Oct 2009 18:50:28 GMT
Author: bodewig
Date: Wed Oct 21 18:50:28 2009
New Revision: 828141

URL: http://svn.apache.org/viewvc?rev=828141&view=rev
Log:
tar doesn't always recognize the target isn't up to date.  PR 48035

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
    ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=828141&r1=828140&r2=828141&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Oct 21 18:50:28 2009
@@ -507,6 +507,11 @@
    long file names in GNU longfile mode.
    Bugzilla Report 47653.
 
+ * The tar task failed to recognize that the archive had to be
+   (re-)created in some cases where the sources are filesystem based
+   resources but not filesets.
+   Bugzilla Report 48035. 
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java?rev=828141&r1=828140&r2=828141&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java Wed Oct 21 18:50:28 2009
@@ -581,9 +581,13 @@
                 Vector files = (Vector) basedirToFilesMap.get(base);
                 if (files == null) {
                     files = new Vector();
-                    basedirToFilesMap.put(base, new Vector());
+                    basedirToFilesMap.put(base, files);
+                }
+                if (base == Copy.NULL_FILE_PLACEHOLDER) {
+                    files.add(r.getFile().getAbsolutePath());
+                } else {
+                    files.add(r.getName());
                 }
-                files.add(r.getName());
             }
             iter = basedirs.iterator();
             while (iter.hasNext()) {

Modified: ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml?rev=828141&r1=828140&r2=828141&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/tar-test.xml Wed Oct 21 18:50:28 2009
@@ -22,6 +22,7 @@
   <import file="../antunit-base.xml" />
 
   <target name="setUp">
+    <mkdir dir="${input}" />
     <mkdir dir="${output}" />
   </target>
 
@@ -72,4 +73,21 @@
       </cond:resourceexists>
     </au:assertFalse>
   </target>
+
+  <target name="testSingleFile" depends="setUp"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48035">
+    <touch file="${input}/foo.txt"/>
+    <tar destfile="${output}/foo.tar">
+      <file file="${input}/foo.txt"/>
+    </tar>
+    <au:assertFileExists file="${output}/foo.tar"/>
+    <copy file="${output}/foo.tar" tofile="${output}/bar.tar"
+          preservelastmodified="true"/>
+    <sleep seconds="2"/>
+    <touch file="${input}/foo.txt"/>
+    <tar destfile="${output}/foo.tar">
+      <file file="${input}/foo.txt"/>
+    </tar>
+    <au:assertDestIsOutofdate src="${output}/foo.tar" dest="${output}/bar.tar"/>
+  </target>
 </project>



Mime
View raw message