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

Introduce 'default-invariant' besides 'default-compiler' #4607

Merged
merged 13 commits into from
Apr 6, 2021

Conversation

AltGr
Copy link
Member

@AltGr AltGr commented Mar 17, 2021

(todo: add tests)

compared to 2.0, this just adds the new 'default-invariant', and keeps
similar semantics for 'default-compiler', which is only used for 'opam
init' (but must now be compatible with the invariant).

previously the 2.1 branch completely replaced the older meaning of
'default-compiler', using it as 'default-invariant' instead, but the order
of priority was lost.

@dra27 dra27 added this to the 2.1.0~rc milestone Mar 18, 2021
@AltGr AltGr force-pushed the default-invariant branch from ad65ce5 to 95c0a03 Compare March 18, 2021 14:09
@AltGr
Copy link
Member Author

AltGr commented Mar 18, 2021

Ok, so apparently this works... but the perf is not acceptable at the moment :/
(>10s on a high-end PC)

@AltGr
Copy link
Member Author

AltGr commented Mar 18, 2021

Ok, tests added, and now reasonably performant

@dra27 dra27 linked an issue Mar 18, 2021 that may be closed by this pull request
@AltGr AltGr force-pushed the default-invariant branch from 80b78b3 to 179a58d Compare March 19, 2021 09:23
@rjbou rjbou force-pushed the default-invariant branch from 179a58d to 08f5950 Compare March 23, 2021 10:51
@rjbou rjbou requested a review from dra27 March 23, 2021 13:04
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, apart from the interactive prompt at opam init.

What happens if there's no installable compiler (e.g. because the user points at an empty repo or something like that)? Is it a reasonable error message or does opam explode? 🙂

Comment on lines +156 to +159
if config_files = [] then
OpamConsole.msg "No configuration file found, using built-in defaults.\n"
else
OpamConsole.msg "Configuring from %sbuilt-in defaults.\n" others;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice 🙂

Comment on lines +23 to +24
OpamFormula.Atom (OpamPackage.Name.of_string "ocaml-system",
OpamFormula.Empty);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the user has an old system compiler (e.g. they happen to be on a really old Ubuntu)? Does it quietly ignore it and move on to ocaml-base-compiler, or should we duplicate the >= "4.05" constraint here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fun st ->
(),
OpamSwitchCommand.install_compiler st
~additional_installs:default_compiler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes an interactive prompt in OpamSwitchCommand.install_compiler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, well spotted, indeed that's unfortunate.

AltGr and others added 9 commits March 31, 2021 13:37
compared to 2.0, this just adds the new 'default-invariant', and keeps similar
semantics for 'default-compiler', which is only used for 'opam init' (but must
now be compatible with the invariant).

previously the 2.1 branch completely replaced the older meaning of
'default-compiler', using it as 'default-invariant' instead, but the order of
priority was lost.
This can happen with a bad URL, or if the network is down. I state you end up in
is pretty confusing for users: opam considers it's initialised, but you get no
packages and no switch, and it's unclear what to do.
it was completely silent, which could be confusing.
@AltGr AltGr force-pushed the default-invariant branch from e9437f0 to e8a4d16 Compare March 31, 2021 13:12
AltGr added 2 commits March 31, 2021 18:28
and disable the confirmation in all cases, it doesn't make much sense anymore on
2.1.
to make it follow the documented behaviour:
`Without arguments, an invariant is chosen automatically.`

previous version just emptied it.
@AltGr AltGr force-pushed the default-invariant branch from e8a4d16 to 23f1e86 Compare March 31, 2021 16:28
@dra27 dra27 mentioned this pull request Apr 1, 2021
@dra27
Copy link
Member

dra27 commented Apr 1, 2021

Hopefully that fixes the testsuite on AppVeyor. The problem was twofold:

  • The msvc test is done in Visual Studio 2017, although the relevant difference is that AppVeyor uses Server 2016 for that image instead of Server 2019. Server 2019 has a Windows built bsdtar in C:\Windows\system32\tar.exe. This meant that on Windows 10 1803+ / Server 2019 a Windows-formatted path ended up being passed to a Windows tar, so it worked, but more by luck than judgement, because...
  • The fix was to identify that we're invoking tar and turn on cygpath conversion if it turns out we're calling the Cygwin version of tar. This fixes Server 2016, but then we break Server 2019! It turns out we get bitten by Unix.create_process_env "bash" [| |] would use C:\Windows\System32\bash.exe even the path set ocaml#7662. At present, executables in C:\Windows\system32 always win. I've solved this by resolving the command first - for now, on Windows. It's likely that OCaml's Unix library will get fixed.

@AltGr
Copy link
Member Author

AltGr commented Apr 2, 2021

ow thanks !

@AltGr AltGr merged commit affb392 into ocaml:master Apr 6, 2021
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.

opam init in 2.1 is not selecting the system compiler
2 participants