-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow packages with no build commands #355
Conversation
2486323
to
fbd3864
Compare
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.
It's a useful change, it sounds like packages that don't need to be "built" can be safely included into the duniverse.
Could you add a test with a package that has no build instructions?
lib/opam_solve.ml
Outdated
@@ -95,11 +95,12 @@ module Opam_monorepo_context (Base_context : BASE_CONTEXT) : | |||
Opam.depends_on_dune ~allow_jbuilder depends | |||
|| Opam.depends_on_dune ~allow_jbuilder depopts | |||
in | |||
let has_no_build_command = List.is_empty (OpamFile.OPAM.build opam_file) in | |||
let summary = Opam.Package_summary.from_opam pkg opam_file in | |||
let is_valid_dune_wise = | |||
Opam.Package_summary.is_base_package summary | |||
|| Opam.Package_summary.is_virtual summary |
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'm wondering, wouldn't it make sense to add this to is_virtual
? Or a new category in Opam.Package_summary
?
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 considered that and conceptually it would make sense for packages without build commands to be considered "virtual". We could add a new field to Package_summary.t
:
build : OpamTypes.command list
The problem is that in order to update Package_summary.equal
and Package_summary.pp
we'd need to implement equality and pretty-printing for OpamTypes.command
and it looks like that would add a lot of code.
However, it appears that neither Package_summary.equal
nor 'Package_summary.pp' are ever called, so perhaps they can just be deleted.
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've updated this PR so that the check is now done inside is_virtual
a59e6b9
to
c8ced2a
Compare
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.
Looks very good! Just make the code a bit less brittle and then this is ready to merge 🚢
test/bin/no-build-command.t/run.t
Outdated
depend-without-dune (this should fail due to the transitive dependency on | ||
without-dune which has a build command but doesn't depend on dune) | ||
|
||
$ opam-monorepo lock test-depend-without-dune.opam |
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.
Can you please filter the output? Either with some grep trickery (which is admittedly quite annoying) or just by throwing the output away, as long as the [1]
matches the test is passing. :)
All the text would make the output quite fragile if versions change or the wording changes slightly.
3ef4fd5
to
16b2793
Compare
Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
16b2793
to
57b8c97
Compare
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.
Nice, it's ready to go. Thanks for the PR!
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)
In tarides/opam-monorepo#355 opam-monorepo marked packages without build instructions as virtual (e.g. packages that are conf-packages, dependency-only packages, etc). This requires that the dummy OPAM files used here also have `build` stanzas, otherwise they are considered virtual and skipped.
If a package has no build commands, chances are that it's a metapackage which exists just so that its dependencies can be installed.
Signed-off-by: Stephen Sherratt stephen@sherra.tt