You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2005/10/19 21:16:55 UTC

Tar and resource collections

Hi all,

I think this one has earned an extra mail since it has some subtle
effects beyond "hey, I can tar up a path now".

<tar> supports resources now, any resources.

All protected method signatures in <tar> remained unchanged, I just
added a few new ones.  Classes extending <tar> shouldn't notice,
they'll reject non-file resources, but any file-system resource
collection should magically be supported by them as well.  Not that I
was aware of any subclass.

<tarfileset> is a stand-alone data-type now and can read from a source
archive (just like <zipfileset> did).

<zipresource> and <tarresource> know their Unix permissions (read from
the archive) and in <tarresource>'s case their Unix owner and group
information as well.

If you add <zipresource>s (like from a <zipfileset src="...">) or
<tarresources> (ditto) to a <tar>, the original permissions and owners
get retained (unless overridden by the attributes on *fileset).

This lead me to the commented out changes in Ant's build.xml:

    <tar longfile="gnu"
      destfile="${dist.base.binaries}/${dist.name}-bin.tar">
      <zipfileset src="${dist.base.binaries}/${dist.name}-bin.zip"/>
    </tar>

would allow us to read the permissions from the zip file instead of
duplicating the patterns.

Just, it is slow, really really slow.  Replacing both tar tasks made
"ant distribution" go from 2:45 to 6:39 on my 2GHz Pentium M WinXP
(yes, my work machine) notebook.

The reason for this is that with the <zipfileset> approach, the zip
archive gets opened and read once for scanning and then once per
resource that is added to the tar archive.  I don't see any easy way
around that, though.

Stefan

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


Re: Tar and resource collections

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 20 Oct 2005, Stefan Bodewig <bo...@apache.org> wrote:
> On Thu, 20 Oct 2005, Antoine Levy-Lambert <an...@gmx.de> wrote:
> 
>> now, I have  built and tested the current HEAD under Windows 2000,
>> cygwin, JDK 1.5 and I get a lot of errors in the testcases.
> 
> Passed for me, otherwise I wouldn't have committed it.  But I now
> see them fail in Gump as well.

Found it.  ArchiveFileSet has (had ;-) two setSrc() methods, one
taking a File and the other one taking a Resource argument.  Since
Resource has a String-arg constructors, both are potential attribute
setters to IntrospectionHelper.

On my machine IntrospectionHelper picks the File version, on your's
and on vmgump it is the Resource one.  in the later case, it is not a
FileResource and we get the exception.

Stefan

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


Re: Tar and resource collections

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 20 Oct 2005, Antoine Levy-Lambert <an...@gmx.de> wrote:

> now, I have  built and tested the current HEAD under Windows 2000,
> cygwin, JDK 1.5 and I get a lot of errors in the testcases.

Passed for me, otherwise I wouldn't have committed it.  But I now see
them fail in Gump as well.

Stefan

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


Re: Tar and resource collections

Posted by Matt Benson <gu...@yahoo.com>.
Please disregard; this was probably already sent long
ago.  I was going through my draft folder and
accidentally hit send.  ;)

--- Matt Benson <gu...@yahoo.com> wrote:

> --- Antoine Levy-Lambert <an...@gmx.de> wrote:
> 
> > Matt Benson wrote:
> > 
> > >:P
> > >
> > >  
> > >
> > Hello, Matt,
> > 
> > what does :P mean ?
> 
> haha, it was a face...
> > 
> > now, I have  built and tested the current HEAD
> under
> > Windows 2000,
> > cygwin, JDK 1.5 and I get a lot of errors in the
> > testcases.
> > 
> > Do you also have these errors when you run the
> tests
> > ?
> > 
> > I get hit a lot by this one :
> > 
> >             throw new BuildException("only file
> > resources are supported");
> > ZipScanner.java, line 64
> > 
> > I do not understand by which casting magic the
> > srcfile of the ZipFileSet
> > which seems to be stored as a FileResource has
> been
> > degraded to a simple
> > Resource in the processing ?
> > 
> > This is running the ResourceCollectionsTest, in
> the
> > testzipfileset test
> > case.
> > 
> > May be I missed the train on that ? Do you have
> > ideas how we will fix this ?
> > 
> > Cheers,
> > 
> > Antoine
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > dev-help@ant.apache.org
> > 
> > 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Tar and resource collections

Posted by Matt Benson <gu...@yahoo.com>.
--- Antoine Levy-Lambert <an...@gmx.de> wrote:

> Matt Benson wrote:
> 
> >:P
> >
> >  
> >
> Hello, Matt,
> 
> what does :P mean ?

haha, it was a face...
> 
> now, I have  built and tested the current HEAD under
> Windows 2000,
> cygwin, JDK 1.5 and I get a lot of errors in the
> testcases.
> 
> Do you also have these errors when you run the tests
> ?
> 
> I get hit a lot by this one :
> 
>             throw new BuildException("only file
> resources are supported");
> ZipScanner.java, line 64
> 
> I do not understand by which casting magic the
> srcfile of the ZipFileSet
> which seems to be stored as a FileResource has been
> degraded to a simple
> Resource in the processing ?
> 
> This is running the ResourceCollectionsTest, in the
> testzipfileset test
> case.
> 
> May be I missed the train on that ? Do you have
> ideas how we will fix this ?
> 
> Cheers,
> 
> Antoine
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Tar and resource collections

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Matt Benson wrote:

>:P
>
>  
>
Hello, Matt,

what does :P mean ?

now, I have  built and tested the current HEAD under Windows 2000,
cygwin, JDK 1.5 and I get a lot of errors in the testcases.

Do you also have these errors when you run the tests ?

I get hit a lot by this one :

            throw new BuildException("only file resources are supported");
ZipScanner.java, line 64

I do not understand by which casting magic the srcfile of the ZipFileSet
which seems to be stored as a FileResource has been degraded to a simple
Resource in the processing ?

This is running the ResourceCollectionsTest, in the testzipfileset test
case.

May be I missed the train on that ? Do you have ideas how we will fix this ?

Cheers,

Antoine

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


Re: Tar and resource collections

Posted by Matt Benson <gu...@yahoo.com>.
:P

--- Antoine Levy-Lambert <an...@gmx.de> wrote:

> > --- Ursprüngliche Nachricht ---
> > Von: Matt Benson <gu...@yahoo.com>
> > An: Ant Developers List <de...@ant.apache.org>
> > Betreff: Re: Tar and resource collections
> > Datum: Thu, 20 Oct 2005 07:58:41 -0700 (PDT)
> > 
> > I'll keep thinking about this.  It'll be like (the
> > nightmare that is) the redirector element stuff. 
> By
> > now everyone should be realizing that I have a
> > personal weakness for trying to find ways to do
> these
> > things...
> > 
> :-) this is a cool weakness, Matt !
> 
> Antoine
> 
> > -Matt
> > > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

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


Re: Tar and resource collections

Posted by Antoine Levy-Lambert <an...@gmx.de>.
> --- Ursprüngliche Nachricht ---
> Von: Matt Benson <gu...@yahoo.com>
> An: Ant Developers List <de...@ant.apache.org>
> Betreff: Re: Tar and resource collections
> Datum: Thu, 20 Oct 2005 07:58:41 -0700 (PDT)
> 
> I'll keep thinking about this.  It'll be like (the
> nightmare that is) the redirector element stuff.  By
> now everyone should be realizing that I have a
> personal weakness for trying to find ways to do these
> things...
> 
:-) this is a cool weakness, Matt !

Antoine

> -Matt
> > 

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


Re: Tar and resource collections

Posted by Matt Benson <gu...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:

> On Wed, 19 Oct 2005, Matt Benson
> <gu...@yahoo.com> wrote:
> 
> > Hmm... seems like it would take some work (maybe a
> lot
> > of stream magic), but would still be doable to try
> to
> > augment ZipResource to be able to accept a ZipFile
> > instance... ZipFile gets an isOpen() method...
> > ZipScanner passes down its ZipFile and defers
> close()
> > to some hook...
> 
> I thought about this as well, but I failed to find a
> non-intrusive way
> to make the hook know when to fire.  <zipfileset>
> can be defined
> outside of any task, for example.  And I wouldn't
> want to add cleanup
> code that was a no-op for all resource collections
> and had to be
> called in all tasks using resource collections.

I'll keep thinking about this.  It'll be like (the
nightmare that is) the redirector element stuff.  By
now everyone should be realizing that I have a
personal weakness for trying to find ways to do these
things...

-Matt
> 
> Stefan
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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


Re: Tar and resource collections

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 19 Oct 2005, Matt Benson <gu...@yahoo.com> wrote:

> Hmm... seems like it would take some work (maybe a lot
> of stream magic), but would still be doable to try to
> augment ZipResource to be able to accept a ZipFile
> instance... ZipFile gets an isOpen() method...
> ZipScanner passes down its ZipFile and defers close()
> to some hook...

I thought about this as well, but I failed to find a non-intrusive way
to make the hook know when to fire.  <zipfileset> can be defined
outside of any task, for example.  And I wouldn't want to add cleanup
code that was a no-op for all resource collections and had to be
called in all tasks using resource collections.

Stefan

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


Re: Tar and resource collections

Posted by Matt Benson <gu...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
[SNIP]
> This lead me to the commented out changes in Ant's
> build.xml:
> 
>     <tar longfile="gnu"
>      
>
destfile="${dist.base.binaries}/${dist.name}-bin.tar">
>       <zipfileset
> src="${dist.base.binaries}/${dist.name}-bin.zip"/>
>     </tar>
> 
> would allow us to read the permissions from the zip
> file instead of
> duplicating the patterns.
> 
> Just, it is slow, really really slow.  Replacing
> both tar tasks made
> "ant distribution" go from 2:45 to 6:39 on my 2GHz
> Pentium M WinXP
> (yes, my work machine) notebook.
> 
> The reason for this is that with the <zipfileset>
> approach, the zip
> archive gets opened and read once for scanning and
> then once per
> resource that is added to the tar archive.  I don't
> see any easy way
> around that, though.

Hmm... seems like it would take some work (maybe a lot
of stream magic), but would still be doable to try to
augment ZipResource to be able to accept a ZipFile
instance... ZipFile gets an isOpen() method...
ZipScanner passes down its ZipFile and defers close()
to some hook... gets crazy, but it might be possible
Rube Goldberg style...

-Matt

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



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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