Skip to content
Merged
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
103 changes: 48 additions & 55 deletions uberenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,61 +858,6 @@ def clone_repo(self):
print("[ERROR: Git failed to pull]")
sys.exit(-1)

# Move and checkout Spack builtin package repository if not included in Spack repo
if not os.path.exists(pjoin(self.dest_spack, "var", "spack", "repos", "builtin")):
packages_repo = pjoin(self.dest_dir, "builtin_spack_packages_repo")

print(f"[info: moving spack builtin package repository to {packages_repo}]")
spack_repo_set_cmd = f"{self.spack_exe(use_spack_env=False)} repo set --destination {packages_repo} builtin"
res = sexe(spack_repo_set_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to set builtin package repository destination]")
sys.exit(-1)

# Optionally, check out Spack's builtin package repo to a specific commit/branch/tag
if "spack_packages_url" in self.project_args:
spack_repo_remove_cmd = f"{self.spack_exe(use_spack_env=False)} repo remove builtin"
res = sexe(spack_repo_remove_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to remove builtin package repository so it could be re-added with given URL]")
sys.exit(-1)

# Now add it back with the correct url
url = self.project_args["spack_packages_url"]
spack_repo_add_cmd = f"{self.spack_exe(use_spack_env=False)} repo add --name builtin {url}"
res = sexe(spack_repo_add_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to add builtin package repository with given URL]")
sys.exit(-1)

# Optionally, check out Spack's builtin package repo to a specific commit/branch/tag
if "spack_packages_commit" in self.project_args:
sha1 = self.project_args["spack_packages_commit"]

spack_repo_update_cmd = f"{self.spack_exe(use_spack_env=False)} repo update --commit {sha1} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git commit for builtin package repository]")
sys.exit(-1)
elif "spack_packages_branch" in self.project_args:
branch = self.project_args["spack_packages_branch"]

spack_repo_update_cmd = f"{self.spack_exe(use_spack_env=False)} repo update --branch {branch} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git branch for builtin package repository]")
sys.exit(-1)
elif "spack_packages_tag" in self.project_args:
tag = self.project_args["spack_packages_tag"]

spack_repo_update_cmd = f"{self.spack_exe(use_spack_env=False)} repo update --tag {tag} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git tag for builtin package repository]")
sys.exit(-1)
else:
print("[info: User did not specify any `spack_packages_*` override, Spack will pull the default ref of spack-packages]")


def disable_spack_config_scopes(self):
# disables all config scopes except "defaults", which we will
Expand Down Expand Up @@ -969,6 +914,54 @@ def create_spack_env(self):
print("[ERROR: Failed to create Spack Environment]")
sys.exit(-1)

# Move and checkout Spack builtin package repository if not included in Spack repo
if not os.path.exists(pjoin(self.dest_spack, "var", "spack", "repos", "builtin")):
packages_repo = pjoin(self.dest_dir, "builtin_spack_packages_repo")

# Optionally, check out Spack's builtin package repo to a specific commit/branch/tag
if "spack_packages_url" in self.project_args:
url = self.project_args["spack_packages_url"]
spack_repo_add_cmd = f"{self.spack_exe()} repo add --name builtin {url}"
Copy link
Member

Choose a reason for hiding this comment

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

Is it required to remove the existing builtin before we add it?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i would be curious to know as well. when i tried to remove it, i was getting an error that it doesn't exist. i tried both in the environment (-D spack_env) and without.

Copy link
Member

Choose a reason for hiding this comment

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

@chapman39 what's the output of the following for you in the environment where you're getting the error that builtin doesn't exist?

$ spack debug report
$ spack config get repos

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it does appear to be there but won't let me delete it unless i set its destination.

[exe: git -c http.sslVerify=false  clone --single-branch --depth=1 -b develop https://github.com/spack/spack.git spack]
Cloning into 'spack'...
Updating files: 100% (1734/1734), done.
[info: using spack commit 734c5db2121b01c373eed6538e452f18887e9e44]
[exe: git stash]
No local changes to save
[exe: git fetch --depth=1 origin 734c5db2121b01c373eed6538e452f18887e9e44]
From https://github.com/spack/spack
 * branch            734c5db2121b01c373eed6538e452f18887e9e44 -> FETCH_HEAD
[exe: git checkout 734c5db2121b01c373eed6538e452f18887e9e44]
Note: switching to '734c5db2121b01c373eed6538e452f18887e9e44'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 734c5db Set the version to v1.0.2
[exe: /usr/WS2/meemee/serac/serac_tpls/toss_4_x86_64_ib_cray/2025_10_15_13_22_49/spack/bin/spack repo remove builtin]
==> Error: No repository with path or namespace: builtin
[ERROR: Failed to remove builtin package repository so it could be re-added with given URL]
[exe: /usr/WS2/meemee/serac/serac_tpls/toss_4_x86_64_ib_cray/2025_10_15_13_22_49/spack/bin/spack debug report]
* **Spack:** 1.0.2 (https://github.com/spack/spack/commit/734c5db2121b01c373eed6538e452f18887e9e44)
* **Builtin repo:** https://github.com/spack/spack-packages/commit/a75a7f75182ffc7a51c6ca7f0fec4bf9b2705be8
* **Python:** 3.9.12
* **Platform:** linux-rhel8-zen4
[exe: /usr/WS2/meemee/serac/serac_tpls/toss_4_x86_64_ib_cray/2025_10_15_13_22_49/spack/bin/spack config get repos]
repos:
  builtin:
    git: https://github.com/spack/spack-packages.git
    branch: releases/v2025.07

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alecbcs let me know if there's anything else i should try

Copy link
Member

Choose a reason for hiding this comment

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

@becker33 since you are back... we have been having a hard time getting this right and keep hitting odd behavior between people. Could you give advice on this?

res = sexe(spack_repo_add_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to add builtin package repository with given URL]")
sys.exit(-1)

print(f"[info: moving spack builtin package repository to {packages_repo}]")
spack_repo_set_cmd = f"{self.spack_exe()} repo set --destination {packages_repo} builtin"
res = sexe(spack_repo_set_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to set builtin package repository destination]")
sys.exit(-1)

# Optionally, check out Spack's builtin package repo to a specific commit/branch/tag
if "spack_packages_commit" in self.project_args:
sha1 = self.project_args["spack_packages_commit"]

spack_repo_update_cmd = f"{self.spack_exe()} repo update --commit {sha1} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git commit for builtin package repository]")
sys.exit(-1)
elif "spack_packages_branch" in self.project_args:
branch = self.project_args["spack_packages_branch"]

spack_repo_update_cmd = f"{self.spack_exe()} repo update --branch {branch} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git branch for builtin package repository]")
sys.exit(-1)
elif "spack_packages_tag" in self.project_args:
tag = self.project_args["spack_packages_tag"]

spack_repo_update_cmd = f"{self.spack_exe()} repo update --tag {tag} builtin"
res = sexe(spack_repo_update_cmd, echo=True)
if res != 0:
print("[ERROR: Failed to update git tag for builtin package repository]")
sys.exit(-1)
else:
print("[info: User did not specify any `spack_packages_*` override, Spack will pull the default ref of spack-packages]")

spack_pkg_keys = ("spack_packages_commit", "spack_packages_branch", "spack_packages_tag")
if any(key in self.project_args for key in spack_pkg_keys):
# Check if environment specifies alternate builtin packages repository
Expand Down