-
Notifications
You must be signed in to change notification settings - Fork 701
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
Consider Installed packages when pruning the install plan #6972
Consider Installed packages when pruning the install plan #6972
Conversation
For tests, |
I also don't see changelog file. Did you forget to |
I am having troubles with the patch. The integration test wants me to exactly specify the unit id of the happy package. But that's pretty much environment dependent. Need to investigate more. And maybe I am blind but is there maybe simpler test suite already that let's me run cabal and have a fixture for the expected output? |
Look at |
f7aeba5
to
e83094f
Compare
I am seeing
with my test case. Are we executing tests with an index? |
@alexbiehl looks like so. Grep for |
Hmm, tests pass because
you actually need to add alex-... package to I have to fix #6820 and install |
@phadej Do you think we can move this patch forward? I don't think we should wait for the test suite to be refactored to get this change in. I can drop the failed attempt at tests for now. It would be beneficial to have this patch in the upcoming cabal-install release. |
Sorry. I have experienced too many times that tests are not written retroactively. |
Alright, do we have a clear path for a test? It seems that my attempts resulted in the tests being skipped as |
The discussion in haskell#6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider `installed` packages when pruning the install plan.
2050e8a
to
ad73e2a
Compare
89dbc1c
to
43bb404
Compare
Alright! I think tests are working properly now. @phadej mind giving this another look? |
-- Install path frequently has architecture specific elements, so | ||
-- nub it out | ||
. resub "^Warning: The directory (.+) is not in the system search path." | ||
"Warning: The directory <PATH> is not in the system search path." |
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 think this hides a bug which you don't address.
Why extra-packages
is build as local package, and run from somewhere inside dist-newstyle
and not installed to the store and run from there.
Or so it looked like in previous CI errors.
I'm 👎 on this change. It shouldn't be required.
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.
Why extra-packages is build as local package, and run from somewhere inside dist-newstyle and not installed to the store and run from there.
Hm, that is not what's happening. extra-packages
are not treated as local. extra-package are installed globally into the store which results in displaying the store-path in above message. Unfortunately store-paths are platform dependent, hence the above change.
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 think we should rather teach the store-dir location and replace that with <STOREDIR>
(as we already do for other platform dependent things), rather then hiding big parts of the output
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 if path is
.../store/ghc-8.6.5/Agda-2.6.2-18fb8b49b1f47de3065c0ae3a191d1060c3959e9293aeb9e2aa88c3705c7a92d/bin/agda
we know how to replace ghc-8.6.5
, matching against /package-id-hash/
and replacing just hash
part with <HASH>
should work. An approximation of package-id is not tricky. See unqual-name
and version
in https://cabal.readthedocs.io/en/3.4/buildinfo-fields-reference.html#non-terminals
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.
Right, for other store path occurrences we are using the same patterns:
-- Install path frequently has architecture specific elements, so
-- nub it out
. resub "Installing (.+) in .+" "Installing \\1 in <PATH>"
I tried this patch locally, and it works. don't like what we print
as that incoming path shouldn't be printed. The command is run from which is more sensible path (btw it might make sense to recognise just That "not in the system path" comes from |
diff --git a/cabal-testsuite/PackageTests/ExtraPackages/cabal.out b/cabal-testsuite/PackageTests/ExtraPackages/cabal.out
index 7820c030c..b82be3336 100644
--- a/cabal-testsuite/PackageTests/ExtraPackages/cabal.out
+++ b/cabal-testsuite/PackageTests/ExtraPackages/cabal.out
@@ -9,4 +9,4 @@ Configuring some-exe-0.0.1.0...
Preprocessing executable 'some-exe' for some-exe-0.0.1.0..
Building executable 'some-exe' for some-exe-0.0.1.0..
Installing executable some-exe in <PATH>
-Warning: The directory <PATH> is not in the system search path.
+Warning: The directory <ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-<HASH><ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/some-exe-0.0.1.0-<HASH>/bin is not in the system search path.
diff --git a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
index e4bb63f61..e48776ea7 100644
--- a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
+++ b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
@@ -30,7 +30,7 @@ normalizeOutput nenv =
-- This is dumb but I don't feel like pulling in another dep for
-- string search-replace. Make sure we do this before backslash
-- normalization!
- . resub (posixRegexEscape (normalizerGblTmpDir nenv) ++ "[a-z0-9.-]+") "<GBLTMPDIR>" -- note, after TMPDIR
+ . resub (posixRegexEscape (normalizerGblTmpDir nenv) ++ "[a-z0-9\\.-]+") "<GBLTMPDIR>" -- note, after TMPDIR
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
@@ -39,6 +39,12 @@ normalizeOutput nenv =
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
. resub "[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.+]+"
"<VERSION>/installed-<HASH>"
+ -- incoming directories in the store
+ . resub "/incoming/new-[0-9]+"
+ "/incoming/new-<RAND>"
+ -- look for PackageHash directories
+ . resub "/(([A-Za-z0-9]+)(-[A-Za-z0-9\\.]+)*)-[0-9a-f]{4,64}/"
+ "/\\1-<HASH>/"
-- Normalize architecture
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
-- Some GHC versions are chattier than others
@@ -54,10 +60,6 @@ normalizeOutput nenv =
else id)
-- hackage-security locks occur non-deterministically
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""
- -- Install path frequently has architecture specific elements, so
- -- nub it out
- . resub "^Warning: The directory (.+) is not in the system search path."
- "Warning: The directory <PATH> is not in the system search path."
where
packageIdRegex pid =
resub (posixRegexEscape (display pid) ++ "(-[A-Za-z0-9.-]+)?") |
I'm not sure whether |
43bb404
to
4bb674d
Compare
Cool! Unfortunately we have to escape the package name as well as it differs on Linux and OSX: On my mac machine it is
On CI it is
|
@@ -9,4 +9,4 @@ Configuring some-exe-0.0.1.0... | |||
Preprocessing executable 'some-exe' for some-exe-0.0.1.0.. | |||
Building executable 'some-exe' for some-exe-0.0.1.0.. | |||
Installing executable some-exe in <PATH> | |||
Warning: The directory <ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-<HASH><ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/sm-x-0.0.1.0-<HASH>/bin is not in the system search path. | |||
Warning: The directory <ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/incoming/<PACKAGE>-<HASH><ROOT>/cabal.dist/home/.cabal/store/ghc-<GHCVER>/<PACKAGE>-<HASH>/bin is not in the system search path. |
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.
Argl it escapes too mucho :(
hmm. that |
What about trimming away the whole path in that log message? Its a lot easier than surgically replacing butchered package names.. |
No. I said it already. We want to catch cases where we e.g. reorganise something. I'll look at this next month, I'm running out of time to work on Cabal. |
I made more tweaks to OutputNormalizer, and got tests to be green in #7099 |
The discussion in #6952 indicated that extra-packages stanzas wouldn't quite work yet. It turns out in order for cabal to find exes for already installed extra-packages we need to also consider
installed
packages when pruning the install plan.Here is what you can do with it:
Using HEAD
With this patch applied
Please include the following checklist in your PR:
changelog.d
directory).Please also shortly describe how you tested your change. Bonus points for added tests!