Bug 39617 - The <tar> task should have an append attribute
Summary: The <tar> task should have an append attribute
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Compress Antlib (show other bugs)
Version: unspecified
Hardware: Other other
: P2 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-19 16:04 UTC by Pascal Rapicault
Modified: 2010-10-26 06:22 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault 2006-05-19 16:04:53 UTC
I have a script that create a tar file using the ant tar task, then another
script appends to the tar file but nothing gets appended to the file and I get a
message saying "nothing to do <archiveName> is up to date".

Here is an example of a script that exhibit the problem.
<project default="name">
    <target name="name" description="--> description">
    	<tar destfile="d:/tmp/testOutputFormat/f.tar" >
    	  <tarfileset file="d:/tmp/productBuild.zip"
fullpath="foo/productBuild.zip" /> 
   	  </tar>
    	<tar destfile="d:/tmp/testOutputFormat/f.tar" >
    	  <tarfileset file="d:/tmp/test.psf" fullpath="foo/test.psf" /> 
   	  </tar>
    </target>

</project>
Comment 1 J.M. (Martijn) Kruithof 2006-06-07 18:23:40 UTC
Please note the tar task creates a tar file, it does not append to an existing
tar file. The existing tar file is replaced instead.
As with all archive tasks in ant, the destination archive is not updated if it
is known to be newer than all the resources to be included in the archive.

probably the following is what you try to achieve:

<project default="name">
    <target name="name" description="--> description">
    	<tar destfile="d:/tmp/testOutputFormat/f.tar" >
    	  <tarfileset file="d:/tmp/productBuild.zip"
fullpath="foo/productBuild.zip" /> 
    	  <tarfileset file="d:/tmp/test.psf" fullpath="foo/test.psf" /> 
   	  </tar>
    </target>

</project>

If you really want to produce two diffent tar files with the same name, you will
 have to remove or rename the first tar file before trying to create the second one.
Comment 2 Pascal Rapicault 2006-06-07 18:44:55 UTC
It seems to me that your 1st and 3rd sentences are contradicting each others. If
the 3rd one is true, then the tar task has a bug since it does not comply to the
behaviour described, which is the point of my bug. If the first one is true,
then your third sentence is a lie :)

I think that if you are striving for consistency, then I should be able to
append to a Tar like I can do it to a zip with the zip task. This could be done
by adding an "append" parameter to the task. 

As for the workaround, it does not work in my case since the appendage to the
zip file is done in a separate build script.
Comment 3 Peter Reilly 2006-12-10 15:09:57 UTC
Added clarifiation to tar manual page,
changing this to an enchancement request.
Comment 4 Stefan Bodewig 2010-10-26 06:22:19 UTC
Setting mode="update" in the compress antlib's tar task should do what is requested.