Browse Source

tar doesn't always recognize the target isn't up to date. PR 48035

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@828141 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
98f78e19bd
3 changed files with 29 additions and 2 deletions
  1. +5
    -0
      WHATSNEW
  2. +6
    -2
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  3. +18
    -0
      src/tests/antunit/taskdefs/tar-test.xml

+ 5
- 0
WHATSNEW View File

@@ -507,6 +507,11 @@ Fixed bugs:
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:
--------------



+ 6
- 2
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -581,9 +581,13 @@ public class Tar extends MatchingTask {
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()) {


+ 18
- 0
src/tests/antunit/taskdefs/tar-test.xml View File

@@ -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>

Loading…
Cancel
Save