[CMake] file( DOWNLOAD ) problem

David Cole david.cole at kitware.com
Thu Sep 27 00:20:34 EDT 2012


On Wed, Sep 26, 2012 at 7:32 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> To do MD5 checks, I need to somehow record the expected MD5 somewhere,
> which isn't very maintainable.
>
> I provide a list of third party libraries that CMake should download
> from a central third party repository here at work. It is a trusted
> source, because we know it is, so we don't need to verify the MD5.
> However, if I could request the MD5 first, and then download, then
> compare the MD5 the server gave me with what I actually downloaded,
> that would certainly work just to verify the complete file was
> downloaded.
>
> Other than that, I'll have to rely on the status of the operation...
> but I don't like that the destination file is created prior to any
> writes being possible by CMake (it can't write anything if no data was
> received, so why doesn't it create the file once it has a write
> buffer?)
>

Recording the MD5 somewhere is the only way to have a reasonable
re-assurance that what you've asked for is what you're getting from a
network operation. It seems to me that it could be made "maintainable"
if you centralize the knowledge of the checksums in a file that is
changed whenever any of the downloadable files is changed.

I guess we figure it's no use downloading bits over the network if you
can't even open a (presumably local) output file for writing... so we
try to open the output file for writing first, and if it succeeds,
then we start grabbing bits from the network and writing them into the
file as we receive them.

There is room for improvement in the file(DOWNLOAD implementation, but
it is the way it is right now (and will be for 2.8.10 as well...)

Start proposing improvements for it now, and submitting patches to
make stuff better for 2.8.11 and/or beyond. :-)


HTH,
David


More information about the CMake mailing list