-
Notifications
You must be signed in to change notification settings - Fork 697
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
Multi-dot globbing #5372
Multi-dot globbing #5372
Conversation
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.
LGTM modulo minor comments.
Cabal/ChangeLog.md
Outdated
@@ -34,6 +34,12 @@ | |||
* `install-includes` now works as expected with foreign libraries | |||
([#5302](https://github.com/haskell/cabal/issues/5299)). | |||
* Removed support for JHC. | |||
* With `cabal-version: 3.0`, globs can now match only a suffix of |
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.
globs can now match only a suffix of extensions.
I'd reword this slightly: "when matching a wildcard plus extension, we no longer require the full extension to match exactly. For example, the *.gz
glob pattern will now match foo.tar.gz
and *.html
will match foo.en.html
."
let (candidateBase, candidateExts) = splitExtensions (last $ seg:segs) | ||
in ext == candidateExts && not (null candidateBase) | ||
FinalMatch NonRecursive ext -> | ||
guard (not (null candidateBase)) |
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.
So *.html
won't match .foo.html
. Makes sense, since that's how it works in shell, but we should document it.
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.
Already taken care of in d6b829d. As noted in that commit, this is the 2.2 behaviour.
a9b819e
to
e2cd782
Compare
Thanks! Rebased and squashed for tidiness and should be ready to merge, but I'll let it sit for a few days to see if anyone else spots anything that needs changing before the big green button gets pressed. |
Now `cabal check` will produce marked output and won't wrap lines if you don't tell it to.
This has the effect of allowing a glob `*.html` to match the file `foo.en.html`. For compatibility, this is only allowed with `cabal-version: 3.0` or later; for earlier spec versions, a warning will be generated by `cabal check` if there are files affected by this change in behaviour. Fixes haskell#5057. Fixes haskell#784. Closes haskell#5061.
Previously, we were checking the package with a hard-coded root directory of ".". This was not a problem before, but with haskell#5372 we have started to expand globs while checking packages, which breaks if the CWD is not the directory containing the `.cabal` file and causes snowleopard/hadrian#634. Luckily, this is an easy fix: the correct directory is easy to determine. Writing a test and making sure it's tickling the failing case took longer than writing the fix! "." is hard-coded as the root directory passed to `checkPackageFiles` in a few other places, but those are (a) non-trivial to test, and (b) already in places that have other assumptions about their CWD, so I have simply documented the CWD requirement for those.
Previously, we were checking the package with a hard-coded root directory of ".". This was not a problem before, but with haskell#5372 we have started to expand globs while checking packages, which breaks if the CWD is not the directory containing the `.cabal` file and causes snowleopard/hadrian#634. Luckily, this is an easy fix: the correct directory is easy to determine. Writing a test and making sure it's tickling the failing case took longer than writing the fix! "." is hard-coded as the root directory passed to `checkPackageFiles` in a few other places, but those are (a) non-trivial to test, and (b) already in places that have other assumptions about their CWD, so I have simply documented the CWD requirement for those.
Previously, we were checking the package with a hard-coded root directory of ".". This was not a problem before, but with haskell#5372 we have started to expand globs while checking packages, which breaks if the CWD is not the directory containing the `.cabal` file and causes snowleopard/hadrian#634. Luckily, this is an easy fix: the correct directory is easy to determine. Writing a test and making sure it's tickling the failing case took longer than writing the fix! "." is hard-coded as the root directory passed to `checkPackageFiles` in a few other places, but those are (a) non-trivial to test, and (b) already in places that have other assumptions about their CWD, so I have simply documented the CWD requirement for those.
This has been a problem since haskell#5372 began expanding globs in `cabal check`. Now the logic of running a glob is separated from the parsing, giving the caller the opportunity to handle parsing failures flexibly.
This has been a problem since haskell#5372 began expanding globs in `cabal check`. Now the logic of running a glob is separated from the parsing, giving the caller the opportunity to handle parsing failures flexibly.
Previously, we were checking the package with a hard-coded root directory of ".". This was not a problem before, but with #5372 we have started to expand globs while checking packages, which breaks if the CWD is not the directory containing the `.cabal` file and causes snowleopard/hadrian#634. Luckily, this is an easy fix: the correct directory is easy to determine. Writing a test and making sure it's tickling the failing case took longer than writing the fix! "." is hard-coded as the root directory passed to `checkPackageFiles` in a few other places, but those are (a) non-trivial to test, and (b) already in places that have other assumptions about their CWD, so I have simply documented the CWD requirement for those.
This has been a problem since haskell#5372 began expanding globs in `cabal check`. Now the logic of running a glob is separated from the parsing, giving the caller the opportunity to handle parsing failures flexibly.
This has been a problem since #5372 began expanding globs in `cabal check`. Now the logic of running a glob is separated from the parsing, giving the caller the opportunity to handle parsing failures flexibly.
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
New test added for the
cabal check
and specific tests for this behaviour have been added to the pre-existing glob tests.The output of
cabal check
has changed a bit, but not for the worse, I don't think; it's now more like the other commands.