[Cmake-commits] [cmake-commits] king committed UntarFile.cmake 1.2 1.3

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Apr 29 15:07:11 EDT 2009


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv17000/Modules

Modified Files:
	UntarFile.cmake 
Log Message:
ENH: Teach UntarFile to preserve file timestamps

After extracting the tarball in a temporary directory we copy the tree
to the destination directory.  The 'cmake -E copy_directory' command
does not preserve file timestamps, so we use file(COPY) instead.


Index: UntarFile.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/UntarFile.cmake,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** UntarFile.cmake	4 Feb 2009 23:24:20 -0000	1.2
--- UntarFile.cmake	29 Apr 2009 19:07:09 -0000	1.3
***************
*** 67,77 ****
  #
  file(GLOB contents "${ut_dir}/*")
- 
- set(is_one_directory 0)
  list(LENGTH contents n)
! if(n EQUAL 1)
!   if(IS_DIRECTORY "${contents}")
!     set(is_one_directory 1)
!   endif()
  endif()
  
--- 67,73 ----
  #
  file(GLOB contents "${ut_dir}/*")
  list(LENGTH contents n)
! if(NOT n EQUAL 1 OR NOT IS_DIRECTORY "${contents}")
!   set(contents "${ut_dir}")
  endif()
  
***************
*** 79,95 ****
  # Copy "the one" directory to the final directory:
  #
! if(is_one_directory EQUAL 1)
!   #message(STATUS "info: (1) copying '${contents}' to '${directory}'...")
!   execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${contents}" "${directory}"
!     RESULT_VARIABLE rv)
! else()
!   #message(STATUS "info: (more) copying '${ut_dir}' to '${directory}'...")
!   execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${ut_dir}" "${directory}"
!     RESULT_VARIABLE rv)
! endif()
! 
! if(NOT rv EQUAL 0)
!   message(FATAL_ERROR "error: copy_directory failed after untar in '${ut_dir}'")
! endif()
  
  
--- 75,79 ----
  # Copy "the one" directory to the final directory:
  #
! file(COPY "${contents}/" DESTINATION ${directory})
  
  



More information about the Cmake-commits mailing list