Skip to content

Commit

Permalink
add option to update git submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking committed Dec 16, 2024
1 parent cba71d3 commit 691854b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions params.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ def load_params(args):
if args.source_pr is not None:
mysuite.repos["source"].pr_wanted = args.source_pr

# update Git submodules?
if args.updateGitSubmodules is not None:
mysuite.updateGitSubmodules = args.updateGitSubmodules

# now flesh out the compile strings -- they may refer to either themselves
# or the source dir
for r in mysuite.repos.keys():
Expand Down
11 changes: 6 additions & 5 deletions repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ def git_update(self):

shutil.copy(f"git.{self.name}.out", self.suite.full_web_dir)

# update submodules to those specified by the current commit
# (--init is required because there may be new submodules since the last checkout)
_, _, rc = test_util.run(f"git submodule update --init")
if self.suite.updateGitSubmodules == 1:
# update submodules to those specified by the current commit
# (--init is required because there may be new submodules since the last checkout)
_, _, rc = test_util.run(f"git submodule update --init")

if rc != 0:
self.suite.log.fail("ERROR: git submodule update was unsuccessful")
if rc != 0:
self.suite.log.fail("ERROR: git submodule update was unsuccessful")

def save_head(self):
"""Save the current head of the repo"""
Expand Down
4 changes: 3 additions & 1 deletion suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def __init__(self, args):
self.useCmake = 0
self.isSuperbuild = 0
self.use_ctools = 1

self.reportCoverage = args.with_coverage

# set automatically
Expand All @@ -435,6 +435,8 @@ def __init__(self, args):
self.amrex_install_dir = "" # Cmake installation dir
self.amrex_cmake_opts = ""

self.updateGitSubmodules = 0

self.MPIcommand = ""
self.MPIhost = ""

Expand Down
3 changes: 3 additions & 0 deletions test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
isSuperbuild = < 0: pre-build AMReX and source (default)
1: CMake downloads AMReX and needs separate configure & build >
updateGitSubmodules = < 0: don't update submodules when changing git branches (default)
1: run `git submodule update --init` after changing git branches >
sourceTree = < C_Src or AMReX >
suiteName = < descriptive name (i.e. Castro) >
Expand Down

0 comments on commit 691854b

Please sign in to comment.