Parcourir la source

Fix MSYS CVS local test repo path format (#13001)

The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH.  Detect
the MSYS cvs by looking for the string "msys" in the executable file
itself.  Then convert the repo path to an MSYS path such as "/c/...".
Fix both the CTest.UpdateCVS and ExternalProject tests that use local
CVS repositories.
Brad King il y a 13 ans
Parent
commit
e333602567
2 fichiers modifiés avec 25 ajouts et 0 suppressions
  1. 13 0
      Tests/CTestUpdateCVS.cmake.in
  2. 12 0
      Tests/ExternalProject/CMakeLists.txt

+ 13 - 0
Tests/CTestUpdateCVS.cmake.in

@@ -18,6 +18,19 @@ set(CVS "@CVS_EXECUTABLE@")
 message(" cvs = ${CVS}")
 
 set(REPO ${TOP}/repo)
+
+# The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH.
+# Detect the MSYS cvs and convert the repo path to an MSYS path.
+if(WIN32)
+  if(EXISTS "${CVS}")
+    file(STRINGS "${CVS}" cvs_is_msys LIMIT_COUNT 1 REGEX "[Mm][Ss][Yy][Ss]")
+    if(cvs_is_msys)
+      message("  '${CVS}' is from MSYS (contains '${cvs_is_msys}')")
+      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" REPO "${REPO}")
+    endif()
+  endif()
+endif()
+
 set(CVSCMD ${CVS} -d${REPO})
 
 # CVSNT requires an extra option to 'cvs init'.

+ 12 - 0
Tests/ExternalProject/CMakeLists.txt

@@ -280,6 +280,18 @@ if(do_cvs_tests)
   set_property(TARGET ${proj}
     PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
 
+  # The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH.
+  # Detect the MSYS cvs and convert the repo path to an MSYS path.
+  if(WIN32)
+    if(EXISTS "${CVS_EXECUTABLE}")
+      file(STRINGS "${CVS_EXECUTABLE}" cvs_is_msys LIMIT_COUNT 1 REGEX "[Mm][Ss][Yy][Ss]")
+      if(cvs_is_msys)
+        message(STATUS "'${CVS_EXECUTABLE}' is from MSYS (contains '${cvs_is_msys}')")
+        string(REGEX REPLACE "^([A-Za-z]):" "/\\1" local_cvs_repo "${local_cvs_repo}")
+      endif()
+    endif()
+  endif()
+
   # CVS by date stamp:
   #
   set(proj TutorialStep1-CVS-20090626)