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: opam tries to be intelligent but fails; permit to choose the system package manager #5026

Closed
jbulow opened this issue Jan 25, 2022 · 9 comments · Fixed by #5053
Closed

Comments

@jbulow
Copy link

jbulow commented Jan 25, 2022

How to bypass the failing check of host dependencies in opam?

 >which emacs
/usr/bin/emacs
>opam install conf-emacs
The following actions will be performed:
  ∗ install conf-emacs 1

The following system packages will first need to be installed:
    emacs

<><> Handling external dependencies <><><><><><><><><><><><><><><><><><><><><><>
This command should get the requirements installed:

    apt-get install emacs

You may now install the packages on your system.
When you are done: check again and continue? [Y/n] y

The following remain to be installed: emacs
When you are done: check again and continue? [Y/n] y

The following remain to be installed: emacs
When you are done: check again and continue? [Y/n]
@kit-ty-kate kit-ty-kate transferred this issue from ocaml/opam-repository Jan 25, 2022
@jbulow
Copy link
Author

jbulow commented Jan 25, 2022

I just found --no-depexts as a way to bypass this check. Maybe mention this in the info-output when not using this flag?

I.e

You may now install the packages on your system. Use --no-depexts to ignore this check.
When you are done: check again and continue? [Y/n] y

@rjbou rjbou changed the title opam tries to be intelligent but fails depext: opam tries to be intelligent but fails Jan 25, 2022
@rjbou
Copy link
Collaborator

rjbou commented Jan 25, 2022

Seems that opam fails to check that emacs defined package is installed. It doesn't check is the binary exists, but according to what is defined in the conf- package checks install status of system package, eg for conf-emacs

  ["emacs-nox"] {os-family = "debian" & os-distribution != "ubuntu"}
  ["emacs"] {os-distribution = "ubuntu"}
  ["emacs-nox"] {os-distribution = "centos"}
  ["emacs-nox"] {os-distribution = "rhel"}
  ["emacs-nox"] {os-distribution = "fedora"}
  ["emacs-nox"] {os-distribution = "alpine"}
  ["emacs-nox"] {os-family = "suse"}
  ["emacs-nox"] {os-distribution = "ol"}
  ["emacs"] {os-distribution = "arch"}

What is your distribution? Did you installed emacs via your distribution package manager? It will help us to see why opam didn't find that package.

On the bypass, it's better to use the --asume-depexts option or directly its setting opam option depext-bypass than disable the whole checking mechanism for a single blocking package.

@jbulow
Copy link
Author

jbulow commented Jan 26, 2022

I use ubuntu 18.04.6 LTS. Emacs is installed as:

dpkg --get-selections | grep emacs
emacs-snapshot                                  install
emacs-snapshot-common                           install
emacs-snapshot-el                               install
emacsen-common                                  install

In general, it feels weird to to ask the default package manager what software is available. apt is only one way to install softwre. Compiling from source is another. Using snap is yet another option. Using alternative ppa:s with different builds and version (as I did) is also common.

@rjbou rjbou added this to To do in Opam 2.2.0 via automation Jan 27, 2022
@rjbou rjbou removed this from To do in Opam 2.2.0 Jan 27, 2022
@rjbou
Copy link
Collaborator

rjbou commented Jan 27, 2022

In most common cases (from all distro point of view), users use their system package manager. It is a good feature to permit user to choose its system package manager between handled ones: snap versus apt for example ; and store it in the config.

@rjbou rjbou changed the title depext: opam tries to be intelligent but fails depext: opam tries to be intelligent but fails; permit to choose the systemp packamge manager Jan 27, 2022
@jbulow jbulow changed the title depext: opam tries to be intelligent but fails; permit to choose the systemp packamge manager depext: opam tries to be intelligent but fails; permit to choose the system package manager Jan 27, 2022
@AltGr
Copy link
Member

AltGr commented Jan 28, 2022

We definitely need to improve the prompts, you're not the first one stumbling here:

When you are done: check again and continue? [Y/n] y

You just had to answer n at that point...

When you are done: check again and continue? [Y/n] n
Do you want to attempt to proceed anyway? [y/N] y
[... goes on assuming emacs is installed and registering it as with `--assume-depexts`]

Maybe something like Do you want to check again (y) or continue (n) ?

@AltGr
Copy link
Member

AltGr commented Jan 31, 2022

A possibility would be to "flatten" all these embedded y/n questions, resulting in a menu like:

The package needs to be installed with the following command: `sudo apt-get xxx`
1. (y) Let opam do the installation
2. Let me do the installation (then select this to check again)
3. The package is installed by other means, bypass the check and go on (the exception will be registered upon success)
4. Abort

It's a little bit of reading but at least everything is on the table...

@jbulow
Copy link
Author

jbulow commented Feb 2, 2022

Please, just keep it simple. If a requirement is missing on the host, just tell the user. Don't try to be smart and assume a specific package manager etc.

When checking for a requirement, check the actual requirement and do not assume or guess how a host requirement is registered in the system. If emacs is a requirement, just run "emacs --version" or similar to check the existence of emacs.

The worst solution is when one package manager invokes another package manager to install requirements.

@dra27 dra27 added the AREA: UI label Feb 4, 2022
@dra27 dra27 added this to To do in Opam 2.3 via automation Feb 4, 2022
@dra27
Copy link
Member

dra27 commented Feb 4, 2022

Thoughts from today's dev meeting:

Possible UI issues to look at for 2.3, therefore.

Opam 2.3 automation moved this from To do to Done Apr 19, 2022
@rjbou
Copy link
Collaborator

rjbou commented Sep 11, 2023

Fixed by #5053

@rjbou rjbou removed this from Done in Opam 2.3 Sep 11, 2023
@rjbou rjbou added this to the 2.2.0~alpha milestone Sep 11, 2023
@rjbou rjbou added this to Done in Opam 2.2.0 Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Opam 2.2.0
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants