Skip to content

Commit

Permalink
Fix level by flipping the env_level implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <sora@morimoto.io>
  • Loading branch information
smorimoto authored and rjbou committed Sep 26, 2023
1 parent 2a6dda6 commit 1fa9e75
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ users)
* Bump to 2.2.0~alpha3~dev [#5615 @rjbou]

## Global CLI
* Fix `OPAMVERBOSE` setting, 0 and 1 levels was inverted: eg, "no" gives level 1, and "yes" level 0 [#5686 @smorimoto]

## Plugins

Expand Down Expand Up @@ -145,3 +146,4 @@ users)

## opam-core
* `OpamSystem.mk_temp_dir`: resolve real path with `OpamSystem.real_path` before returning it [#5654 @rjbou]
* `OpamStd.Config.env_level`: fix level parsing, it was inverted (eg, "no" gives level 1, and "yes" level 0) [#5686 @smorimoto]
4 changes: 2 additions & 2 deletions src/core/opamStd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1683,8 +1683,8 @@ module Config = struct
env (function s ->
if s = "" then 0 else
match bool_of_string s with
| Some true -> 0
| Some false -> 1
| Some true -> 1
| Some false -> 0
| None -> int_of_string s)
var

Expand Down
36 changes: 18 additions & 18 deletions tests/reftests/core-config.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,44 @@ The following actions will be performed:
-> installed foo.1
Done.
### OPAMVERBOSE=1
### opam reinstall foo
### opam reinstall foo | sed-cmd echo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
### OPAMVERBOSE=yes
### opam reinstall foo
### opam reinstall foo | sed-cmd echo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
### OPAMVERBOSE=true
### opam reinstall foo
### opam reinstall foo | sed-cmd echo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
Expand All @@ -59,16 +71,12 @@ Processing 2/4: [foo: echo hej]
-> installed foo.1
Done.
### OPAMVERBOSE=0
### opam reinstall foo | sed-cmd echo
### opam reinstall foo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
Expand All @@ -83,30 +91,22 @@ The following actions will be performed:
-> installed foo.1
Done.
### OPAMVERBOSE=false
### opam reinstall foo | sed-cmd echo
### opam reinstall foo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
### OPAMVERBOSE=no
### opam reinstall foo | sed-cmd echo
### opam reinstall foo
The following actions will be performed:
=== recompile 1 package
- recompile foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 2/4: [foo: echo hej]
+ echo "hej" (CWD=${BASEDIR}/OPAM/core-config/.opam-switch/build/foo.1)
- hej
-> compiled foo.1
-> removed foo.1
-> installed foo.1
Done.
Expand Down

0 comments on commit 1fa9e75

Please sign in to comment.