Skip to content

Latest commit

 

History

History
175 lines (130 loc) · 5.33 KB

Helpers.md

File metadata and controls

175 lines (130 loc) · 5.33 KB

Helper commands

Cloning repositories to develop

MPD supports cloning read-only git repositories into a selected project's source directory. The help message for the spack mpd git-clone command is:

$ spack mpd git-clone -h
usage: spack mpd git-clone [-h] [--suites <suite name> [<suite name> ...]] [--fork | --help-repos | --help-suites]
                           [<repo spec> ...]

clone git repositories for development

positional arguments:
  <repo spec>           a specification of a repository to clone. The repo spec may either be:
                        (a) any repository name listed by the --help-repos option, or
                        (b) any URL to a Git repository.

optional arguments:
  --fork                fork GitHub repository or set origin to already forked repository
  --help-repos          list supported repositories
  --help-suites         list supported suites
  --suites <suite name> [<suite name> ...]
                        clone repositories corresponding to the given suite name (multiple allowed)
  -h, --help            show this help message and exit

A repo spec can be:

  • any repository name listed by the spack mpd --help-repos option, or
  • any URL to a Git repository.

Warning

When using spack mpd git-clone <repository name>, the cloned repository will be read-only (i.e. no pushes allowed to the remote repository). Users who would like to clone repositories with write permissions should use the corresponding repository URL (e.g. spack mpd git-clone git@github.com/Org/RepoName.git).

After cloning any repositories into your selected project's source directory, be sure to refresh the project (spack mpd refresh), which will recreate the Spack environment to reflect the changes.

Listing projects

You can list the existing MPD projects by invoking spack mpd list:

$ spack mpd list -h
usage: spack mpd list [-h] [-t <project name> | -b <project name> | -s <project name>] [<project name> ...]

list MPD projects

When no arguments are specified, prints a list of existing MPD projects
and the status of their corresponding Spack environments.

positional arguments:
  <project name>        print details of the MPD project

optional arguments:
  -b <project name>, --build <project name>
                        print build-level directory for project
  -h, --help            show this help message and exit
  -s <project name>, --source <project name>
                        print source-level directory for project
  -t <project name>, --top <project name>
                        print top-level directory for project

As stated in the help text, invoking spack mpd list with no options prints a table of existing projects with the status of their corresponding environments:

$ spack mpd ls

==> Existing MPD projects:

   Project name    Environment    Deployed environment
   ------------    -----------    --------------------
   meld-devel      installed      (none)
 ▶ test            installed      (none)

The right-pointing triangle denotes the selected project for the shell session. Projects with a preceding left-pointing triangle indicate projects that are active in other shell sessions:

$ spack mpd ls

==> Existing MPD projects:

   Project name    Environment    Deployed environment
   ------------    -----------    --------------------
   meld-devel      installed      (none)
 ◀ test            installed      (none)

This can be helpful in determining whether you should select a project in your current shell session, or whether you should find the shell with the project that's already selected. Having two or more shell sessions with the same project selected can lead to one shell overwriting another.

If two or more shells have selected the same MPD project, a warning will be printed to the screen:

$ spack mpd ls

==> Existing MPD projects:

   Project name    Environment    Deployed environment
   ------------    -----------    --------------------
   meld-devel      installed      (none)
 ▶ test            installed      (none)               Warning: used by more than one shell

Destroying (or invoking spack mpd clear) on all but one of those shells will remove the warning.

Listing project details

Details of a specific project will be printed to the screen if the project name is provided as a positional argument:

$ spack mpd list test

==> Details for test

name: test
top: /scratch/knoepfel/test-devel
source: /scratch/knoepfel/test-devel/srcs
build: /scratch/knoepfel/test-devel/build
local: /scratch/knoepfel/test-devel/local
install: /scratch/knoepfel/test-devel/local/install
envs:
- gcc-13-2-0
packages:
- cetlib
- cetlib-except
- hep-concurrency
compiler: gcc@13.2.0
cxxstd: '20'
variants: ''
status: installed

Listing project directories

Sometimes it is helpful for just the path of one of the project's directories to be printed:

$ spack mpd list --source test
/scratch/knoepfel/test-devel/srcs
$ cd $(spack mpd ls --source test)
(Now in test source directory)

This is particularly convenient when logging in to the system and wanting to begin development immediately:

$ spack env activate test
(Spack environment test now active; MPD project test now selected)
$ cd $(spack mpd list --build test)
(Now in test build directory)
$ ninja