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

depexts integration #3975

Merged
merged 35 commits into from
Apr 15, 2020
Merged

depexts integration #3975

merged 35 commits into from
Apr 15, 2020

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Sep 2, 2019

Integration of external dependencies management in opam: System dependencies are retrieved, checked and user is warned before build failure.
What is added ?

① At switch load, we retrieve the depext state of available packages. They are marked as:

  • installed
  • available: not installed but available on current repositories. When the availability can't be retrieved, all not installed packages are marked as available (like on gentoo or *bsd)
  • not_found: not found on available repositories, e.g. on debian only current registered repositories are checked (source.list*).
    For more information on what commands are used, see this function.

② It is then used to check that installed opam packages still have their system dependencies installed. If no, their are removed from installed packages and marked for reinstall (like when an external file dependencies changes).

③ It is also used at install, before performing actions, depexts of packages to install are checked. If some are missing, there is several interactions: proposal to install them via opam, proposal of the command line to run to install them, nothing, etc. All these interactions can be instrumented via the cli, using options depext-no-root, --depext-print-only

④ It is possible to notify opam to bypass the check of some system packages, using the option --depext-bypass. The information is stored in the switch config for further operations.

src/client/opamArg.ml Outdated Show resolved Hide resolved
src/client/opamArg.ml Show resolved Hide resolved
src/client/opamArg.ml Outdated Show resolved Hide resolved
src/client/opamArg.ml Show resolved Hide resolved
src/client/opamArg.ml Outdated Show resolved Hide resolved
src/state/opamStateConfig.mli Outdated Show resolved Hide resolved
src/state/opamStateTypes.mli Outdated Show resolved Hide resolved
src/state/opamSwitchState.ml Show resolved Hide resolved
src/state/opamSwitchState.ml Outdated Show resolved Hide resolved
src/state/opamSysInteract.ml Outdated Show resolved Hide resolved
src/state/opamSysInteract.ml Outdated Show resolved Hide resolved
@rjbou rjbou added the PR: WIP Not for merge at this stage label Sep 5, 2019
(* exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Change module name?

@rjbou
Copy link
Collaborator Author

rjbou commented Oct 10, 2019

close #3790

src/state/opamSysInteract.ml Outdated Show resolved Hide resolved
@rjbou rjbou added the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Oct 29, 2019
@rjbou
Copy link
Collaborator Author

rjbou commented Oct 29, 2019

@rjbou
Copy link
Collaborator Author

rjbou commented Dec 18, 2019

related #3692
close #1519
close #2426

@rjbou rjbou added this to the 2.1.0 milestone Jan 7, 2020
@rjbou rjbou removed the PR: WIP Not for merge at this stage label Jan 24, 2020
@rjbou rjbou requested a review from AltGr January 27, 2020 13:59
@rjbou rjbou force-pushed the depext branch 2 times, most recently from ce997a6 to 79598d4 Compare March 12, 2020 11:25
@hannesm
Copy link
Member

hannesm commented Mar 22, 2020

I have not looked into this PR in detail, but what I currently am missing from depext is a way to figure out which versions of the external dependencies are installed. As example: conf-pkg-config depends on the pkg-config debian package. Now, for reproducible builds I'd like to capture "pkg-config version 0.29-4" is installed (to emit this information into a build-info, and verify on rebuilding time that the package versions did not change). What would be great would be the output of a complete "package name, version" list that includes all transitive dependencies. NB: this does by no means should stop this PR, as the additional functionality can be provided separately; I just wanted to describe what from my perspective is desired for reproducibility :)

@AltGr
Copy link
Member

AltGr commented Mar 23, 2020

@hannesm: indeed, we don't have that kind of information at the moment.
Your best bet would be to use opam list -e, then call your system package manager manually on them to query their installed versions or checksums.

@hannesm
Copy link
Member

hannesm commented Mar 23, 2020

@AltGr ok, If I understand correctly, depext is to abstract away the host system package managers, and once this PR is in, I'd be keen to extend depext with an "info" subcommand (which gets a list of packages and returns a list of packages + versions).

rjbou and others added 23 commits April 14, 2020 21:01
plus some fixes and spelling.
* adds depext_bypass to switch_config
* when a package is installed successfully after bypassing its depexts, save the
  depext-bypass so that the user won't be asked again every time

NOTE: the new field is documented, but refers to an undocumented global config
field!
that allows to register a given sysdep as an exception, iff the corresponding
package installs successfully.

This might be slightly inaccurate if several packages use the same sys
dependency and one has a broken check, but I don't think that's something to
worry about.
So they don't get pissed about being asked each time ;)
... and implement the `depext-no-root` option

The combination with  `--skip-depexts` is not yet implemented
! `~/.opam/config` / `gt.config` only

- `depext: true` Enable handling of external dependencies. When this is enabled, opam will interact with your system package manager when packages declare external dependencies, and prompt you to install them when needed.
- `depext-run-installs: true` (was: `print-only`) Allows opam to run package installations through your system package manager when required by "depexts" of opam packages. You will be prompted before any calls to `sudo`, unless `--yes` was specified; if `false`, the installation command will be printed, and opam will pause to let you proceed.
- `depext-cannot-install: false` (was: `no-root`) Instructs opam that no system package can be installed on your system. Any opam package declaring system dependencies towards a system package that is not yet installed will be marked as unavailable. Use this if you don't have root access.
- `depext-verify: true` (was: `no-consistency-checks`) If an installed opam package depends on a system package that was removed and this is enabled, opam will mark the opam package as needing reinstallation.

`~/.opam/config` + switch-config:
- `depext-bypass: [SYS_PKGS]` List of system packages to assume as installed, without considering the results from the system package manager.

! CLI

- `--assume-depexts` (OpamClientConfig) Skip the installation step for any missing system packages, and attempt to proceed with compilation of the opam packages anyway. If the installation is successful, opam won't prompt again about these system packages.
- `--no-depexts` (OpamStateConfig) Temporarily disables handling of external dependencies. Implies `--assume-depexts`.
which doesn't make much sense in our latest iteration, and is to complicated to
explain. Let's wait to see exactly what need arises if something like it is to
be done at some point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: QUEUED Pending pull request, waiting for other work to be merged or closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opam depext integration
4 participants