-
-
Notifications
You must be signed in to change notification settings - Fork 28
Match asset names with regex before os/arch/other filterings occur #122
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
Conversation
|
Hi, thanks for your PR! I'm pretty finicky about my projects (see this blog post for details), so I rarely merge a PR as-is. I can move forward on your PR in one of two ways:
Please let me know which approach you'd prefer. If I don't hear from you before I get around to working on this PR I'll go with option 1. Thanks again for your contribution! |
autarch
left a comment
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.
This looks good overall. I think this also needs a test for the case where the regex doesn't match, to make sure it returns the expected error.
Also, it'd be good to add an integration test in ubi-cli/tests/ubi.rs.
Thanks again!
|
Thanks for your thorough review! I applied the suggested changes in a new commit and am adding a test case for situations where a pattern yields no matches. Please don't hesitate to make any changes to my branch. |
|
I have also added an integration test. All tests are passing on my machine. Let me know if any other changes are needed. |
|
I think this is nearly ready to merge, so ... Hi, thanks for your PR! I'm pretty finicky about my projects (see this blog post for details), so I rarely merge a PR as-is. I can move forward on your PR in one of two ways:
Please let me know which approach you'd prefer. If I don't hear from you before I get around to working on this PR I'll go with option 1. Thanks again for your contribution! |
I prefer to go with 2. |
|
Doh, sorry, I forgot I'd already asked. |
|
Merged, thanks! |
I had matching_regex landed on UBI in houseabsolute/ubi#122. This change enables passing the option from the mise config to the backend. Closes #5318 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
I am from #75 and #99, and found out that there's no traction yet, so I started it. I placed a regex-based matcher after validating for recognized archive formats and before OS/arch/other filterings occur. If the regex patterns yield multiple matches, the assets are propagated to the existing filtering mechanisms. Otherwise, if there's only one match, it is selected directly for downloading.
It might sound confusing, but the difference from the existing matching string is that the former is intended for disambiguation, while the new addition is used for shortlisting or arbitrarily selecting the exact release.
The limitation is that the regex crate does not support negative lookahead (rust-lang/regex#127) to exclude names matching negative patterns. Nevertheless, this remains helpful to exclude unwanted packages like *-debug-info.tar.gz on https://github.com/shader-slang/slang. The same is for #99 (comment). The following command demonstrates excluding packages with debug-info, while relying on os/arch filters to select the final package.
For #75, the wanted archive can be selected with
\w+-\d\.\d\.\d\.zip.