From d6f1a2740ac584127105773a43283829ae7a39e7 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Fri, 20 Sep 2024 18:03:53 +0100 Subject: [PATCH] fix(pkg): ignore depexts that cannot be evaluated (#10942) Signed-off-by: Rudi Grinberg --- src/dune_pkg/opam_solver.ml | 3 ++- test/blackbox-tests/test-cases/pkg/depexts/unknown-variable.t | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dune_pkg/opam_solver.ml b/src/dune_pkg/opam_solver.ml index a2bfca37c10..123f205470e 100644 --- a/src/dune_pkg/opam_solver.ml +++ b/src/dune_pkg/opam_solver.ml @@ -707,7 +707,8 @@ let opam_package_to_lock_file_pkg let depexts = OpamFile.OPAM.depexts opam_file |> List.concat_map ~f:(fun (sys_pkgs, filter) -> - if OpamFilter.eval_to_bool (Solver_env.to_env solver_env) filter + let env = Solver_env.to_env solver_env in + if OpamFilter.eval_to_bool ~default:false env filter then OpamSysPkg.Set.to_list_map OpamSysPkg.to_string sys_pkgs else []) in diff --git a/test/blackbox-tests/test-cases/pkg/depexts/unknown-variable.t b/test/blackbox-tests/test-cases/pkg/depexts/unknown-variable.t index b2ab2ad1d85..ac07888b938 100644 --- a/test/blackbox-tests/test-cases/pkg/depexts/unknown-variable.t +++ b/test/blackbox-tests/test-cases/pkg/depexts/unknown-variable.t @@ -19,7 +19,7 @@ Make a project that uses the foo library: Locking should succeed and not include the "unzip" package $ dune pkg lock 2>&1 | head -n 1 - Error: exception Failure("Undefined boolean filter value: foobar") + Solution for dune.lock: $ [ -e dune.lock/foo.pkg ] && cat dune.lock/foo.pkg - [1] + (version 0.0.1)