MantisBT - CMake
View Issue Details
0011286CMakeCMakepublic2010-10-04 05:582011-09-05 11:37
Adam J Richardson 
David Cole 
normalfeatureN/A
closedfixed 
CMake-2-8 
CMake 2.8.5CMake 2.8.5 
0011286: REQ: Upload packages to webserver
I would like to see an upload feature added to CMake. CPack does an excellent job of packaging, but does nothing with the packages. It has been suggested that an upload script can be hacked together, however I would like to see something simpler like:

CPack_UploadAllPackagesTo(url, upload_type)

where upload_type could be one of SCP, DAV, NFS or CIFS.

Thanks for reading.
See also CMake Digest, Vol 78, Issue 6 of the mailing list.
No tags attached.
related to 0011433closed  Add download command to CMake command mode 
Issue History
2010-10-04 05:58Adam J RichardsonNew Issue
2010-11-10 06:57Eric NOULARDRelationship addedrelated to 0011433
2011-01-17 16:45David ColeAssigned To => David Cole
2011-01-17 16:45David ColeStatusnew => assigned
2011-02-22 17:22David ColeTarget Version => CMake 2.8.5
2011-02-24 03:22Eric NOULARDNote Added: 0025567
2011-02-24 03:23Eric NOULARDNote Added: 0025568
2011-02-24 07:09David ColeNote Added: 0025572
2011-03-01 16:24David ColeNote Added: 0025614
2011-03-01 16:37David ColeNote Added: 0025615
2011-03-01 16:39David ColeNote Added: 0025616
2011-03-01 16:39David ColeStatusassigned => resolved
2011-03-01 16:39David ColeFixed in Version => CMake 2.8.5
2011-03-01 16:39David ColeResolutionopen => fixed
2011-09-05 11:37David ColeStatusresolved => closed
2011-09-05 11:37David ColeNote Added: 0027335

Notes
(0025567)
Eric NOULARD   
2011-02-24 03:22   
Hi Dave,
I just saw that this was on the 2.8.5 Roadmap.

What about adding a more generic
file(UPLOAD file url TIMEOUT timeout] [STATUS status] [LOG log])

to cmake and build the
"CPack_UploadAllPackagesTo(url, upload_type)" on top of that.

CPack does not currently produce something usable about the set
of files produced by each generator but it can be added?

i.e. we could make CPack create a

cpack_<GEN>_package.cmake file (in the build tree)
which would contain something like;

cpack_RPM_package.cmake:
set(CPACK_RPM_GENERATED_FILES "/absolute/path/file1.rpm /absolute/path/file2.rpm")
list(APPEND CPACK_GENERATED_FILES ${CPACK_RPM_GENERATED_FILES})

that way one can easily have the list of files produced by
any if not ALL CPack generator used.


For Adam,
What do you mean by "All Package" ?
Does this mean all files generated by all CPack generayor
found in CPACK_GENERATOR?

Be aware that some CPack generators may create several files
because a component install has been requested (Archive generators and RPM).
(0025568)
Eric NOULARD   
2011-02-24 03:23   
Another note, I think
SCP, DAV, NFS or CIFS should be part of the url itself.
(0025572)
David Cole   
2011-02-24 07:09   
Hey, Eric. Great minds think alike.

I'm actually in the middle of implementing "file(UPLOAD" right now... :-)

I also think that the protocol should be part of the url itself, and that if file(UPLOAD in a cmake script is insufficient for some reason, people should use "find_program" and "execute_process" to execute an external tool to do the upload.
(0025614)
David Cole   
2011-03-01 16:24   
These two commits implement the "file(UPLOAD" feature:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=963bebcc174411e1087af31cc5054422b0080e76 [^]

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61a83f955a613383b78cb2759d867d3133741a49 [^]

Both are now merged into the 'master' branch of CMake and can be expected to be part of the CMake 2.8.5 release...
(0025615)
David Cole   
2011-03-01 16:37   
Eric,

If you would like to extend CPack to provide a list of all files generated, then it should be simple to do something like this, after CPack has run:

foreach(f ${CPACK_LIST_OF_GENERATED_FILES})
  get_filename_component(filename "${f}" NAME)
  set(url "http://someurl/uploadfile.php?filename=${filename}" [^])
  file(UPLOAD "${f}" "${url}" STATUS status LOG log)
  message("status='${status}'")
  message("log='${log}'")
endforeach()

I foresee people using the new "file(upload" and the forthcoming "ctest_upload" from ctest -S scripts as well to upload packages. So I do not think mucking around too much with CPack itself is warranted for this feature request.

Enabling such capabilities from anywhere using "file(UPLOAD" is done now. Anybody can use it from anywhere with CMake 2.8.5 and later.

In other words..... I'm going to resolve this issue as "fixed" -- if somebody wants to do more with this and extend CPack in some way, please open another issue and make concrete suggestions, attach documented/tested patches, ...

:-)
(0025616)
David Cole   
2011-03-01 16:39   
See previous notes for fix details and discussion about future directions. Please open other issues for further work, unless something is incorrectly implemented in the new "file(UPLOAD" feature.

Thanks.
(0027335)
David Cole   
2011-09-05 11:37   
Closing resolved issues that have not been updated in more than 4 months.