You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Loughran <st...@apache.org> on 2006/02/01 11:14:24 UTC

Re: Copy-Task

Stefan Bodewig wrote:
> On Tue, 31 Jan 2006, Markus M. May <mm...@gmx.net> wrote:
> 
>> Now I just would like to copy files which are not already on the
>> remote repository. This cannot be done using the standard ant-task
>> copy, since the jars on the local system do have a newer timestamp.
> 
> Apart from using the present selector (I've seen the mail 8-), maybe
> you should revisit your sync procedure.
> 
> Why is the local timestamp different from the one on the remote
> repository?  rsync or Ant's sync task or even just copy should give
> you the ability to preserve the timestamps.
> 

Unless all dev systems are in the same cluster or a properly configured 
NTP system is keeping the clocks in lockstep, and provided all boxes 
TZone settings are consistent, you will probably encounter clock skew 
when files are uploaded, complicating dependency logic.

- the preservelastmodified attribute of copy can  be used to force set 
the time of created remote files to that of the local one.

-the granularity attribute of <copy> can be set to allow a broader than 
normal clock skew

-you can use the <different> selector to do byte for byte comparisons of 
files. But that pulls all the remote data down and can clog a network

I'd try the first two and then go to #3 if there is no other choice.

If you really wanted to do this properly, I'd consider creating strong 
hashes of the files and saving them remotely, doing the same for the 
local files and then uploading only those files+checksums whose remote 
checksums are different. That would be custom coding.

The alternative, if you live in a pure unix world, is to delegate 
everything to rsync.

-steve


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


Re: Copy-Task

Posted by Steve Loughran <st...@apache.org>.
Stephen McConnell wrote:
>  
> 
>> -----Original Message-----
>> From: Steve Loughran [mailto:stevel@apache.org] 
>> Sent: Thursday, 2 February 2006 2:25 AM
>> To: Ant Users List
>> Subject: Re: Copy-Task
>>
>> Stephen McConnell wrote:
>>>  
>>>
>>>> -----Original Message-----
>>>> From: Steve Loughran [mailto:stevel@apache.org]
>>>> -you can use the <different> selector to do byte for byte 
>> comparisons 
>>>> of files. But that pulls all the remote data down and can clog a 
>>>> network
>>> Would an MD5 comparison be sufficient?
>> you probably don't even need a hash that strong. But you do 
>> need to cache the hash somewhere, because if you have to 
>> calculate it on demand, then you have just done the data copy 
>> that you wanted to avoid...
> 
> I'm assuming that there is a MD5 on the server (or at least an MD5 could be
> placed on the server with the artifact) and that you would download the MD5
> and compare that with a locally generated MD5 (avoiding any artifact
> download).
> 

Exactly. Though what you really want is a file system that can work out 
the hashes for you. Which I think things like WebDav can do; you do a 
HEAD with the etag property and the server should let you know if it has 
changed...

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


RE: Copy-Task

Posted by Stephen McConnell <mc...@dpml.net>.
 

> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org] 
> Sent: Thursday, 2 February 2006 2:25 AM
> To: Ant Users List
> Subject: Re: Copy-Task
> 
> Stephen McConnell wrote:
> >  
> > 
> >> -----Original Message-----
> >> From: Steve Loughran [mailto:stevel@apache.org]
> > 
> >> -you can use the <different> selector to do byte for byte 
> comparisons 
> >> of files. But that pulls all the remote data down and can clog a 
> >> network
> > 
> > Would an MD5 comparison be sufficient?
> 
> you probably don't even need a hash that strong. But you do 
> need to cache the hash somewhere, because if you have to 
> calculate it on demand, then you have just done the data copy 
> that you wanted to avoid...

I'm assuming that there is a MD5 on the server (or at least an MD5 could be
placed on the server with the artifact) and that you would download the MD5
and compare that with a locally generated MD5 (avoiding any artifact
download).

/Steve.



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


Re: Copy-Task

Posted by Steve Loughran <st...@apache.org>.
Stephen McConnell wrote:
>  
> 
>> -----Original Message-----
>> From: Steve Loughran [mailto:stevel@apache.org] 
> 
>> -you can use the <different> selector to do byte for byte 
>> comparisons of files. But that pulls all the remote data down 
>> and can clog a network
> 
> Would an MD5 comparison be sufficient?

you probably don't even need a hash that strong. But you do need to 
cache the hash somewhere, because if you have to calculate it on demand, 
then you have just done the data copy that you wanted to avoid...

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


Re: Copy-Task

Posted by Nicolas Vervelle <ni...@steria.com>.
I haven't followed the beginning of the discussion so I may be wrong 
about what it is about ;)
(Sorry if I misunderstood the question)

If you need to copy only modified files from local host to a remote 
host, you can use a mehod similar to what I have done for updating the 
http://www.jmol.org/ website.

The Ant script that copy the files to the web server can be found at:
http://cvs.sourceforge.net/viewcvs.py/jmol/Jmol-web/build-deploy.xml?view=markup

It's based on MD5 checksum comparison to decide which files need to be sent.
I keep a cache.properties file to know what has been sent to the webserver.
There's extra stuff on the build file because the cache.properties file 
is also kept under CVS and can be used from several computers.

Nico

Stephen McConnell wrote:

> 
>
>  
>
>>-----Original Message-----
>>From: Steve Loughran [mailto:stevel@apache.org] 
>>    
>>
>
>  
>
>>-you can use the <different> selector to do byte for byte 
>>comparisons of files. But that pulls all the remote data down 
>>and can clog a network
>>    
>>
>
>Would an MD5 comparison be sufficient?
>
>/Steve.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>

RE: Copy-Task

Posted by Jeffrey E Care <ca...@us.ibm.com>.
You still need to pull down all of the bytes to compute the MD5 sum.

-- 
Jeffrey E. Care (carej@us.ibm.com)
WAS Pyxis Lead Release Engineer




"Stephen McConnell" <mc...@dpml.net> 
02/01/2006 10:36 AM
Please respond to
"Ant Users List" <us...@ant.apache.org>


To
"'Ant Users List'" <us...@ant.apache.org>
cc

Subject
RE: Copy-Task






 

> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org] 

> -you can use the <different> selector to do byte for byte 
> comparisons of files. But that pulls all the remote data down 
> and can clog a network

Would an MD5 comparison be sufficient?

/Steve.



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



RE: Copy-Task

Posted by Stephen McConnell <mc...@dpml.net>.
 

> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org] 

> -you can use the <different> selector to do byte for byte 
> comparisons of files. But that pulls all the remote data down 
> and can clog a network

Would an MD5 comparison be sufficient?

/Steve.



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