You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by La...@oecd.org on 2016/04/26 11:25:58 UTC

Multiple fileset and filelist comparisons

Hi all,

How would you  do to implement this with ANT ?

1- In a project A, there are 2 file trees with same directories and files but not at same revision
DirLocal
--subdir1
-----file1 (version 1.2)
-----file2 (version 2.3)
--subdir2
-----file3 (version 3.0)

DirRemote
--subdir1
-----file1 (version 1.2)
-----file2 (version 2.1)
--subdir2
-----file3 (version 3.0)

I need to compare those 2 file trees to get desynchronized files from 'DirRemote' (in order to synchronize them with the latest revision further).
I can do this easily with 'different' selector on 'targetdir' DirRemote :
<fileset dir="${DirLocal}" includes="**/*.xml" id="desynchronizedMetadata">
    <different targetdir="${DirRemote}" ignoreFileTimes="true"/>
</fileset>

But this list of desynchronised files will be used by another project B, that's why I convert the fileset 'desynchronizedMetadata into a fileList using a pathconvert and echo file :
<pathconvert pathsep="${line.separator}" property="desynch.files" refid="desynchronizedMetadata">
    <regexpmapper from="^${DirLocal}/(.*)$" to="&lt;file name=&quot;\1&quot;/>" handledirsep="true"/>
</pathconvert>
 <echo file="desynchronizedMetadata.xml">&lt;project name=&quot;DesynchronizedMetadata&quot;>${line.separator}&lt;filelist id=&quot;desynch.files&quot; dir=&quot;${DirLocal}&quot;>
 ${desynch.files}
 &lt;/filelist>${line.separator}&lt;/project></echo>


2- In the project B, I import this fileList and I need to clean it against another files tree DirMostUpToDate (same directories and files), but in another way.
If a file is present both in fileList and in the file tree then this file will be removed from the fileList. Here the test to know if the file is present on the 2 sides is based on the relative path, not on the content (relative path : subdir1/file1)
To do this comparison (without success) I tried to:
- option 1: compare 2 resources : one from the fileList and the other from the fileset 'DirMostUpToDate' and then to use 'intersect' :

<import file="${projectA}/desynchronizedMetadata.xml" optional="true"/>
<resources id="A" >
    <filelist refid="desynch.files"/>
</resources>
  
<fileset dir="${DirMostUpToDate }" includes="**/*xml" id="metadata">
<resources id="B">
    <fileset refid="metadata"/>
</resources>
<intersect id="intersect"><resources refid="A"/><resources refid="B"/></intersect>
But actually it doesn't work, it returns nothing (if I do the same with using 'difference', it returns list of all files like 'union')

- option 2: then I tried to convert the fileList into a fileset to be able to use the fileset comparison like in project A but it looks like very crappy ! I converted the fileList into a comma delimited list of files property and then create a fileset using this property in 'includes' attribute but this list could be quiet huge so I'm not sure this is the efficient way to do this.

- option 3: I could loop on the fileList and check the availability of the current file in dir DirMostUpToDate but again it seems to be inefficient in case of huge fileList

All suggestions are welcome !
Many thanks
Lancelot
P.S : one thing could not be debated: the 2 projects A et B are completely separated. Project B cannot compare DirLocal and DirRemote and must use a fileList (or something else ?) present in the file system.






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


Re: Apache Tomcat 9

Posted by Matt Sicker <bo...@gmail.com>.
Here's the info about asking tomcat questions:
http://tomcat.apache.org/lists.html
http://stackoverflow.com/questions/tagged/tomcat

On 2 May 2016 at 16:14, Frederick Piña <pi...@me.com> wrote:

> Hmm... I'm not sure. I just had a quick Apache Tomcat 9 question in
> regards to Java EE 7.
>
>
>
> On 5/2/16 5:13 PM, Matt Sicker wrote:
>
>> This is the Ant mailing list. Did you mean to post to the Tomcat mailing
>> list?
>>
>> On 2 May 2016 at 16:04, Frederick Piña <pi...@me.com> wrote:
>>
>> Hi ! Can I ask you a question ?
>>>
>>>
>>>
>>>
>>
>


-- 
Matt Sicker <bo...@gmail.com>

Re: Apache Tomcat 9

Posted by Frederick Piña <pi...@me.com>.
Hmm... I'm not sure. I just had a quick Apache Tomcat 9 question in 
regards to Java EE 7.


On 5/2/16 5:13 PM, Matt Sicker wrote:
> This is the Ant mailing list. Did you mean to post to the Tomcat mailing
> list?
>
> On 2 May 2016 at 16:04, Frederick Pi�a <pi...@me.com> wrote:
>
>> Hi ! Can I ask you a question ?
>>
>>
>>
>


Re: Apache Tomcat 9

Posted by Matt Sicker <bo...@gmail.com>.
This is the Ant mailing list. Did you mean to post to the Tomcat mailing
list?

On 2 May 2016 at 16:04, Frederick Piña <pi...@me.com> wrote:

> Hi ! Can I ask you a question ?
>
>
>


-- 
Matt Sicker <bo...@gmail.com>

Apache Tomcat 9

Posted by Frederick Piña <pi...@me.com>.
Hi ! Can I ask you a question ?



RE: Multiple fileset and filelist comparisons

Posted by La...@oecd.org.
-----Original Message-----
From: Matèrne, Jan (RZF, Aufg 481) [mailto:jan.materne@fv.nrw.de] 
Sent: mardi 26 avril 2016 14:10
To: Ant Users List
Subject: AW: Multiple fileset and filelist comparisons

>If you just "upload" files, you could use the <modified> selector for getting changed files (by content).
>
>Jan

No I can't, I have many constraints of which I need to control how many files I upload to synchronize local and remote repos.
I can't do it in a single shot,  I need rather to upload one small batch each day until the complete synchronization is achieved.

What I need is to find a way to provide a kind of fileset (here it's a fileList, but it could be something else ?) from project A to project B and then to compare it with another fileset here. 

AW: Multiple fileset and filelist comparisons

Posted by Matèrne, "Jan (RZF, Aufg 481)" <ja...@fv.nrw.de>.
If you just "upload" files, you could use the <modified> selector for getting changed files (by content).

Jan


-----Ursprüngliche Nachricht-----
Von: Lancelot.MEURILLON@oecd.org [mailto:Lancelot.MEURILLON@oecd.org] 
Gesendet: Dienstag, 26. April 2016 13:53
An: user@ant.apache.org
Betreff: RE: Multiple fileset and filelist comparisons

-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: mardi 26 avril 2016 13:11
To: Ant Users List
Subject: Re: Multiple fileset and filelist comparisons

> Then maybe
> http://stackoverflow.com/questions/5940918/how-to-use-ants-sync-task-but-based-on-file-contents
> is closer to what you need. --DD
Except they have 2 filesets, on my side for the 2nd comparison I have a fileList and a fileset and I could achieve to convert my fileList into a fileset to get the comparison feature (using 'present'). This is the problem.

> PS: http://ant-contrib.sourceforge.net/tasks/tasks/outofdate.html might also be of interest. Unlike <sync>, can get computed filesets/paths/etc...
> Fear not, <outofdate> is of high-quality, like Ant, from an Ant commiter (Peter Reilly)
I'll have a look on this contrib, it could do the job

Thanks Dominique


B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[
�\�\�][��X��ܚX�P[�
�\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[
�\�\�Z[[�
�\X�K�ܙ�B

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

RE: Multiple fileset and filelist comparisons

Posted by La...@oecd.org.
-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: mardi 26 avril 2016 13:11
To: Ant Users List
Subject: Re: Multiple fileset and filelist comparisons

> Then maybe
> http://stackoverflow.com/questions/5940918/how-to-use-ants-sync-task-but-based-on-file-contents
> is closer to what you need. --DD
Except they have 2 filesets, on my side for the 2nd comparison I have a fileList and a fileset and I could achieve to convert my fileList into a fileset to get the comparison feature (using 'present'). This is the problem.

> PS: http://ant-contrib.sourceforge.net/tasks/tasks/outofdate.html might also be of interest. Unlike <sync>, can get computed filesets/paths/etc...
> Fear not, <outofdate> is of high-quality, like Ant, from an Ant commiter (Peter Reilly)
I'll have a look on this contrib, it could do the job

Thanks Dominique



Re: Multiple fileset and filelist comparisons

Posted by Dominique Devienne <dd...@gmail.com>.
On Tue, Apr 26, 2016 at 12:09 PM, <La...@oecd.org> wrote:

> Thanks for you answer Dominique
> Actually I can't just simply synchronize remote repository in one shot. I
> have this intermediary fileList because I need to update remote files
> through different batches which can't exceed x number of files depending on
> many rules....


Then maybe
http://stackoverflow.com/questions/5940918/how-to-use-ants-sync-task-but-based-on-file-contents
is closer to what you need. --DD

PS: http://ant-contrib.sourceforge.net/tasks/tasks/outofdate.html might
also be of interest. Unlike <sync>, can get computed filesets/paths/etc...
Fear not, <outofdate> is of high-quality, like Ant, from an Ant commiter
(Peter Reilly)

RE: Multiple fileset and filelist comparisons

Posted by La...@oecd.org.
Thanks for you answer Dominique
Actually I can't just simply synchronize remote repository in one shot. I have this intermediary fileList because I need to update remote files through different batches which can't exceed x number of files depending on many rules....

-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: mardi 26 avril 2016 11:48
To: Ant Users List
Subject: Re: Multiple fileset and filelist comparisons

On Tue, Apr 26, 2016 at 11:25 AM, <La...@oecd.org> wrote:

> I need to compare those 2 file trees to get desynchronized files from 
> 'DirRemote' (in order to synchronize them with the latest revision further).
>

Have a looked at the <sync> task?
https://ant.apache.org/manual/Tasks/sync.html --DD

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

Re: Multiple fileset and filelist comparisons

Posted by Dominique Devienne <dd...@gmail.com>.
On Tue, Apr 26, 2016 at 11:25 AM, <La...@oecd.org> wrote:

> I need to compare those 2 file trees to get desynchronized files from
> 'DirRemote' (in order to synchronize them with the latest revision further).
>

Have a looked at the <sync> task?
https://ant.apache.org/manual/Tasks/sync.html --DD