Skip to content

spack edit -b: support specifying build_system repos/namespace#51084

Merged
haampie merged 6 commits intodevelopfrom
bugfix/edit-build-systems-multiple-repos
Aug 18, 2025
Merged

spack edit -b: support specifying build_system repos/namespace#51084
haampie merged 6 commits intodevelopfrom
bugfix/edit-build-systems-multiple-repos

Conversation

@becker33
Copy link
Copy Markdown
Member

Currently, there is no way to use spack edit -b to edit a build system that is not in the highest priority repo. This is a problem for users with multiple repos, as they often use the build systems from builtin.

This PR supports specifying the repo or namespace for a build system passed to spack edit -b.

Things it does not support:

  • autodetecting which repo a builtin comes from
  • specifying different repos for multiple build systems in one spack edit -b command

Those are not supported because they would require more substantial additions to the spack.repo.RepoPath object, and it's dubious whether the usefulness for this command is worth the additional maintenance burden in the code

Includes regression test.

@becker33 becker33 added the v1.0.1 PRs to backport for v1.0.1 label Jul 31, 2025
Signed-off-by: Gregory Becker <[email protected]>
@becker33 becker33 requested review from tgamblin and removed request for tgamblin July 31, 2025 12:43
@haampie haampie requested a review from Copilot August 6, 2025 12:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for specifying repository/namespace when editing build systems with spack edit -b, allowing users to access build systems from repos other than the highest priority one.

  • Removes the ComputeBuildSystemPathAction class and replaces it with simpler logic
  • Updates argument parsing to support repo/namespace specification for build systems
  • Adds a repo_from_args function to determine the appropriate repository based on command arguments

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
lib/spack/spack/cmd/edit.py Main implementation adding repo/namespace support for build systems
lib/spack/spack/repo.py Adds build_systems_path attribute to Repo class
lib/spack/spack/test/cmd/edit.py Regression test for the new functionality
share/spack/spack-completion.fish Updates help text to reflect new fullname support

@alecbcs alecbcs added v1.0.2 PRs / Bug fixes to backport for v1.0.2 and removed v1.0.1 PRs to backport for v1.0.1 labels Aug 11, 2025
@becker33 becker33 requested a review from haampie August 12, 2025 15:21
@haampie
Copy link
Copy Markdown
Member

haampie commented Aug 18, 2025

Those are not supported because they would require more substantial additions to the spack.repo.RepoPath object, and it's dubious whether the usefulness for this command is worth the additional maintenance burden in the code

I'm not really sure this PR is much of an improvement to develop, cause it's really annoying to use:

  • spack edit --build-system cmake errors because cmake.py doesn't exist in my custom repo, which does not even have a build_systems dir, and is very unlikely to have a build system at all
  • spack edit --repo builtin --build-system cmake errors because --repo accepts only a path, even though Spack knows both that builtin does not exist as a relative path and that builtin is a configured repo namespace

at this point I would have just run find.

(also, you just somehow have to know what the name of a build system is, in this case cmake, which is not discoverable other than scanning the file names)

@haampie haampie merged commit 4b8c539 into develop Aug 18, 2025
32 of 33 checks passed
@haampie haampie deleted the bugfix/edit-build-systems-multiple-repos branch August 18, 2025 12:54
@alalazo alalazo mentioned this pull request Aug 22, 2025
26 tasks
alalazo pushed a commit that referenced this pull request Aug 22, 2025
alalazo pushed a commit that referenced this pull request Aug 22, 2025
alalazo pushed a commit that referenced this pull request Aug 22, 2025
haampie pushed a commit that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0.2 PRs / Bug fixes to backport for v1.0.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants