E3SM-Project / E3SM

Energy Exascale Earth System Model source code. NOTE: use "maint" branches for your work. Head of master is not validated.

Home Page:https://docs.e3sm.org/E3SM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build fails in prov check if e3sm is itself a submodule

mahf708 opened this issue · comments

Consider the following setup. Someone (me) adds E3SM (E3SM-Project/E3SM) as a submodule inside another repository. Let's call it e3sm in that repo. Here's how it looks:

$ ls parent_repo
.  ..  e3sm  .git  .github  .gitmodules  license  plus  readme

then, e3sm itself (i.e., this E3SM) has this

$ ls parent_repo/e3sm
.        cime_config    components       driver-moab  .gitignore   README.md
..       .circleci      CONTRIBUTING.md  externals    .gitmodules  run_e3sm.template.sh
AUTHORS  CITATION.cff   docs             .git         LICENSE      share
cime     codemeta.json  driver-mct       .github      mkdocs.yaml

with a twist:

$ cat parent_repo/e3sm/.git
gitdir: ../.git/modules/e3sm

🤯

Because of this structure, and if AND only if, the e3sm folder is extracted out of parent_repo, the following build-time error occurs:

Traceback (most recent call last):
  File "./case.build", line 267, in <module>
    _main_func(__doc__)
  File "./case.build", line 251, in _main_func
    success = build.case_build(
  File "/mnt/e3sm/cime/CIME/build.py", line 1327, in case_build
    return run_and_log_case_status(functor, cb, caseroot=caseroot)
  File "/mnt/e3sm/cime/CIME/utils.py", line 2477, in run_and_log_case_status
    rv = func()
  File "/mnt/e3sm/cime/CIME/build.py", line 1311, in <lambda>
    functor = lambda: _case_build_impl(
  File "/mnt/e3sm/cime/CIME/build.py", line 1255, in _case_build_impl
    post_build(
  File "/mnt/e3sm/cime/CIME/build.py", line 1284, in post_build
    Config.instance().save_build_provenance(case, lid=lid)
  File "/mnt/e3sm/cime_config/customize/provenance.py", line 24, in save_build_provenance
    _record_git_provenance(srcroot, exeroot, lid)
  File "/mnt/e3sm/cime_config/customize/provenance.py", line 82, in _record_git_provenance
    utils.safe_copy(config_src, config_prov, preserve_meta=False)
  File "/mnt/e3sm/cime/CIME/utils.py", line 1424, in safe_copy
    file_util.copy_file(
  File "/usr/lib/python3.8/distutils/file_util.py", line 104, in copy_file
    raise DistutilsFileError(
distutils.errors.DistutilsFileError: can't copy '/mnt/.git/config': doesn't exist or not a regular file

There's more info, but @jgfouca and/or I will fix this soon-ish.