profile: introduce --regex and --all#10166
Merged
edolstra merged 9 commits intoNixOS:masterfrom Mar 8, 2024
Merged
Conversation
3b3e8f2 to
45faa26
Compare
iFreilicht
reviewed
Mar 6, 2024
b888b35 to
d4a1254
Compare
Member
Author
|
@iFreilicht Thanks for the quick look! Already helps a lot 👍
It took some time to figure out where the release notes reside. I think I've found it. |
edolstra
approved these changes
Mar 7, 2024
d4a1254 to
42247c3
Compare
Currently there isn't a convenient way to check for multiline output. In addition, these outputs will easily change and having a diff between the expected an the actual output upon failures is convenient.
8dddd2a to
49b86b0
Compare
Member
Author
|
Thanks for the reviews! Since the |
edolstra
reviewed
Mar 8, 2024
49b86b0 to
3d628d1
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently
nix profile upgradeandnix profile removeboth implicitly allow using regex by default. This usually works like matching normal package names, but sometimes works slightly different.Related, the documentation mentions using
nix profile upgrade '.*'to upgrade all packages. However, as #7487 shows, this doesn't work for store-path installed packages. Question is: should we also regex-match on store paths? I think this can lead to unintended matching of hashes. So, probably not.Since most people will likely use the arguments as full names of packages, instead of regex, I thought I'd make this explicit:
nix profile upgrade vimnix profile upgrade --regex '.*vim.*'nix profile upgrade --allnix profile upgrade /nix/store/...-vim-2.0Same goes for remove:
nix profile remove vimnix profile remove --regex '.*vim.*'nix profile remove --allnix profile remove /nix/store/...-vim-2.0Although minor, this also avoids issues like
python3.1matchingpython311andpython310. Also minor: it avoids running into reserved regex characters, as #3530 describes.Implementation
I've restructured the matching of packages a bit, so that it uses a generic matcher type with variants
Name,StorePath,RegexandAllmatchers.I've also introduced
assertStderrin the functional test functions, so that it is easier to compare stderr output against expected output.Context
Fixes #7487
Fixes #10162
Related: #7962
Fixes regex issue, but for
nix profile: #3530Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.