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

Remove manage externals #2443

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# directories checked out by manage_externals, and other files created
# by manage_externals
manage_externals.log
ccs_config
/src/fates/
/cime/
/components/
/libraries/
/share/
/doc/doc-builder/

# ignore svn directories
**/.svn/**
.svn/

# netcdf files
*.nc
# but don't ignore netcdf files here:
Expand Down
97 changes: 97 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[submodule "fates"]
path = src/fates
url = https://github.com/rgknox/fates
fxtag = sci.1.72.2_api.34.0.0
fxDONOTUSEurl = https://github.com/rgknox/fates
fxrequired = AlwaysRequired

[submodule "cism"]
path = components/cism
url = https://github.com/ESCOMP/CISM-wrapper
fxtag = cismwrap_2_1_97
fxDONOTUSEurl = https://github.com/ESCOMP/CISM-wrapper
fxrequired = ToplevelRequired

[submodule "rtm"]
path = components/rtm
url = https://github.com/ESCOMP/RTM
fxtag = rtm1_0_79
fxDONOTUSEurl = https://github.com/ESCOMP/RTM
fxrequired = ToplevelRequired

[submodule "mosart"]
path = components/mosart
url = https://github.com/ESCOMP/MOSART
fxtag = mosart1_0_49
fxDONOTUSEurl = https://github.com/ESCOMP/MOSART
fxrequired = ToplevelRequired

[submodule "mizuRoute"]
path = components/mizuRoute
url = https://github.com/nmizukami/mizuRoute
fxtag = 34723c2
fxDONOTUSEurl = https://github.com/nmizukami/mizuRoute
fxrequired = ToplevelRequired

[submodule "ccs_config"]
path = ccs_config
url = https://github.com/ESMCI/ccs_config_cesm.git
fxtag = ccs_config_cesm0.0.92
fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git
fxrequired = ToplevelRequired

[submodule "cime"]
path = cime
url = https://github.com/ESMCI/cime
fxtag = cime6.0.217_httpsbranch03
fxDONOTUSEurl = https://github.com/ESMCI/cime
fxrequired = ToplevelRequired

[submodule "cmeps"]
path = components/cmeps
url = https://github.com/ESCOMP/CMEPS.git
fxtag = cmeps0.14.50
fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git
fxrequired = ToplevelRequired

[submodule "cdeps"]
path = components/cdeps
url = https://github.com/jedwards4b/CDEPS.git
fxtag = rme/cdeps1.0.28
fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git
fxrequired = ToplevelRequired

[submodule "cpl7"]
path = components/cpl7
url = https://github.com/ESCOMP/CESM_CPL7andDataComps
fxtag = cpl77.0.7
fxDONOTUSEurl = https://github.com/ESCOMP/CESM_CPL7andDataComps
fxrequired = ToplevelRequired

[submodule "share"]
path = share
url = https://github.com/ESCOMP/CESM_share
fxtag = share1.0.18
fxDONOTUSEurl = https://github.com/ESCOMP/CESM_share
fxrequired = ToplevelRequired

[submodule "mct"]
path = libraries/mct
url = https://github.com/MCSclimate/MCT
fxtag = MCT_2.11.0
fxDONOTUSEurl = https://github.com/MCSclimate/MCT
fxrequired = ToplevelRequired

[submodule "parallelio"]
path = libraries/parallelio
url = https://github.com/NCAR/ParallelIO
fxtag = pio2_6_2
fxDONOTUSEurl = https://github.com/NCAR/ParallelIO
fxrequired = ToplevelRequired

[submodule "doc-builder"]
path = doc/doc-builder
url = https://github.com/ESMCI/doc-builder
fxDONOTUSEurl = https://github.com/ESMCI/doc-builder
fxrequired = ToplevelOptional
fxtag = v1.0.8
13 changes: 13 additions & 0 deletions .lib/git-fleximod/.github/workflows/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: pre-commit
on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
77 changes: 77 additions & 0 deletions .lib/git-fleximod/.github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Run this job on pushes to `main`, and for pull requests. If you don't specify
# `branches: [main], then this actions runs _twice_ on pull requests, which is
# annoying.

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# If you wanted to use multiple Python versions, you'd have specify a matrix in the job and
# reference the matrixe python version here.
- uses: actions/setup-python@v5
with:
python-version: '3.9'

# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
# manually if/when you want to upgrade Poetry, or if something goes wrong. This could be
# mildly cleaner by using an environment variable, but I don't really care.
- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1.7.1

# Install Poetry. You could do this manually, or there are several actions that do this.
# `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
# Poetry's default install script, which feels correct. I pin the Poetry version here
# because Poetry does occasionally change APIs between versions and I don't want my
# actions to break if it does.
#
# The key configuration value here is `virtualenvs-in-project: true`: this creates the
# venv as a `.venv` in your testing directory, which allows the next step to easily
# cache it.
- uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true

# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache
# key: if you're using multiple Python versions, or multiple OSes, you'd need to include
# them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock.
- name: cache deps
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

# Install dependencies. `--no-root` means "install all dependencies but not the project
# itself", which is what you want to avoid caching _your_ code. The `if` statement
# ensures this only runs on a cache miss.
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

# Now install _your_ project. This isn't necessary for many types of projects -- particularly
# things like Django apps don't need this. But it's a good idea since it fully-exercises the
# pyproject.toml and makes that if you add things like console-scripts at some point that
# they'll be installed and working.
- run: poetry install --no-interaction

# And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml`
# so this line is super-simple. But it could be as complex as you need.
- run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
poetry run pytest

18 changes: 18 additions & 0 deletions .lib/git-fleximod/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
exclude: ^utils/.*$

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/pylint
rev: v2.11.1
hooks:
- id: pylint
args:
- --disable=I,C,R,logging-not-lazy,wildcard-import,unused-wildcard-import,fixme,broad-except,bare-except,eval-used,exec-used,global-statement,logging-format-interpolation,no-name-in-module,arguments-renamed,unspecified-encoding,protected-access,import-error,no-member
20 changes: 20 additions & 0 deletions .lib/git-fleximod/License
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2024 National Center for Atmospheric Sciences (NCAR)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
110 changes: 110 additions & 0 deletions .lib/git-fleximod/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# git-fleximod

Flexible, Enhanced Submodule Management for Git

## Overview

Git-fleximod is a Python-based tool that extends Git's submodule and sparse checkout capabilities, offering additional features for managing submodules in a more flexible and efficient way.

## Installation

#TODO Install using pip:
# pip install git-fleximod
If you choose to locate git-fleximod in your path you can access it via command: git fleximod

## Usage

Basic Usage:
git fleximod <command> [options]
Available Commands:
status: Display the status of submodules.
update: Update submodules to the tag indicated in .gitmodules variable fxtag.
test: Make sure that fxtags and submodule hashes are consistant,
make sure that official urls (as defined by fxurl) are set
make sure that fxtags are defined for all submodules
Additional Options:
See git fleximod --help for more details.

## Supported .gitmodules Variables

fxtag: Specify a specific tag or branch to checkout for a submodule.
fxrequired: Mark a submodule's checkout behavior, with allowed values:
- ToplevelRequired: Top-level and required (checked out only when this is the Toplevel module).
- ToplevelOptional: Top-level and optional (checked out with --optional flag if this is the Toplevel module).
- AlwaysRequired: Always required (always checked out).
- AlwaysOptional: Always optional (checked out with --optional flag).
fxsparse: Enable sparse checkout for a submodule, pointing to a file containing sparse checkout paths.
fxurl: This is the url used in the test subcommand to assure that protected branches do not point to forks
**NOTE** the fxurl variable is only used to identify the official project repository and should not be
changed by users. Use the url variable to change to a fork if desired.

## Sparse Checkouts

To enable sparse checkout for a submodule, set the fxsparse variable
in the .gitmodules file to the path of a file containing the desired
sparse checkout paths. Git-fleximod will automatically configure
sparse checkout based on this file when applicable commands are run.
See [git-sparse-checkout](https://git-scm.com/docs/git-sparse-checkout#_internalsfull_pattern_set)
for details on the format of this file.

## Tests

The git fleximod test action is designed to be used by, for example, github workflows
to assure that protected branches are consistant with respect to submodule hashes and fleximod fxtags

## Examples

Here are some common usage examples:

Update all submodules, including optional ones:
```bash
git fleximod update --optional
```

Updating a specific submodule to the fxtag indicated in .gitmodules:

```bash
git fleximod update submodule-name
```
Example .gitmodules entry:
```ini, toml
[submodule "cosp2"]
path = src/physics/cosp2/src
url = https://github.com/CFMIP/COSPv2.0
fxsparse = ../.cosp_sparse_checkout
fxrequired = AlwaysRequired
fxtag = v2.1.4cesm
```
Explanation:

This entry indicates that the submodule named cosp2 at tag v2.1.4cesm
should be checked out into the directory src/physics/cosp2/src
relative to the .gitmodules directory. It should be checked out from
the URL https://github.com/CFMIP/COSPv2.0 and use sparse checkout as
described in the file ../.cosp_sparse_checkout relative to the path
directory. It should be checked out anytime this .gitmodules entry is
read.

Additional example:
```ini, toml
[submodule "cime"]
path = cime
url = https://github.com/jedwards4b/cime
fxrequired = ToplevelRequired
fxtag = cime6.0.198_rme01
```

Explanation:

This entry indicates that the submodule cime should be checked out
into a directory named cime at tag cime6.0.198_rme01 from the URL
https://github.com/jedwards4b/cime. This should only be done if
the .gitmodules file is at the top level of the repository clone.

## Contributing

We welcome contributions! Please see the CONTRIBUTING.md file for guidelines.

## License

Git-fleximod is released under the MIT License.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = ManageExternals
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

Expand All @@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading
Loading