You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Gilles Querret <g....@riverside-software.fr> on 2013/01/24 13:32:02 UTC

ZipFileSet and Selectors

Good morning,

--
Sorry for double post, I thought this email address was subscribing
Ant user. I'm not sure if non-subscribers can post messages, and if
answers were already sent, I didn't receive them.
--

I have a problem working with ZipFileSet and selectors, and I don't know if
my syntax is wrong, or if this is not supported by Ant.

If I have a directory filled with text files, I'm able to use :
<copy todir="target">
  <fileset dir="source">
    <contains text="some_string" />
  </fileset>
</copy>

However, if I create a ZIP file from "source" directory, and execute :
<copy todir="target">
  <zipfileset src="source.zip">
    <contains text="some_string" />
  </zipfileset>
</copy>
I always have the full content of source.zip in target directory
(contains selector doesn't seem to be executed).

Is this the expected behavior ? Is there another way to achieve that ?
I've only found one entry in Bugzilla (
https://issues.apache.org/bugzilla/show_bug.cgi?id=28353 ), but that
doesn't anwser my question.


Regards,


-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532

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


Re: ZipFileSet and Selectors

Posted by Gilles Querret <g....@riverside-software.fr>.
Hi,

> I don't think the problem is inclusion or exclusion based upon file name -
> its excluding based upon contents within the files.
>
> Gilles - would that be a correct statement?

Yes, that's correct. I don't know why the selector isn't executed.

-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532

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


Re: ZipFileSet and Selectors

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
I don't think the problem is inclusion or exclusion based upon file name - 
its excluding based upon contents within the files.

Gilles - would that be a correct statement?


On Thu, 24 Jan 2013, Dhwani Trivedi wrote:

> Hello Gilles,
>
>       If I understand your problem then try this one :
>
> <target name="zip">
>
> <delete file="../csns.zip"/>
>
> <zip destfile="../csns.zip"
>
>    basedir="."
>
>    includes=
> "conf/*.*,db/**/*.*,src/**/*.*,build/**/*.*,web/**/*.*,build.property.sample,build.property,build.xml,TODO,README"
>
>    excludes="**/*.class,**/*.jar,web/javascript/ckeditor/**/*.*
> ,web/javascript/tiny_mce/**/*.*
> ,web/doc/**/*.*,build/**/*.*,**/*.svn,dist/**/*.*"
>
> />
>
>  </target>
>
> Here I am excluding few files and just including those files which are new
> for my project and also deleting previous zip file.
>
>
>
> On Thu, Jan 24, 2013 at 4:32 AM, Gilles Querret <
> g.querret@riverside-software.fr> wrote:
>
>> Good morning,
>>
>> --
>> Sorry for double post, I thought this email address was subscribing
>> Ant user. I'm not sure if non-subscribers can post messages, and if
>> answers were already sent, I didn't receive them.
>> --
>>
>> I have a problem working with ZipFileSet and selectors, and I don't know if
>> my syntax is wrong, or if this is not supported by Ant.
>>
>> If I have a directory filled with text files, I'm able to use :
>> <copy todir="target">
>>   <fileset dir="source">
>>     <contains text="some_string" />
>>   </fileset>
>> </copy>
>>
>> However, if I create a ZIP file from "source" directory, and execute :
>> <copy todir="target">
>>   <zipfileset src="source.zip">
>>     <contains text="some_string" />
>>   </zipfileset>
>> </copy>
>> I always have the full content of source.zip in target directory
>> (contains selector doesn't seem to be executed).
>>
>> Is this the expected behavior ? Is there another way to achieve that ?
>> I've only found one entry in Bugzilla (
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=28353 ), but that
>> doesn't anwser my question.
>>
>>
>> Regards,
>>
>>
>> --
>> Gilles QUERRET
>>
>> Riverside Software
>> 15d route de Bellevue ? 69440 Mornant ? France
>> Mob : +33 662.525.532
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

Scot P. Floess             RHCT  (Certificate Number 605010084735240)
Chief Architect FlossWare  http://sourceforge.net/projects/flossware
                            http://flossware.sourceforge.net
                            https://github.com/organizations/FlossWare

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


Re: ZipFileSet and Selectors

Posted by Dhwani Trivedi <dh...@gmail.com>.
Hello Gilles,

       If I understand your problem then try this one :

<target name="zip">

 <delete file="../csns.zip"/>

 <zip destfile="../csns.zip"

    basedir="."

    includes=
"conf/*.*,db/**/*.*,src/**/*.*,build/**/*.*,web/**/*.*,build.property.sample,build.property,build.xml,TODO,README"

    excludes="**/*.class,**/*.jar,web/javascript/ckeditor/**/*.*
,web/javascript/tiny_mce/**/*.*
,web/doc/**/*.*,build/**/*.*,**/*.svn,dist/**/*.*"

 />

  </target>

Here I am excluding few files and just including those files which are new
for my project and also deleting previous zip file.



On Thu, Jan 24, 2013 at 4:32 AM, Gilles Querret <
g.querret@riverside-software.fr> wrote:

> Good morning,
>
> --
> Sorry for double post, I thought this email address was subscribing
> Ant user. I'm not sure if non-subscribers can post messages, and if
> answers were already sent, I didn't receive them.
> --
>
> I have a problem working with ZipFileSet and selectors, and I don't know if
> my syntax is wrong, or if this is not supported by Ant.
>
> If I have a directory filled with text files, I'm able to use :
> <copy todir="target">
>   <fileset dir="source">
>     <contains text="some_string" />
>   </fileset>
> </copy>
>
> However, if I create a ZIP file from "source" directory, and execute :
> <copy todir="target">
>   <zipfileset src="source.zip">
>     <contains text="some_string" />
>   </zipfileset>
> </copy>
> I always have the full content of source.zip in target directory
> (contains selector doesn't seem to be executed).
>
> Is this the expected behavior ? Is there another way to achieve that ?
> I've only found one entry in Bugzilla (
> https://issues.apache.org/bugzilla/show_bug.cgi?id=28353 ), but that
> doesn't anwser my question.
>
>
> Regards,
>
>
> --
> Gilles QUERRET
>
> Riverside Software
> 15d route de Bellevue • 69440 Mornant • France
> Mob : +33 662.525.532
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: ZipFileSet and Selectors

Posted by Gilles Querret <g....@riverside-software.fr>.
Hello Antoine;



> it is possible that you have found a bug. Since the bug 28353 is "resolved
> workforce" I suggest you open a new bug report.
>
>
I'll open a new bug.



> A look in the source code in the head revision tells me that ZipScanner
> does not check whether selectors are present and does not handle them.
> Patches are welcome too :-)
>
>
In fact, my problem is not related with ZipFileSet for a custom fileset,
and the selector is also a custom one ( http://code.google.com/p/pct/ ).
I'll create a patch working for those custom tasks/selectors, and send it
back as soon as it works correctly. I'll do my best to have something
working for every fileset.

For the time being, it looks like you have to unzip your zip file to a
> temporary directory, then copy with the selector and delete the temporary
> directory.
>

Yes, I'm doing that, but the build is way longer than needed as I'm doing a
comparison between two archives, both in Gb.
I'm sure I'll post some questions on the dev mailing list or in bugzilla.


Best regards,

-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532

Re: ZipFileSet and Selectors

Posted by Antoine Levy Lambert <an...@gmx.de>.
Hello Gilles,

it is possible that you have found a bug. Since the bug 28353 is "resolved workforce" I suggest you open a new bug report.

A look in the source code in the head revision tells me that ZipScanner does not check whether selectors are present and does not handle them.

Patches are welcome too :-)

For the time being, it looks like you have to unzip your zip file to a temporary directory, then copy with the selector and delete the temporary directory.

Regards,

Antoine
On Jan 24, 2013, at 7:32 AM, Gilles Querret wrote:

> Good morning,
> 
> --
> Sorry for double post, I thought this email address was subscribing
> Ant user. I'm not sure if non-subscribers can post messages, and if
> answers were already sent, I didn't receive them.
> --
> 
> I have a problem working with ZipFileSet and selectors, and I don't know if
> my syntax is wrong, or if this is not supported by Ant.
> 
> If I have a directory filled with text files, I'm able to use :
> <copy todir="target">
>  <fileset dir="source">
>    <contains text="some_string" />
>  </fileset>
> </copy>
> 
> However, if I create a ZIP file from "source" directory, and execute :
> <copy todir="target">
>  <zipfileset src="source.zip">
>    <contains text="some_string" />
>  </zipfileset>
> </copy>
> I always have the full content of source.zip in target directory
> (contains selector doesn't seem to be executed).
> 
> Is this the expected behavior ? Is there another way to achieve that ?
> I've only found one entry in Bugzilla (
> https://issues.apache.org/bugzilla/show_bug.cgi?id=28353 ), but that
> doesn't anwser my question.
> 
> 
> Regards,
> 
> 
> -- 
> Gilles QUERRET
> 
> Riverside Software
> 15d route de Bellevue • 69440 Mornant • France
> Mob : +33 662.525.532
> 
> ---------------------------------------------------------------------
> 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