-
Notifications
You must be signed in to change notification settings - Fork 13
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
Look up variables even if they refer to other packages #46
Look up variables even if they refer to other packages #46
Conversation
1. Fixes the problem of not resolving variables that refer to other packages 2. Silences the warning about unresolved variables if the variable refers to a package that is not installed. 3. Keeps the warning if the variable is not referring to a package and undefined OR the package is installed and is missing the definition. Closes ocaml-opam#45.
b28b2a9
to
1f0dcfb
Compare
Hi! @rjbou pinging you since you're assigned as a reviewer - do you know when you'd have some time to review this or if anyone else would have the bandwidth to have a look? This is causing unwanted warnings in opam-monorepo: tarides/opam-monorepo#349 |
I don't understand why this need to be done, opam functions already do this resolving. From what I see, the issue comes from opam-0install-solver/lib/switch_context.ml Lines 19 to 32 in b759d7c
From what i understand, OpamPackageVar.resolve_switch is given as argument the package that is looked at, while it should take as argument a package for which it resolves the variable.For that was, better us OpamPackageVar.resolve , that fully handle package variables, and is more specific to filtering.
|
@rjbou Thanks for your input. If I look up the documentation of
Hence I would expect that it would also resolve other packages that are in the switch, but specifying On the other hand,
Which makes me a bit wary to change, because I don't want global variables to factor into this. It is well possible that I am using that API wrong, but we began seeing errors in #45 and my hunch of just removing |
After a debugging session with @kit-ty-kate as part of fixing tarides/opam-monorepo#349 and ocaml-opam/opam-0install-solver#46 we realized that OPAM doesn't support resolving package variables in `conflicts` fields (the linter complains about this in `depends` fileds but not in `conflicts` fields, but the solver never resolves these variables). So this constraint doesn't do anything in OPAM and it causes issues in the opam-0install-solver which attempts to resolve them.
So, if I understand correctly (from ocaml/opam-repository#23736), the warning comes when a package refers to another package's variables in the |
Yes, I think that's a correct reading of the issue. Closing the PR as the issue was solved on the opam-repository side. |
OpamPackageVar.resolve_switch
only looks up variables that are in the current package (and not specifying~package
seems to make no difference), so add code to retrieve the name of the package from the variable, retrieve the package from the installed packages and look up the variable in that package.This PR:
Closes #45.