You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Markus Albrecht <ma...@v-connect.com> on 2000/11/30 09:07:35 UTC
How to add/update files in a tar file?
Hello Ant Users!
I've a project setup where I collect files from two different locations
for a release build.
Currently I'm using a jar file a release file.
And in the build.xml file for the ant I just included two fileset
elements and this works pretty well:
<jar jarfile="release.jar">
<fileset dir="${home1}">
<patternset>
...
</patternset>
</fileset>
<fileset dir="${home2}">
<patternset>
...
</patternset>
</fileset>
</jar>
Although I'd like to switch to a tar file, since it preservers access
rights for unix systems.
How can I build a tar file to which to include two filesets as in the
jar case.
Or, optionally set up two tar commands where the second command
adds/updates the existing tar file.
How can I add/update to an existing tar file more files?
Can anyone help me on this?
Thanks,
Markus Albrecht
--
Fortune of the day:
"The identical is equal to itself, since it is different."
-- Franco Spisani
Re: How to add/update files in a tar file?
Posted by Stefan Bodewig <bo...@apache.org>.
Markus Albrecht <ma...@v-connect.com> wrote:
> Although I'd like to switch to a tar file, since it preservers
> access rights for unix systems.
The <tar> task doesn't, you will have to switch to <exec>, <execon> or
(if using development versions) <transform> and use the tar executable
for that.
This would something like
<execon executable="tar" parallel="true">
<arg value="-u" />
<arg value="-f" />
<arg file="release.tar" />
<fileset dir="${home1}">
<patternset ... />
</fileset>
<fileset dir="${home2}">
<patternset ... />
</fileset>
</execon>
or using undocumentated and not really stable (in terms of API) stuff
that has been added after the 1.2 release:
<transform executable="tar" parallel="true" dest=".">
<arg value="-u" />
<arg value="-f" />
<arg file="release.tar" />
<fileset dir="${home1}">
<patternset ... />
</fileset>
<fileset dir="${home2}">
<patternset ... />
</fileset>
<mapper type="merge" to="release.tar" />
</transform>
the latter will only pass the files that are actually newer that the
archive on the command line.
> How can I add/update to an existing tar file more files?
You can't using <tar>, again, you'll need to use the command line.
Stefan