From: Paul Bauer Date: Fri, 24 Apr 2020 10:59:49 +0000 (+0200) Subject: Fix bug in source verification on Windows X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=b00211d580f143dfd71983bc8c45d217e4a8ebd3;p=alexxy%2Fgromacs.git Fix bug in source verification on Windows The way to pass the set of directories to be used for validating the source caused issues on Windows systems, as it replaced ":" characters to change from strings to lists in CMake. This caused the top level directory to be changed from e.g. "D:" to "D;", messing up the rest. Fixed the message passing to only pass the final directory, and modify to full path after the set has been passed through. Fixes #3493 Change-Id: I4076b8e87dc8d72a83af6aa0c7ab4b3366917ed0 --- diff --git a/cmake/gmxGenerateVersionInfoRelease.cmake b/cmake/gmxGenerateVersionInfoRelease.cmake index 98107481e8..2e3997ff0a 100644 --- a/cmake/gmxGenerateVersionInfoRelease.cmake +++ b/cmake/gmxGenerateVersionInfoRelease.cmake @@ -88,6 +88,12 @@ set(GMX_VERSION_STRING_FULL ${PROJECT_VERSION}) # We had to pass the directory list as a string, so now we convert it back to a list string(REPLACE ":" ";" DIRECTORIES_TO_CHECKSUM_LIST ${DIRECTORIES_TO_CHECKSUM}) +# We need the full path to the directories after passing it through +set(FULL_PATH_DIRECTORIES "") +foreach(DIR ${DIRECTORIES_TO_CHECKSUM_LIST}) + list(APPEND FULL_PATH_DIRECTORIES "${PROJECT_SOURCE_DIR}/${DIR}") +endforeach() + # Prepare for checking source tree file hashes. # To notify the user during compilation and at runtime that the build source # has not been modified after unpacking the source tarball, the contents are hashed @@ -108,7 +114,7 @@ if(NOT VERSION_STRING_OF_FORK OR "${VERSION_STRING_OF_FORK}" STREQUAL "") set(CHECKSUM_RESULT_FILE "${CMAKE_CURRENT_BINARY_DIR}/computed_checksum") execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/admin/createFileHash.py - -s ${DIRECTORIES_TO_CHECKSUM_LIST} + -s ${FULL_PATH_DIRECTORIES} -o ${CHECKSUM_RESULT_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} OUTPUT_QUIET) diff --git a/cmake/gmxVersionInfo.cmake b/cmake/gmxVersionInfo.cmake index a220aca1fe..40f87eee56 100644 --- a/cmake/gmxVersionInfo.cmake +++ b/cmake/gmxVersionInfo.cmake @@ -254,7 +254,7 @@ if (NOT SOURCE_IS_SOURCE_DISTRIBUTION AND endif() set(REGRESSIONTEST_VERSION "${GMX_VERSION_STRING}") -set(REGRESSIONTEST_BRANCH "refs/heads/release-2020") +set(REGRESSIONTEST_BRANCH "release-2020") # Run the regressiontests packaging job with the correct pakage # version string, and the release box checked, in order to have it # build the regressiontests tarball with all the right naming. The @@ -331,8 +331,8 @@ set(VERSION_INFO_DEPS ${VERSION_INFO_CMAKE_FILE}) set(VERSION_INFO_CMAKEIN_FILE ${CMAKE_CURRENT_LIST_DIR}/VersionInfo.cmake.cmakein) set(VERSION_INFO_CONFIGURE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/gmxConfigureVersionInfo.cmake) # A set of directories to scan for calculating the hash of source files. -set(SET_OF_DIRECTORIES_TO_CHECKSUM "${PROJECT_SOURCE_DIR}/src") -list(APPEND SET_OF_DIRECTORIES_TO_CHECKSUM "${PROJECT_SOURCE_DIR}/python_packaging") +set(SET_OF_DIRECTORIES_TO_CHECKSUM "src") +list(APPEND SET_OF_DIRECTORIES_TO_CHECKSUM "python_packaging") # Due to the limitations for passing a list as arguments, we make the directories a string here string(REPLACE ";" ":" DIRECTORIES_TO_CHECKSUM_STRING "${SET_OF_DIRECTORIES_TO_CHECKSUM}") # Try to find python for the checksumming script @@ -436,11 +436,16 @@ set(CHECKSUM_FILE "${PROJECT_SOURCE_DIR}/src/reference_checksum") # Note: The RUN_ALWAYS here is to regenerate the hash file only, it does not # mean that the target is run in all builds if (PYTHONINTERP_FOUND) + # We need the full path to the directories after passing it through + set(FULL_PATH_DIRECTORIES "") + foreach(DIR ${SET_OF_DIRECTORIES_TO_CHECKSUM}) + list(APPEND FULL_PATH_DIRECTORIES "${PROJECT_SOURCE_DIR}/${DIR}") + endforeach() gmx_add_custom_output_target(reference_checksum RUN_ALWAYS OUTPUT ${CHECKSUM_FILE} COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/admin/createFileHash.py - -s ${SET_OF_DIRECTORIES_TO_CHECKSUM} + -s ${FULL_PATH_DIRECTORIES} -o ${CHECKSUM_FILE} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Generating reference checksum of source files")