Skip to content

Do depexts status check at opam update time#6489

Merged
kit-ty-kate merged 15 commits intoocaml:masterfrom
arozovyk:depexts_status_on_update_2
Feb 20, 2026
Merged

Do depexts status check at opam update time#6489
kit-ty-kate merged 15 commits intoocaml:masterfrom
arozovyk:depexts_status_on_update_2

Conversation

@arozovyk
Copy link
Copy Markdown
Collaborator

@arozovyk arozovyk commented Apr 25, 2025

Fixes #6461
Fixes #4172

@kit-ty-kate kit-ty-kate added this to the 2.5.0~alpha1 milestone Apr 25, 2025
@arozovyk arozovyk force-pushed the depexts_status_on_update_2 branch from a9ed214 to 6be401b Compare April 28, 2025 12:18
@arozovyk arozovyk force-pushed the depexts_status_on_update_2 branch 4 times, most recently from dac6fd8 to 4af5735 Compare June 6, 2025 10:35
Copy link
Copy Markdown
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

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

This is a first look, code only. I need to test and play with it to complete the review.

@arozovyk arozovyk force-pushed the depexts_status_on_update_2 branch 10 times, most recently from c715f6a to 48e64e4 Compare June 24, 2025 09:44
@arozovyk arozovyk force-pushed the depexts_status_on_update_2 branch from 48e64e4 to 9d59425 Compare July 2, 2025 17:13
@rjbou rjbou force-pushed the depexts_status_on_update_2 branch from 9d59425 to 28b4831 Compare July 25, 2025 17:34
match latest with
| Some p -> OpamSysPkg.Map.add p ps provides
| None -> provides (* Bad pacman output ?? *)
| None -> provides (* FIXME: Bad pacman output ?? *)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what is the resaon of the fixme ?

Copy link
Copy Markdown
Collaborator Author

@arozovyk arozovyk Aug 20, 2025

Choose a reason for hiding this comment

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

I will have to recheck my tests on Altlinux

@arozovyk arozovyk force-pushed the depexts_status_on_update_2 branch 2 times, most recently from 4b63e8f to 61bf34d Compare August 29, 2025 11:41
@rjbou rjbou added the PRIORITY label Dec 15, 2025
@rjbou rjbou force-pushed the depexts_status_on_update_2 branch 2 times, most recently from 5e1d836 to 201aae0 Compare February 9, 2026 12:07
@rjbou rjbou self-assigned this Feb 9, 2026
@rjbou rjbou force-pushed the depexts_status_on_update_2 branch 2 times, most recently from 37e29e2 to f3d5c95 Compare February 10, 2026 10:25
Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

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

First "quick" review of the new changes looks good, i didn't see anything egregious.
I would say go ahead with rebase and i'll do another final commit by commit review + local test

@rjbou rjbou force-pushed the depexts_status_on_update_2 branch from 171fa5b to 845b2c6 Compare February 10, 2026 19:37
Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

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

LGTM modulo some minor things to fix

Comment on lines +529 to +541
### : <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
### : [default] Initialised
### :
### : <><> Creating initial switch 'comp' (invariant ["comp"]) ><><><><><><><><><><><>
### :
### : <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
### : Switch invariant: ["comp"]
### : [NOTE] External dependency handling not supported for OS family 'unknown'.
### : You can disable this check using 'opam option --global depext=false'
### :
### : <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
### : -> installed comp.1
### : Done.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why add comments like this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

good question, @arozovyk ?

# Return code 2 #
### opam option depext=false
Set to 'false' the field depext in global configuration
### opam install foo --depext-only
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure i agree this shouldn't do anything. I can see a case for disabling depext by default but selectively installing them when needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it's too complicated to do with the new system though, we should at least display an error message saying to set opam option depext=true and exit <> 0, but doing it automatically for the duration of the command would be best i think.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it's easily doable with

--- a/src/client/opamCommands.ml
+++ b/src/client/opamCommands.ml
@@ -1875,6 +1875,11 @@ let install cli =
                  else "no-depexts"))
     else
     OpamGlobalState.with_ `Lock_none @@ fun gt ->
+    if depext_only && OpamStateConfig.no_depexts gt then
+      `Error (true,
+              Printf.sprintf "Depexts mechanism is disabled, \
+                              --depext-only can't be used.")
+    else
     OpamSwitchState.with_ `Lock_write gt @@ fun st ->
     let pure_atoms =
       List.filter_map (function `Atom a -> Some a | _ -> None)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved other.dev (file://${BASEDIR}/other)
-> installed other.dev
[NOTE] Requirement for system package other-depext overridden in this switch. Use `opam option 'depext-bypass-="other-depext"'' to revert.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
[NOTE] Requirement for system package other-depext overridden in this switch. Use `opam option 'depext-bypass-="other-depext"'' to revert.
[NOTE] Requirement for system package other-depext overridden in this switch. Use `opam option 'depext-bypass-="other-depext"'` to revert.

Comment on lines +529 to +541
### : <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
### : [default] Initialised
### :
### : <><> Creating initial switch 'comp' (invariant ["comp"]) ><><><><><><><><><><><>
### :
### : <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
### : Switch invariant: ["comp"]
### : [NOTE] External dependency handling not supported for OS family 'unknown'.
### : You can disable this check using 'opam option --global depext=false'
### :
### : <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
### : -> installed comp.1
### : Done.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I kept it for reference at some point while enabling/disabling the main behaviour of polling depexts on update/init

It's a developement artifact at this point and should be removed

Suggested change
### : <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
### : [default] Initialised
### :
### : <><> Creating initial switch 'comp' (invariant ["comp"]) ><><><><><><><><><><><>
### :
### : <><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
### : Switch invariant: ["comp"]
### : [NOTE] External dependency handling not supported for OS family 'unknown'.
### : You can disable this check using 'opam option --global depext=false'
### :
### : <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
### : -> installed comp.1
### : Done.

@rjbou rjbou force-pushed the depexts_status_on_update_2 branch 2 times, most recently from de66de8 to ef3c0bc Compare February 18, 2026 18:43
- sys-foo
### :I:5: No depext
### opam switch create no-depext --empty
### OPAMNODEPEXTS=1 opam install foo --depext-only
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
### OPAMNODEPEXTS=1 opam install foo --depext-only
### OPAMNODEPEXTS=1 opam install foo --depext-only | sed-cmd echo

rjbou and others added 14 commits February 19, 2026 18:37
…and installed

These polling functions are also now no-op if given argument is an empty set.

Co-authored-by: Raja Boujbel <raja.boujbel@ocamlpro.com>
It can be used to detect if opam is launched in a sandboxed environment,
like when it is launched in inner commands (build, install, remove
actions).
…e it

Compute and cache depexts availability during repository state loading and
integrate this information into switch state management. This enables
efficient access to system package availability without repeated
system queries.

This repository state cache is also updated with 'opam update --depexts'.

For pinned packages, during switch state loading (or pin update), systms
packages status is retrrieved at the moment and completed to existing
one.

Co-authored-by: Raja Boujbel <raja.boujbel@ocamlpro.com>
@rjbou rjbou force-pushed the depexts_status_on_update_2 branch from ef3c0bc to b9b9168 Compare February 19, 2026 21:09
@kit-ty-kate
Copy link
Copy Markdown
Member

Igoring the unrelated depexts-alpine CI failure which should be fixed later on our side or in opam-repository

#=== ERROR while compiling conf-clang-format.1 ================================#
"clang-format": command not found.

Thanks a lot!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the depexts availability calculation at opam update time [2.1.0~alpha] opam show is noticably slower, loading depexts

3 participants