ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kimpton, C (Chris)" <Chris.Kimp...@rabobank.com>
Subject RE: Resource collections - Linux vs. windows
Date Tue, 11 Feb 2014 16:02:47 GMT
Thanks Matt.

Not sure which bit you mean in the manual - the end of this line confuses me:  "Note that
this attribute is meaningless in the context of any of the various resource collection types
that do include directories, but that no attempt will be made to delete non-empty directories
in any case"

Pathconvert sounds promising - it gives me a property with the directories I want to delete
in.

Will play with that further tomorrow.

Cheers,
Chris


-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@gmail.com] 
Sent: 11 February 2014 15:43
To: Ant Users List
Subject: Re: Resource collections - Linux vs. windows

Yeah, I have a feeling you are running into some problem having to do with non-empty subdirectories.
 Usually some creative sorting, etc., can help.
 The delete task should know how to handle this with filesets; I believe its page in the manual
mentions this very problem. Therefore you might try using the pathconvert task to create a
list of includes for a fileset and pass *that* to the delete task. Keep us updated on your
progress.

Matt


On Tue, Feb 11, 2014 at 9:30 AM, Kimpton, C (Chris) < Chris.Kimpton@rabobank.com> wrote:

> Good idea.
>
> It initially worked ok, when the directories were empty, but when I 
> added files to each (touch steps below), that caused the script to not 
> delete any files.
>
> And now I see that it does not work on Windows either ...  my tests 
> used empty directories.
>
> Does this sound like a bug or am I missing some subtlety around 
> resource collections/dirset and non-empty subdirectories...
>
> Thanks in advance.
>
> Here is my test file:
>
>
> <?xml version="1.0" encoding="UTF-8"?> <project 
> name="resource-collection-delete-sample" default="tryit">
>
>     <property name="test-dir" value="${basedir}/testdata"/>
>
>     <target name="setup-files">
>         <delete dir="${test-dir}"/>
>         <mkdir dir="${test-dir}"/>
>         <mkdir dir="${test-dir}/xxfile1"/>
>         <mkdir dir="${test-dir}/1"/>
>         <touch file="${test-dir}/1/test"/>
>         <sleep milliseconds="100" />
>         <mkdir dir="${test-dir}/2"/>
>         <touch file="${test-dir}/2/test"/>
>         <sleep milliseconds="100" />
>         <mkdir dir="${test-dir}/3"/>
>         <touch file="${test-dir}/3/test"/>
>         <sleep milliseconds="100" />
>         <mkdir dir="${test-dir}/4"/>
>         <touch file="${test-dir}/4/test"/>
>         <sleep milliseconds="100" />
>         <mkdir dir="${test-dir}/5"/>
>         <touch file="${test-dir}/5/test"/>
>         <sleep milliseconds="100" />
>         <mkdir dir="${test-dir}/6"/>
>         <touch file="${test-dir}/6/test"/>
>         <sleep milliseconds="100" />
>         <touch file="${test-dir}/44" />
>         <sleep milliseconds="100" />
>         <!-- create some files -->
>     </target>
>
>     <target name="delete-files">
>         <!-- delete all but last few old release directories -->
>         <resources id="resource-all-dirs">
>             <dirset dir="${test-dir}" >
>                 <filename regex="^\d+$" />
>             </dirset>
>         </resources>
>         <resources id="resource-last-3-dirs">
>             <last count="3">
>                 <sort>
>                     <dirset dir="${test-dir}" >
>                         <filename regex="^\d+$" />
>                     </dirset>
>                     <date />
>                 </sort>
>             </last>
>         </resources>
>         <delete verbose="true">
>             <difference>
>                 <resources refid="resource-all-dirs"/>
>                 <resources refid="resource-last-3-dirs" />
>             </difference>
>         </delete>
>     </target>
>
>     <target name="tryit" depends="setup-files, delete-files">
>     </target>
>
> </project>
>
>
>
>
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@gmail.com]
> Sent: 11 February 2014 14:15
> To: Ant Users List
> Subject: Re: Resource collections - Linux vs. windows
>
> Can you expand your example into a self-contained example that builds 
> up an appropriate structure first, then still fails on Linux?
>
> Matt
>
>
> On Tue, Feb 11, 2014 at 2:21 AM, Kimpton, C (Chris) < 
> Chris.Kimpton@rabobank.com> wrote:
>
> > Hi,
> >
> > I have a target that is trying to delete some directories, all but 
> > the last few.  It works as expected (I believe - it deletes files 
> > when
> > expected) on my dev box (windows), but is not deleting anything on 
> > the build server (Linux):
> >
> > It builds up 2 resource collections - one for all directories and 
> > one for the last few and then does a delete based on the difference.
> >
> >         <resources id="resource-all-dirs">
> >             <dirset dir="${release-base-dir}" >
> >                 <filename regex="^\d+$" />
> >             </dirset>
> >         </resources>
> >
> >         <resources id="resource-last-3-dirs">
> >             <last count="4">
> >                 <sort>
> >                     <dirset dir="${release-base-dir}" >
> >                         <filename regex="^\d+$" />
> >                     </dirset>
> >                     <date />
> >                 </sort>
> >             </last>
> >         </resources>
> >
> >         <delete verbose="true">
> >             <difference>
> >                 <resources refid="resource-all-dirs"/>
> >                 <resources refid="resource-last-3-dirs" />
> >             </difference>
> >         </delete>
> >
> > I have tried running with debug and/or verbose but that does not 
> > seem to add anything.  Using version 1.9.3.
> >
> > Any tips on how to track down the issue?
> >
> > Cheers,
> > Chris
> >
> > _____________________________________________________________
> >
> > This email (including any attachments to it) is confidential, 
> > legally privileged, subject to copyright and is sent for the 
> > personal attention of the intended recipient only. If you have 
> > received this email in error, please advise us immediately and 
> > delete it. You are notified that disclosing, copying, distributing 
> > or taking any action in reliance on the contents of this information 
> > is strictly prohibited. Although we have taken reasonable 
> > precautions to ensure no viruses are present in this email, we 
> > cannot accept responsibility for any loss or damage arising from the 
> > viruses in this email or attachments. We exclude any liability for 
> > the content of this email, or for the consequences of any actions 
> > taken on the basis of the information provided in this email or its 
> > attachments, unless that
> information is subsequently confirmed in writing.
> > _____________________________________________________________
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional 
> commands, e-mail: user-help@ant.apache.org
>
>

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


Mime
View raw message