Skip to content

spack repo remove: allow removing from unspecified scope#51563

Merged
alecbcs merged 8 commits intodevelopfrom
bugfix/repo-rm-scope
Nov 25, 2025
Merged

spack repo remove: allow removing from unspecified scope#51563
alecbcs merged 8 commits intodevelopfrom
bugfix/repo-rm-scope

Conversation

@becker33
Copy link
Copy Markdown
Member

@becker33 becker33 commented Nov 12, 2025

Currently, the following fails:

spack repo add --scope spack /path/to/repo
spack repo rm /path/to/repo

It fails because the spack repo remove command requires a scope to remove from, and assumes --scope user if unspecified.

This PR changes this to remove the matching repo from any scope if the scope is unspecified. Because portions of the repo could be defined at different config levels, it removes the specified repo from every scope. Removing from a specific scope is still supported, using the --scope argument.

The analogous bug exists and is fixed in the analogous manner for spack mirror remove in this PR as well.

Includes tests.

@alecbcs
Copy link
Copy Markdown
Member

alecbcs commented Nov 17, 2025

We might want to warn users if the same repo exists from multiple config scopes. The current functionality wipes out the corresponding repository name from all scopes without any confirmation.

> spack repo add --scope spack --name test /path/to/repo
> spack repo add --scope user --name test /path/to/repo
> spack repo rm /path/to/repo

> spack repo rm tutorial
==> Removed repository 'test' from scope 'spack'.
==> Removed repository 'test' from scope 'user'.

Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
@becker33
Copy link
Copy Markdown
Member Author

Summarizing conversation that we had offline:

The behavior that @alecbcs noticed was intentional. This was designed to work on repos that have e.g. their destination configured in one scope and their git location configured in another scope.

spack repo rm test
$ spack repo list
...
[+] test

This seems like non-ideal behvior as well.

We are going to take this offline and try to have a conversatoin with more devs and figure out what is the least confusing way to handle this. We briefly considered spack repo rm --all test but rejected it for implying that we should remove all repos.

alecbcs
alecbcs previously approved these changes Nov 24, 2025
Copy link
Copy Markdown
Member

@alecbcs alecbcs left a comment

Choose a reason for hiding this comment

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

One nitpick, otherwise looks good to me.

@alecbcs alecbcs self-assigned this Nov 24, 2025
Signed-off-by: Gregory Becker <[email protected]>
@alecbcs alecbcs enabled auto-merge (squash) November 24, 2025 22:56
@alecbcs alecbcs merged commit c116bbd into develop Nov 25, 2025
31 of 32 checks passed
@alecbcs alecbcs deleted the bugfix/repo-rm-scope branch November 25, 2025 00:22
@becker33 becker33 added the v1.0.3 PRs to backport for v1.0.3 label Nov 25, 2025
psakievich pushed a commit to psakievich/spack that referenced this pull request Dec 1, 2025
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
hippo91 pushed a commit to hippo91/spack that referenced this pull request Dec 1, 2025
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Jan 10, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
@becker33 becker33 mentioned this pull request Jan 10, 2026
2 tasks
becker33 added a commit that referenced this pull request Jan 11, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Jan 15, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
vjranagit pushed a commit to vjranagit/spack that referenced this pull request Jan 18, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Jan 22, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Jan 26, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
@becker33 becker33 mentioned this pull request Feb 2, 2026
becker33 added a commit that referenced this pull request Feb 2, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Feb 2, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
becker33 added a commit that referenced this pull request Feb 19, 2026
* spack repo rm: remove from all scopes when none provided

Signed-off-by: Gregory Becker <[email protected]>

* unit test for repo removal from unspecified scope

Signed-off-by: Gregory Becker <[email protected]>

* cleanup unit test

Signed-off-by: Gregory Becker <[email protected]>

* apply same fix to mirrors

Signed-off-by: Gregory Becker <[email protected]>

* style

Signed-off-by: Gregory Becker <[email protected]>

* remove from top scope with option for all scopes

Signed-off-by: Gregory Becker <[email protected]>

* update_completions

Signed-off-by: Gregory Becker <[email protected]>

* move tty usage to cmd

Signed-off-by: Gregory Becker <[email protected]>

---------

Signed-off-by: Gregory Becker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0.3 PRs to backport for v1.0.3 v1.1.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants