spack/var/spack/repos/builtin/packages/hpx/git_external.patch
Teodor Nikolov 65a292fbbf [Package: HPX] Fix Apex and OTF2 support (#13982)
* Fix Apex and OTF2 support

- Comment out apex as a dependncy: it is bundled with HPX.
- Apply a patch to v1.3.0 to correctly build with APEX.
- Add otf2 as a dependency when APEX is enabled.

* Remove depends_on('apex')
2019-12-06 12:41:55 -06:00

82 lines
3.2 KiB
Diff

--- hpx/cmake/GitExternal.cmake.orig 2019-08-16 17:27:04.856315000 +0200
+++ hpx/cmake/GitExternal.cmake 2019-08-16 17:27:47.362709000 +0200
@@ -19,12 +19,12 @@
#
# [optional] Flags which control behaviour
# NO_UPDATE
-# When set, GitExternal will not change a repo that has already been checked out.
-# The purpose of this is to allow one to set a default branch to be checked out,
-# but stop GitExternal from changing back to that branch if the user has checked
+# When set, GitExternal will not change a repo that has already been checked out.
+# The purpose of this is to allow one to set a default branch to be checked out,
+# but stop GitExternal from changing back to that branch if the user has checked
# out and is working on another.
-# VERBOSE
-# When set, displays information about git commands that are executed
+# VERBOSE
+# When set, displays information about git commands that are executed
#
find_package(Git)
@@ -55,17 +55,21 @@
if(nok)
message(FATAL_ERROR "${DIR} git clone failed: ${error}\n")
endif()
- endif()
- if(IS_DIRECTORY "${DIR}/.git")
+ # checkout requested tag
+ GIT_EXTERNAL_MESSAGE("git checkout -q ${TAG}")
+ execute_process(
+ COMMAND "${GIT_EXECUTABLE}" checkout -q "${TAG}"
+ RESULT_VARIABLE nok ERROR_VARIABLE error
+ WORKING_DIRECTORY "${DIR}"
+ )
+ if(nok)
+ message(STATUS "${DIR} git checkout ${TAG} failed: ${error}\n")
+ endif()
+ elseif(IS_DIRECTORY "${DIR}/.git")
if (${GIT_EXTERNAL_NO_UPDATE})
GIT_EXTERNAL_MESSAGE("Update branch disabled by user")
else()
- GIT_EXTERNAL_MESSAGE("current ref is \"${currentref}\" and tag is \"${TAG}\"")
- if(currentref STREQUAL TAG) # nothing to do
- return()
- endif()
-
# reset generated files
foreach(GIT_EXTERNAL_RESET_FILE ${GIT_EXTERNAL_RESET})
GIT_EXTERNAL_MESSAGE("git reset -q ${GIT_EXTERNAL_RESET_FILE}")
@@ -100,15 +104,24 @@
message(STATUS "${DIR} git checkout ${TAG} failed: ${error}\n")
endif()
- # update tag
- GIT_EXTERNAL_MESSAGE("git rebase FETCH_HEAD")
- execute_process(COMMAND ${GIT_EXECUTABLE} rebase FETCH_HEAD
- RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE OUTPUT
+ # check if this is a branch
+ GIT_EXTERNAL_MESSAGE("git symbolic-ref -q HEAD")
+ execute_process(COMMAND "${GIT_EXECUTABLE}" symbolic-ref -q HEAD
+ RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${DIR}")
- if(RESULT)
- message(STATUS "git rebase failed, aborting ${DIR} merge")
- execute_process(COMMAND ${GIT_EXECUTABLE} rebase --abort
+ if(nok)
+ message(STATUS "${TAG} is not a branch")
+ else()
+ # update tag
+ GIT_EXTERNAL_MESSAGE("git rebase FETCH_HEAD")
+ execute_process(COMMAND ${GIT_EXECUTABLE} rebase FETCH_HEAD
+ RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE OUTPUT
WORKING_DIRECTORY "${DIR}")
+ if(RESULT)
+ message(STATUS "git rebase failed, aborting ${DIR} merge")
+ execute_process(COMMAND ${GIT_EXECUTABLE} rebase --abort
+ WORKING_DIRECTORY "${DIR}")
+ endif()
endif()
endif()
else()