-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
profile: introduce --regex and --all #10166
Conversation
3b3e8f2
to
45faa26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only had a quick look for now, but so far it looks good. I'll have a closer look in the coming days, if nobody else beats me to it.
Also don't forget to add release notes!
b888b35
to
d4a1254
Compare
@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. |
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
Thanks for the reviews! Since the |
49b86b0
to
3d628d1
Compare
Motivation
Currently
nix profile upgrade
andnix profile remove
both 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 vim
nix profile upgrade --regex '.*vim.*'
nix profile upgrade --all
nix profile upgrade /nix/store/...-vim-2.0
Same goes for remove:
nix profile remove vim
nix profile remove --regex '.*vim.*'
nix profile remove --all
nix profile remove /nix/store/...-vim-2.0
Although minor, this also avoids issues like
python3.1
matchingpython311
andpython310
. 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
,Regex
andAll
matchers.I've also introduced
assertStderr
in 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.