I don't believe that tar task in Ant can be asked to simply leave file
permissions alone. We have shell scripts that have the execute
permission set, but <tar> keeps resetting them.

You can define multiple tarfilesets, and have each one with a
different permission. Each tarfileset can even be the same directory,
but simply include or exclude particular files based upon suffix or
directory. Here's what we do:

    <tar destfile="${archive.dir}/${tar.name}"
        longfile="gnu"
        compression="gzip">
        <tarfileset dir="${work.dir}/deploy"
            username="${tar.user}"
            group="${tar.group}">
            <include name="**"/>
            <exclude name="bin/**"/>
        </tarfileset>
        <tarfileset dir="${work.dir}/deploy"
            mode="755"
            username="${tar.user}"
            group="${tar.group}">
            <include name="bin/**"/>
        </tarfileset>
    </tar>

The first one excludes the bin directory while the second one includes
the bin directory and sets the execute permission. That's about the
best you can do.  Zipfiles do not contain any file permission
information, so the <zip> task won't work for you either.

Have you looked at the <bzip2> or <gzip> tasks? These are Unix based
commands, and maybe they'll store the file permissions without
changing them.

On Tue, Mar 3, 2009 at 2:14 PM, Shawn Castrianni
<shawn.castria...@halliburton.com> wrote:
> I am trying to zip or tar up some files in a platform independent way but 
> retain file permissions if on unix.  I thought I found the answer when I saw 
> that both zipfileset and tarfileset support the filemode attribute.  However, 
> I quickly discovered that this allows the file permissions to be set to some 
> hardcoded value for all files.  I want whatever the file permissions are on 
> the filesystem to be retained in the zip or tar so I can't hardcode them all 
> to one value.  Each file may be different.  It would seem that a better 
> default for filemode would be "retain" and not "644".  Is it possible to do 
> what I want without resorting to the exec task and just executing tar 
> directly and then hoping that any windows machine has MKS toolkit installed 
> so that tar exists?
>
> ---
> Shawn Castrianni
>
> ----------------------------------------------------------------------
> This e-mail, including any attached files, may contain confidential and 
> privileged information for the sole use of the intended recipient.  Any 
> review, use, distribution, or disclosure by others is strictly prohibited.  
> If you are not the intended recipient (or authorized to receive information 
> for the intended recipient), please contact the sender by reply e-mail and 
> delete all copies of this message.
>



-- 
--
David Weintraub
qazw...@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to