Monday, March 11, 2013

cygwin and tar

It was really hard battle. I have ant script with some ivy deps. deps in tar format and I use full path to untar it.

But on Win full path contains : ohh crap!!!!

part of a script

<echo level="info">extract to @{unpack-dir}/${var.package.path} from @{file}</echo>
       <if>
        <matches pattern=".*(\.tgz|\.bz2|\.tar)$" string="@{file}"/>
        <then>
         <exec executable="tar" taskname="extract" failonerror="true">
          <arg line="xf" />
          <arg line="@{file}" />
          <arg line="-C @{unpack-dir}/${var.package.path}" />
         </exec> 
        </then>

and looks on the error

     [echo] extract to KPVC/3rdparty/android-ndk from C:/work/svn/kpvc-index-trunk/KPVC/3rdparty/android-ndk/android-ndk-r8b-linux-x86.tar.
  [extract] tar: Cannot execute remote shell: No such file or directory
  [extract] tar: C\:/work/svn/kpvc-index-trunk/KPVC/3rdparty/android-ndk/android-ndk-r8b-linux-x86.tar.bz2: Cannot open: Input/output error
  [extract] tar: Error is not recoverable: exiting now

look on echo it looks fine, but extract has C\:/work. Of course it doesn't work... After some investigation I found that this is not ant problem.... tar just doesn't understand colon (:) WTF. I spent much time to found it. So solution just add as a last argument of tar

          <arg line="--force-local" />

No comments:

Post a Comment