diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2016-05-31 10:49:24 -0400 |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2016-06-29 14:49:19 -0400 |
commit | 89bf5f4045eebdc1f40561dbb70a56e170411c20 (patch) | |
tree | 7d6099471fe3963683ee70630156ab99a8fa632b /lib | |
parent | 7ec191ce0b82827013485a98db84cd66aa2ca1b4 (diff) | |
download | spack-89bf5f4045eebdc1f40561dbb70a56e170411c20.tar.gz spack-89bf5f4045eebdc1f40561dbb70a56e170411c20.tar.bz2 spack-89bf5f4045eebdc1f40561dbb70a56e170411c20.tar.xz spack-89bf5f4045eebdc1f40561dbb70a56e170411c20.zip |
bootstrap: allow using alternate remotes
If you want to bootstrap from a fork, the `--remote` option may be used
to select it.
Also limit the branches to 'develop' and 'master' if the remote is
'origin' since those are the actual integration branches used (other
branches on 'origin' are just PR branches).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/bootstrap.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py index 16808b30b8..3480c96f39 100644 --- a/lib/spack/spack/cmd/bootstrap.py +++ b/lib/spack/spack/cmd/bootstrap.py @@ -36,10 +36,13 @@ _SPACK_UPSTREAM = 'https://github.com/llnl/spack' description = "Create a new installation of spack in another prefix" def setup_parser(subparser): + subparser.add_argument( + '-r', '--remote', action='store', dest='remote', + help="name of the remote to bootstrap from", default='origin') subparser.add_argument('prefix', help="names of prefix where we should install spack") -def get_origin_info(): +def get_origin_info(remote): git_dir = join_path(spack.prefix, '.git') git = which('git', required=True) try: @@ -47,10 +50,14 @@ def get_origin_info(): except ProcessError: branch = 'develop' tty.warn('No branch found; using default branch: %s' % branch) + if remote == 'origin' and \ + branch not in ('master', 'develop'): + branch = 'develop' + tty.warn('Unknown branch found; using default branch: %s' % branch) try: origin_url = git( '--git-dir=%s' % git_dir, - 'config', '--get', 'remote.origin.url', + 'config', '--get', 'remote.%s.url' % remote, output=str) except ProcessError: origin_url = _SPACK_UPSTREAM @@ -60,10 +67,10 @@ def get_origin_info(): def bootstrap(parser, args): - origin_url, branch = get_origin_info() + origin_url, branch = get_origin_info(args.remote) prefix = args.prefix - tty.msg("Fetching spack from origin: %s" % origin_url) + tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url)) if os.path.isfile(prefix): tty.die("There is already a file at %s" % prefix) |