Skip to content
Open
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
6 changes: 6 additions & 0 deletions subspack/cmd/subspack.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def setup_parser(subparser):
default=False,
help="update extension repositories from their upstreams' origins",
)
subparser.add_argument(
"--local-bootstrap",
action="store_true",
default=False,
help="Do not share spack bootstrap area with upstream",
)


def subspack(parser, args):
Expand Down
21 changes: 15 additions & 6 deletions subspack/subspack.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def make_subspack(args):


def add_upstream_origin(src, dest):
"""if the upstream repository at src has an "origin", add it to the repostory at dest as "upstream_origin" """
"""if the upstream repository at src has an "origin", add it to the repostory and make the current origin "upstream" """
path = None
git = spack.util.git.git(required=True)
with fs.working_dir(src):
Expand All @@ -61,7 +61,8 @@ def add_upstream_origin(src, dest):
break
if path:
with fs.working_dir(dest):
git("remote", "add", "upstream_origin", path)
git("remote", "rename", "origin", "upstream")
git("remote", "add", "origin", path)
return path


Expand Down Expand Up @@ -159,7 +160,10 @@ def quick_clone_repos(prefix, args):
for repo_name in roots:
tty.debug(f"repo {repo_name}")
tty.debug(f"roots[repo_name] is {repr(roots[repo_name])}")
branch = roots[repo_name]["branch"]
if "branch" in roots[repo_name]:
branch = roots[repo_name].get("branch", "main")
else:
branch = "main"
base = repo_name
if isinstance(roots[repo_name], dict):
dest = roots[repo_name]["destination"]
Expand Down Expand Up @@ -195,6 +199,8 @@ def quick_clone_repos(prefix, args):

else:
tty.debug(f"symlinking {src} to {dest}")
if not os.path.exists(os.path.dirname(dest)):
os.makedirs(os.path.dirname(dest))
# non-git repo, and not already there, symlink it?
os.symlink(src, dest)
else:
Expand Down Expand Up @@ -319,9 +325,12 @@ def clone_various_configs(prefix, args):
if not os.path.isdir(basedir):
os.mkdir(basedir)

root = spack.config.get("bootstrap:root", default=None)
if root:
root = spack.util.path.canonicalize_path(root)
if args.local_bootstrap:
root = f"{prefix}/var/spack/.bootstrap"
else:
root = spack.config.get("bootstrap:root", default=None)
if root:
root = spack.util.path.canonicalize_path(root)

with tmp_env("SPACK_ROOT", prefix):
os.system(f"{prefix}/bin/spack bootstrap root {root} > /dev/null")
Expand Down