From c342d22014ce1b8e4d093f8f2560bb1aa3a3a621 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 24 Mar 2021 16:25:40 -0500 Subject: [PATCH 1/7] Adding option for automatically checking out submodules. --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d450cc5adf..77756581b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(DAGMC_VERSION ${DAGMC_MAJOR_VERSION}.${DAGMC_MINOR_VERSION}.${DAGMC_PATCH_VE # Set git SHA1 hash as a compile definition find_package(Git) -if(GIT_FOUND) +if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE DAGMC_GIT_SHA_SUCCESS @@ -22,6 +22,24 @@ if(GIT_FOUND) message(WARNING "Could not determine the commit SHA for DAGMC.") set(DAGMC_GIT_SHA "") endif() + + option(GIT_SUBMODULE "Check submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL 0) + message(FATAL_ERROR "git submodule update --init failed with \ + ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() +endif() + +# Check to see if submodules exist (by checking one) +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/pyne/README.md") + message(FATAL_ERROR "The git submodules were not downloaded! GIT_SUBMODULE was \ + turned off or failed. Please update submodules and try again.") endif() # Make the scripts in the "cmake" directory available to CMake From 28d9739438fb57e1675ff450042031b71e2670c0 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 24 Mar 2021 16:30:19 -0500 Subject: [PATCH 2/7] Updating file check to use file in the pyne submodule, not dagmc. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77756581b7..3ba6bffd40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") endif() # Check to see if submodules exist (by checking one) -if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/pyne/README.md") +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/pyne/pyne/readme.rst") message(FATAL_ERROR "The git submodules were not downloaded! GIT_SUBMODULE was \ turned off or failed. Please update submodules and try again.") endif() From 22b003501027f6579297a1a4fe44e2b1c09453da Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 24 Mar 2021 16:47:37 -0500 Subject: [PATCH 3/7] News file :roll_eyes: --- news/PR-0734.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 news/PR-0734.rst diff --git a/news/PR-0734.rst b/news/PR-0734.rst new file mode 100644 index 0000000000..107305bee4 --- /dev/null +++ b/news/PR-0734.rst @@ -0,0 +1,13 @@ +**Added:** + + - CMake option to checkout PyNE submodule automatically + +**Changed:** None + +**Deprecated:** None + +**Removed:** None + +**Fixed:** None + +**Security:** None From 04b46727abca221b5c8c60bc98d1c33185ea8c7f Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 24 Mar 2021 18:42:38 -0500 Subject: [PATCH 4/7] Making each git argument a separate string. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ba6bffd40..b669e8efbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") option(GIT_SUBMODULE "Check submodules during build" ON) if(GIT_SUBMODULE) message(STATUS "Submodule update") - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + execute_process(COMMAND ${GIT_EXECUTABLE} "submodule" "update" "--init" "--recursive" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_SUBMOD_RESULT) if(NOT GIT_SUBMOD_RESULT EQUAL 0) From 28588a4a827cb5cfba75613dc10d2ce90fc3e0bd Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 24 Mar 2021 18:56:40 -0500 Subject: [PATCH 5/7] Match error message output with the git command. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b669e8efbe..533a33c118 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_SUBMOD_RESULT) if(NOT GIT_SUBMOD_RESULT EQUAL 0) - message(FATAL_ERROR "git submodule update --init failed with \ + message(FATAL_ERROR "git submodule update --init --recursive failed with \ ${GIT_SUBMOD_RESULT}, please checkout submodules") endif() endif() From 3f0e4c7579cb151c928c503a327bf7cc30b03946 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 25 Mar 2021 01:11:01 -0500 Subject: [PATCH 6/7] Ensuring that the jobs environment variable is cleared. Really?? --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 533a33c118..b69934c03a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") option(GIT_SUBMODULE "Check submodules during build" ON) if(GIT_SUBMODULE) message(STATUS "Submodule update") + set(ENV{jobs} "") execute_process(COMMAND ${GIT_EXECUTABLE} "submodule" "update" "--init" "--recursive" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_SUBMOD_RESULT) From 9d6a23092470b4ce7943d641865da590e7be33a9 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 25 Mar 2021 07:58:21 -0500 Subject: [PATCH 7/7] Removing submodule update in Circle CI config file. --- .circleci/config.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca3aa9bef8..1594d46c60 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ jobs: type: string docker: - image: svalinn/dagmc-ci-ubuntu-18.04-housekeeping:latest - auth: + auth: username: $DOCKERHUB_USER password: $DOCKERHUB_PASS working_directory: /root/build_dir/DAGMC @@ -36,16 +36,12 @@ jobs: default: "OFF" docker: - image: svalinn/dagmc-ci-ubuntu-<< parameters.img >>-<< parameters.compiler >>-ext-hdf5_<< parameters.hdf5 >>-moab_<< parameters.moab >>:latest - auth: + auth: username: $DOCKERHUB_USER password: $DOCKERHUB_PASS working_directory: /root/build_dir/DAGMC steps: - checkout - - run: - name: "Pull Submodules" - command: | - git submodule update --init - run: name: Setup environment command: | @@ -66,7 +62,7 @@ workflows: version: 2 pull_request: # Run only for PullRequest jobs: - + - house_keeping: context: dockerhub matrix: