Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New capability to use git submodule config to checkout externals #119

Merged
merged 4 commits into from
May 15, 2019

Conversation

gold2718
Copy link
Collaborator

New capability to use git submodule info to checkout externals

By default, an external with no specified sub-externals configuration file will
have its submodules checked out according to the information in that repository's
.gitmodules file. This process is recursive.

To prevent submodules from being checked out, the external description for that
repository should be listed as "externals = none".

To use submodule URL, local path, and reference hash information for a
sub-external, replace the 'local_path', 'repo_url', and 'branch' 'hash' or 'tag'
keywords with "from_submodule = True".

User interface changes?: Yes
externals keyword can be "none" to prevent loading submodules.
from_submodule keyword can be used to replace external configuration information
with information from a repository's submodule configuration.

Fixes: #96

Testing:
test removed: none
unit tests: all pass
system tests: all pass, added TestSubrepoCheckout to test new functionality
manual testing: Tests with ESCOMP/MOM_interface (see below)

  1. Just run checkout_externals: no change
  2. Remove "externals = ../Externals_MOM.cfg" from Externals.cfg: All four submodules
    of MOM6 checked out
  3. Set "externals = none" in Externals.cfg: No submodules checked out (empty directories)
  4. Modify da_hooks external in Externals_MOM.cfg (see below): da_hooks is checked out with
    MOM6 .gitmodules configuration.
[pkg/MOM6_DA_hooks]
protocol = git
from_submodule = True
required = True

By default, an external with no specified sub-externals configuration file will
have its submodules checked out according to the information in that repository's
.gitmodules file. This process is recursive.
To prevent submodules from being checked out, the external description for that
repository should be listed as "externals = none".
To use submodule URL, local path, and reference hash information for a
sub-external, replace the 'local_path', 'repo_url', and 'branch' 'hash' or 'tag'
keywords with "from_submodule = True".
@@ -59,8 +64,8 @@ def config_string_cleaner(text):


def read_externals_description_file(root_dir, file_name):
"""Given a file name containing a externals description, determine the
format and read it into it's internal representation.
"""Given a file name containing an externals description and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this documentation change reads worse than the note it is replacing.

@mnlevy1981
Copy link
Contributor

I'm going to punt on reviewing this and ask @dabail10 to do it for me - he can make sure this is working the way he expects it to in CICE (I don't have a sandbox using submodules anywhere). I can't add Dave to the reviewer list, though, so I guess I'll give this a green check after getting a thumbs-up from him.

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking this on @gold2718 ! And thanks in particular for adding a number of tests of the new behavior.

I haven't reviewed any of the new submodule-specific code, because I haven't really gotten my head around what's wanted in that respect, so I'll trust you and others on that. So I focused my review on the relatively few pieces of this that potentially affect the general operation of the code, as well as documentation.

To that end, things look pretty good, though see a few inline comments.

I do see, however, that some of the travis-ci tests are failing: these should all be in a passing state before this is merged. At a glance, I see failures in pylint (can be run locally with 'make lint', though I find that different versions of pylint pick up different things; that may be what's going on here) and a few tests with python3.

@dabail10
Copy link

I need the dummies guide to this. Here is what I imagine:

  1. I have added an Externals_CICE.cfg file to my CESM_CICE wrapper. See here:

https://github.com/ESCOMP/CESM_CICE/tree/test_submodule

  1. My test sandbox is:

/glade/work/dbailey/cesm2.1.1_sub

  1. icepack is a submodule of https://github.com/ESCOMP/CICE. CICE is an external of CESM_CICE and goes in src.

However, I am getting the error:
fatal: No url found for submodule path "src" in .gitmodules

Dave

@gold2718
Copy link
Collaborator Author

1. My test sandbox is:

/glade/work/dbailey/cesm2.1.1_sub

Well, that is a weird error message (I think it should say "src/icepack" instead of "src"). However, when I look at your sandbox, I do not see any .gitmodules file. Where is it?

@mnlevy1981
Copy link
Contributor

@gold2718 (cc @dabail10): it looks like src/ is empty, despite the block in Externals.cfg that should fill it

[cice]
branch = master
protocol = git
repo_url = https://github.com/ESCOMP/CICE
local_path = src
required = True
externals = ../Externals_CICE.cfg

components/cice/src should contain ESCOMP/CICE, which has a .gitmodules file. And then Dave wants to get src/icepack from .gitmodules (but we thought it should be [icepack] since presumably the working directory is already src/ when it looks for ../Externals_CICE.cfg?)

@gold2718
Copy link
Collaborator Author

@dabail10, @mnlevy1981,

Which Externals.cfg did you run? At the top level (Externals.cfg in the CESM root directory), there is no externals=Externals_CICE.cfg line so that was not run. That config puts ESCOMP/CICE into <root>/components/cice.

I do not see how this is supposed to work unless the ESCOMP/CICE repo has a submodule.

@mnlevy1981
Copy link
Contributor

So you're saying the fix is in this block of the CESM Externals.cfg?

[cice]
branch = test_submodule
protocol = git
repo_url = https://github.com/ESCOMP/CESM_CICE
local_path = components/cice
required = True
+externals=Externals.cfg

That makes a little sense, but then why would @dabail10 get an error instead of just not trying to populate src/ at all?

@gold2718
Copy link
Collaborator Author

@mnlevy1981, I think I fixed the source of the error but maybe it is best if I can sit with someone to get CICE configured correctly (and fix new bugs that crop up).

@coveralls
Copy link

coveralls commented Apr 25, 2019

Coverage Status

Coverage decreased (-2.2%) to 88.883% when pulling f72ffe7 on gold2718:submodules into 1926530 on ESMCI:master.

Copy link
Member

@billsacks billsacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes!

Copy link
Contributor

@mnlevy1981 mnlevy1981 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dabail10 was able to sit down with @gold2718 and get this to do what he wants with CICE

@gold2718 gold2718 removed the request for review from mvertens April 26, 2019 02:31
@gold2718 gold2718 merged commit a48558d into ESMCI:master May 15, 2019
@gold2718 gold2718 deleted the submodules branch February 11, 2022 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for "git clone --recursive" to pull in submodules
6 participants