Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ users)
## Switch

## Config
* Fix `opam config subst` so it works with absolute paths [#6936 @NathanReb]

## Pin

Expand Down Expand Up @@ -207,6 +208,8 @@ users)
* `OpamSolution` remove the heuristic of recomputing depexts of additional (pinned) packages. [#6489 @arozovyk]
* `OpamClient` update the system package status check for dependencies during `opam install --deps-only`, including support for pinned packages; also update this in `OpamAuxCommands.autopin` [#6489 @arozovyk]
* `OpamSolution.get_depexts` remove no longer needed `recover` option that was used with `--depext-only` option [#6489 @arozovyk]
* `OpamConfigCommand.subst` now takes a `filename` instead of a `basename`
[#???? @NathanReb]

## opam-repository
* `OpamRepositoryPath` was moved to `opam-format` [#6917 @rjbou]
Expand Down
2 changes: 1 addition & 1 deletion src/client/opamCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ let config cli =
| Some `subst, (_::_ as files) ->
OpamGlobalState.with_ `Lock_none @@ fun gt ->
`Ok (OpamConfigCommand.subst gt
(List.map OpamFilename.Base.of_string files))
(List.map OpamFilename.of_string files))
| Some `pef, params ->
OpamGlobalState.with_ `Lock_none @@ fun gt ->
OpamSwitchState.with_ `Lock_none gt @@ fun st ->
Expand Down
6 changes: 1 addition & 5 deletions src/client/opamConfigCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,7 @@ let subst gt fs =
log "config-substitute";
OpamSwitchState.with_ `Lock_none gt @@ fun st ->
let env = OpamPackageVar.resolve st in
List.iter
(fun b ->
let file = OpamFilename.of_basename b in
OpamFilter.expand_interpolations_in_file env file)
fs
List.iter (OpamFilter.expand_interpolations_in_file env) fs

let expand gt str =
log "config-expand";
Expand Down
2 changes: 1 addition & 1 deletion src/client/opamConfigCommand.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ val print_eval_env: csh:bool -> sexp:bool -> fish:bool -> pwsh:bool -> cmd:bool
val list: 'a switch_state -> name list -> unit

(** Substitute files *)
val subst: 'a global_state -> basename list -> unit
val subst: 'a global_state -> filename list -> unit

(** Prints expansion of variables in string *)
val expand: 'a global_state -> string -> unit
Expand Down
13 changes: 13 additions & 0 deletions tests/reftests/config.test
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,16 @@ Done.
# invariant ["meta-compiler" "depopt-compiler"]
# compiler-packages compiler.1, dep-compiler.1, depopt-compiler.1
# meta-compiler:compvar something
### :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
### : opam config subst must accept relative and absolute paths
### :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
### <some-dir/relative.in>
%{root}%
### <some-dir/absolute.in>
%{root}%
### opam config subst some-dir/relative
### cat some-dir/relative
${BASEDIR}/OPAM
### opam config subst $BASEDIR/some-dir/absolute | 'OpamSystem.File_not_found.*' -> 'OpamSystem.File_not_found...'
### cat some-dir/absolute
${BASEDIR}/OPAM
Loading