Re: Reliably deleting empty directories and creating symlinks
Bridger Dyson-Smith <[email protected]> Tue, 5 Aug 2025 23:51:15 -0400
| Newsgroups | gmane.comp.jakarta.ant.user |
|---|---|
| Message-ID | <CAD-FYmRC60J+-qOY=z8hAmdPRu5kzUaKg9f5djmHyeODaaPiuA@mail.gmail.com> |
--0000000000004ff9e6063baa413c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Tue, Aug 5, 2025, 11:32=E2=80=AFPM Bridger Dyson-Smith <bdysonsmith@gmai=
l.com>
wrote:
> Hi all -
>
> I'm trying to use Ant to help automate a software install/update process:
> a ZIP download and unpack, remove empty directories, create symlinks in
> their place, and then apply some simple regex/replace tasks. I have the
> process worked out on a FreeBSD machine, but as soon as I move the
> build.xml to a Linux system, things fail when I try to create the symlink=
s.
>
> I've been working with the assumption that I may be either updating an
> existing install (ie I have symlinks) or I am installing fresh (ie I have
> empty directories), so the tasks are... uh, probably unnecessarily verbos=
e
> (suggestions for improvements welcome). The error on linux comes in when
> the `symlink` task is called: I get the following BUILD FAILED error:
> 'Deletion of file at /home/bridger/bin/basex/data failed, while trying to
> overwrite it with a symlink.'
>
> Any suggestions about what to do to fix this and make it more robust?
> Thanks in advance for your time and help.
> Best,
> Bridger
>
>
> <target name=3D"rm-dirs">
> <if>
> <available file=3D"${basex-home}/data" type=3D"dir"/>
> <then>
> <echo>*** ${basex-home}/data symlink available ***</echo>
> <delete removenotfollowedsymlinks=3D"true" failonerror=3D"false">
> <fileset followsymlinks=3D"false" dir=3D"${basex-home}/data"/>
> </delete>
> </then>
> </if>
> <if>
> <available file=3D"${basex-home}/repo" type=3D"dir"/>
> <then>
> <echo>*** ${basex-home}/repo symlink available ***</echo>
> <delete removenotfollowedsymlinks=3D"true" failonerror=3D"false">
> <fileset followsymlinks=3D"false" dir=3D"${basex-home}/repo"/>
> </delete>
> </then>
> </if>
> <if>
> <available file=3D"${basex-home}/src" type=3D"dir"/>
> <then>
> <echo>*** ${basex-home}/repo symlink available ***</echo>
> <delete removenotfollowedsymlinks=3D"true" failonerror=3D"false">
> <fileset followsymlinks=3D"false" dir=3D"${basex-home}/src "/>
> </delete>
> </then>
> </if>
> <if>
> <available file=3D"${basex-home}/data" type=3D"dir"/>
> <then>
> <delete failonerror=3D"false"><fileset dir=3D"${basex-home}/data"/>=
</delete>
> </then>
> </if>
> <if>
> <available file=3D"${basex-home}/repo" type=3D"dir"/>
> <then>
> <delete failonerror=3D"false"><fileset dir=3D"${basex-home}/repo"/>=
</delete>
> </then>
> </if>
> <if>
> <available file=3D"${basex-home}/src" type=3D"dir"/>
> <then>
> <delete failonerror=3D"false"><fileset dir=3D"${basex-home}/src"/><=
/delete>
> </then>
> </if>
> </target>
>
> <target name=3D"symlink-dirs" depends=3D"rm-dirs">
> <echo>*** creating symlinks for `data`, `repo`, and `src` directories *=
**</echo>
> <symlink overwrite=3D"true" link=3D"${basex-home}/data" resource=3D"${b=
in}/basex-data"/>
> <symlink overwrite=3D"true" link=3D"${basex-home}/repo" resource=3D"${b=
in}/basex-repo"/>
> <symlink overwrite=3D"true" link=3D"${basex-home}/src" resource=3D"${bi=
n}/basex-src"/>
> </target>
>
> Apologies, forgot to mention that I have the antcontribs installed (from
source forge).
Best,
Bridger
>
--0000000000004ff9e6063baa413c--