From 9e259d58c2a898800463d28b175fde0e74ab96d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 18 Feb 2021 15:30:03 +0200 Subject: Remove race condition during `make dist` Introduced by 85828b8f22e7f4dfa6a5d4b0a1ab9e133e7feea7 This is running 2 git processes in parallel, which, if unlucky can cause either of them to fail with "File already exists" error. --- cmake/make_dist.cmake.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 11b46f1c15b..4bc68d5edf9 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -43,6 +43,13 @@ IF(GIT_EXECUTABLE) MESSAGE(STATUS "Running git checkout-index") EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" checkout-index --all --prefix=${PACKAGE_DIR}/ + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ENDIF() + EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/$path/" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE RESULT -- cgit v1.2.1