Skip to content
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

Read package flags from OPAM metadata #328

Merged

Conversation

Leonidas-from-XIV
Copy link
Member

This changes the logic from hardcoding the compiler "base packages" to instead read the OPAM flags to check whether the package in question is a compiler in which case it will be considered a base package.

It also adds code to check for packages whether they are conf packages, which could be used to check for virtual packages.

Inspired by #327, this would allow dkml-base-compiler to be considered a base package and not accidentally vendor it. However it doesn't yet allow using the DKML compiler, because the name of the ocaml conf package is still hardcoded with no way to override it (yet).

@samoht
Copy link
Collaborator

samoht commented Nov 2, 2022

Could you squash the is_conf change and remove the description of the conf change in the commit message?

Also, could you add a test with a non-empty flag? Thanks!

@Leonidas-from-XIV Leonidas-from-XIV force-pushed the base-packages-from-metadata branch 2 times, most recently from 06e52a9 to 7c9ca58 Compare November 21, 2022 17:18
@Leonidas-from-XIV Leonidas-from-XIV requested review from samoht and gridbugs and removed request for NathanReb November 22, 2022 14:11
lib/opam.ml Outdated Show resolved Hide resolved
This changes the logic from hardcoding the compiler "base packages" to
instead read the OPAM flags to check whether the package in question is
a compiler in which case it will be considered a base package.

It also adds code to check for packages whether they are `conf` packages,
which could be used to check for virtual packages.

Inspired by tarides#327, this would allow `dkml-base-compiler` to be considered
a base package and not accidentally vendor it. However it doesn't yet
allow using the DKML compiler, because the name of the `ocaml` conf
package is still hardcoded with no way to override it (yet).
The codebase always checks for base and virtual at the same time
(sometimes using `is_virtual`, sometimes reimplementing `is_virtual`)
so it can be folded into a single function that now also checks for the
flags of the package to determine whether it is a compiler.
Also includes a comment on *why* these packages are excluded. Now with
the compiler being auto-detected calling them "base" packages was
confusing since it was unclear what makes them "base".
@Leonidas-from-XIV
Copy link
Member Author

@gridbugs Can you take a look again? I've done some renaming and while thinking about it realized that even to me it was unclear what constituted a "base" package. With the compiler gone from the list it turns out that these are mostly build systems and dependencies of oasis (that aren't much used outside of it) so I explained the reasoning for them.

@Leonidas-from-XIV Leonidas-from-XIV merged commit f6310f7 into tarides:main Nov 28, 2022
@Leonidas-from-XIV Leonidas-from-XIV deleted the base-packages-from-metadata branch November 28, 2022 15:17
Leonidas-from-XIV added a commit to Leonidas-from-XIV/opam-repository that referenced this pull request Dec 21, 2022
CHANGES:

### Changed

- Treat packages with no build commands as if they can be built with dune (tarides/opam-monorepo#355,
  @gridbugs)

### Fixed

- Fix resolving refs of locally pinned repositories (tarides/opam-monorepo#326, tarides/opam-monorepo#332, @hannesm,
  @Leonidas-from-XIV)
- Read the `compiler` flag from OPAM metadata thus classifying more packages
  correctly as base packages (tarides/opam-monorepo#328, @Leonidas-from-XIV)
- Fix bug where dev repo urls ending with a "/" would result in
  `opam monorepo pull` placing package source code directly inside the duniverse
  directory instead of in a subdirectory of the duniverse directory (tarides/opam-monorepo#359,
  @gridbugs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants