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

depext: supporting other tools #5666

Closed
maroneze opened this issue Sep 13, 2023 · 6 comments
Closed

depext: supporting other tools #5666

maroneze opened this issue Sep 13, 2023 · 6 comments

Comments

@maroneze
Copy link
Contributor

maroneze commented Sep 13, 2023

I just learned about the existence of MobaXterm. It's a Windows-based terminal, non-open-source but including a "free tier", that ships Cygwin and allows some of our users to install opam and our tool, based on its opam package.

Now, currently the major hurdle when using it, is that external dependencies are not handled by depext: if I run opam depext <our tool>, for instance, it will say "nothing to do", in part due to the fact that none of the relevant conf- packages have the cygwin package name in their opam file.

However, MobaXterm offers a "MobApt package manager", which includes an apt get command that, despite the name, is not exactly the one from Debian; it installs the package from the Cygwin repository. For instance, I can type apt install libgmp-devel and get it installed. Then, if I run opam install conf-gmp, installation will succeed.

I'd like to help our users by adding such package names in the depexts of these packages, but since this tool is not currently supported by opam, I'm afraid that would be useless.

For information, opam config list shows:

arch              x86_32                                                   # Inferred from system
os                cygwin                                                   # Inferred from system
os-distribution   cygwin                                                   # Inferred from system
os-family         windows                                                  # Inferred from system
os-version        unknown                                                  # Inferred from system
...

And the package names are the ones we see when running the Cygwin graphical installer. So I could add ["libgmp-devel"] {os = "cygwin"} to the opam file of conf-gmp, and hope that in the future it will be taken into account, and opam will know to run apt install <package> (or, more probably, apt -y install <package>, to avoid prompting).

Thus my question: is it useful to add such depexts? Or should support for MobApt be added to opam beforehand? Or is this never going to happen, since MobaXterm is not open source?

By the way, I just tested with conf-libfontconfig (one of the only packages which has a depext with os = "cygwin" but not & os-distribution = "cygwinports"), and it does say "Sorry, don't know how to install packages on your windows system". So indeed my question is two-sided:

  1. Is it possible/useful to add this 'MobApt' system to opam, so that it knows which commands to use?
  2. If I add such depexts for os = cygwin, will they be accepted for merging? Or should I wait for e.g. this system to be added as os-version = "mobapt" or something like that, and then use it for the depexts, to avoid false positives? (Given that the package names are those from Cygwin, it would seem useful to me to keep the depexts as broad as possible)
@kit-ty-kate kit-ty-kate transferred this issue from ocaml/opam-repository Sep 13, 2023
@kit-ty-kate
Copy link
Member

Cygwin support in opam is already present in the latest 2.2.0~alpha2 release, however we only support its builtin setup-${arch}.exe package manager at the moment. Is that builtin package manager not present in the version of cygwin shipped by moba?

@maroneze
Copy link
Contributor Author

No, as far as I can see, there is no sign of the "separate" Cygwin installer. They install files in C:\Users\<user>\AppData\Roaming\MobaXterm, and I can see the whole cygwin unix folder structure, but I couldn't find the setup-*.exe file. Also, since I don't know exactly how they handle the list of downloaded packages, I'm not sure I could just run a separate setup-.exe file and point to a directory, in order to add more packages.

Looking at the CHANGES file from opam 2.2, I see something that seems relevant:

* Add `--no-cygwin-setup`, `--cygwin-internal-install`,
  `--cygwin-local-install` and `--cygwin-location <path>` experimental flags
  available only on Windows to permit non-interactive Cygwin configuration
  [#5545 @rjbou]

But I don't see a --cygwin-add-package-command or something (which I'd like to set to apt -y add).

Anyway, thanks for the reply, I'll do a pull request for the depexts using os = "cygwin", it will likely be useful for broader Cygwin usage.

@maroneze
Copy link
Contributor Author

By the way, there's something that's not entirely clear to me, about opam 2.2.0~alpha2:

The first alpha came with native Windows compatibility. This second alpha comes with a more simple init for Windows: we no longer rely on an already present Cygwin UNIX-like environment for Windows as a compatibility layer. During initialisation, opam now proposes to embed its own fully managed Cygwin install.

From that phrase, I had the impression that I could get an opam binary and use it to install its own embedded Cygwin.

However, the next section says that "This alpha requires a preexisting Cygwin installation for compiling opam", and I couldn't find any Windows binaries.

Are such binaries intended to be released in the nearby future? Or did I misunderstand the instructions, and it will still be necessary to install Cygwin, and then compile opam?

@rjbou
Copy link
Collaborator

rjbou commented Sep 19, 2023

For the moment there is no Windows binaries, we are working on it. We plan to first have available Windows binaries, and in the end, an installer.
Opam itself, for its functioning, does not need a Cygwin install, but to compile it, it is mandatory.
For the moment, you need to compile opam.

@rjbou
Copy link
Collaborator

rjbou commented Sep 19, 2023

On your previous comments, you talk about depexts and opam separately. Since opam 2.1, depext plugin is no more maintained, and no more necessary as depext mechanism was integrated in opam.

In opam 2.2, there is Cygwin support and depext Cygwin support, but as mentioned @kit-ty-kate, only using Cygwin installer setup-x86_64.exe. For the moment, opam is able to detect Cygwin, and interacts with its package manager, but the main opam repository is not yet Cygwin compatible. It is an ongoing work. We hope to have it by the final release.

On MobaXTerm, one way to add its support in opam is to add its detection, and its depext support.
For detection, as it is a Cygwin underneath, one solution is to determine that is a mobapt only for depext. Like that we keep all Cygwin compatibilities functionalities enabled.
For depext, we need to have:

  • a fast command that checks that some packages are installed,
  • a command to install packages,
  • [optional] a command to upgrade,
  • [optional] a fast command to retrieve available packages.

You can take a look at OpamSysInteract.ml, it contains core depexts mechanism.

@maroneze
Copy link
Contributor Author

Thank you very much for all these details. I'll see if our end-users (who actually use MobaXterm) will want to sponsor its support. Good to know it's possible and how to start doing it.

Also thanks for the clarifications concerning the secondary questions. I compiled the opam 2.2 alpha release and I'm currently testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants