From 82450a7a1fd15f92af8ff13c91292d131a1da02a Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 10 Dec 2024 18:53:49 +0000 Subject: [PATCH] opam admin check: Set with-test and with-doc to false by default --- master_changes.md | 2 ++ src/client/opamAdminCheck.ml | 21 ++++++++------------ src/client/opamAdminCheck.mli | 1 - src/client/opamAdminCommand.ml | 11 +++-------- tests/reftests/admin.test | 35 ---------------------------------- 5 files changed, 13 insertions(+), 57 deletions(-) diff --git a/master_changes.md b/master_changes.md index f1ce6fe007c..faf6c52c3e4 100644 --- a/master_changes.md +++ b/master_changes.md @@ -114,6 +114,8 @@ users) ## Admin * ◈ Add `opam admin compare-versions` to compare package versions for sanity checks [#6197 @mbarbin] * [BUG] Fix `opam admin check` in the presence of the `with-dev-setup` variable [#6331 @kit-ty-kate - fix #6329] + * ✘ The `-i`/`--ignore-test-doc` argument has been removed from `opam admin check` [#6335 @kit-ty-kate] + * ✘ `opam admin check` now sets `with-test` and `with-doc` to `false` instead of `true` [#6335 @kit-ty-kate] ## Opam installer diff --git a/src/client/opamAdminCheck.ml b/src/client/opamAdminCheck.ml index c1dfb6046ac..96ad2590bb4 100644 --- a/src/client/opamAdminCheck.ml +++ b/src/client/opamAdminCheck.ml @@ -11,7 +11,7 @@ open OpamTypes open OpamPackage.Set.Op -let env ~with_test ~with_doc ~with_dev_setup ~dev nv v = +let env nv v = match OpamVariable.Full.scope v, OpamVariable.(to_string (Full.variable v)) with @@ -22,17 +22,16 @@ let env ~with_test ~with_doc ~with_dev_setup ~dev nv v = | OpamVariable.Full.Global, "opam-version" -> Some (S OpamVersion.(to_string current)) | OpamVariable.Full.Global, "with-test" -> - Some (B with_test) + Some (B false) | OpamVariable.Full.Global, "dev" -> - Some (B dev) + Some (B false) | OpamVariable.Full.Global, "with-doc" -> - Some (B with_doc) + Some (B false) | OpamVariable.Full.Global, "with-dev-setup" -> - Some (B with_dev_setup) + Some (B false) | _ -> None -let get_universe ~with_test ~with_doc ~with_dev_setup ~dev opams = - let env = env ~with_test ~with_doc ~with_dev_setup ~dev in +let get_universe opams = let packages = OpamPackage.keys opams in { u_packages = packages; @@ -405,7 +404,7 @@ let get_obsolete univ opams = if is_obsolete then acc ++ pkgs else acc) aggregates PkgSet.empty -let check ~quiet ~installability ~cycles ~obsolete ~ignore_test repo_root = +let check ~quiet ~installability ~cycles ~obsolete repo_root = let pkg_prefixes = OpamRepository.packages_with_prefixes repo_root in let opams = OpamPackage.Map.fold (fun nv prefix acc -> @@ -419,11 +418,7 @@ let check ~quiet ~installability ~cycles ~obsolete ~ignore_test repo_root = pkg_prefixes OpamPackage.Map.empty in - let univ = - get_universe - ~with_test:(not ignore_test) ~with_doc:(not ignore_test) ~with_dev_setup:false ~dev:false - opams - in + let univ = get_universe opams in (* Installability check *) let unav_roots, uninstallable = diff --git a/src/client/opamAdminCheck.mli b/src/client/opamAdminCheck.mli index 603a852fcb7..bbccf6aabff 100644 --- a/src/client/opamAdminCheck.mli +++ b/src/client/opamAdminCheck.mli @@ -25,7 +25,6 @@ val cycle_check: universe -> package_set * formula list list sets are empty. *) val check: quiet:bool -> installability:bool -> cycles:bool -> obsolete:bool -> - ignore_test:bool -> dirname -> package_set * package_set * package_set * package_set * package_set (** Returns a subset of "obsolete" packages, i.e. packages for which a strictly diff --git a/src/client/opamAdminCommand.ml b/src/client/opamAdminCommand.ml index 6bc2eeb0a7a..e564dd95d1a 100644 --- a/src/client/opamAdminCommand.ml +++ b/src/client/opamAdminCommand.ml @@ -761,11 +761,6 @@ let check_command cli = are supposed to be available. By default, all checks are run." ] in - let ignore_test_arg = - OpamArg.mk_flag ~cli OpamArg.cli_original ["ignore-test-doc";"i"] - "By default, $(b,{with-test}) and $(b,{with-doc}) dependencies are \ - included. This ignores them, and makes the test more tolerant." - in let print_short_arg = OpamArg.mk_flag ~cli OpamArg.cli_original ["s";"short"] "Only output a list of uninstallable packages" @@ -782,7 +777,7 @@ let check_command cli = OpamArg.mk_flag ~cli OpamArg.cli_original ["obsolete"] "Analyse for obsolete packages" in - let cmd global_options ignore_test print_short + let cmd global_options print_short installability cycles obsolete () = OpamArg.apply_global_options cli global_options; let repo_root = checked_repo_root () in @@ -793,7 +788,7 @@ let check_command cli = in let pkgs, unav_roots, uninstallable, cycle_packages, obsolete = OpamAdminCheck.check - ~quiet:print_short ~installability ~cycles ~obsolete ~ignore_test + ~quiet:print_short ~installability ~cycles ~obsolete repo_root in let all_ok = @@ -827,7 +822,7 @@ let check_command cli = OpamStd.Sys.exit_because (if all_ok then `Success else `False) in OpamArg.mk_command ~cli OpamArg.cli_original command ~doc ~man - Term.(const cmd $ global_options cli $ ignore_test_arg $ print_short_arg + Term.(const cmd $ global_options cli $ print_short_arg $ installability_arg $ cycles_arg $ obsolete_arg) let compare_versions_command_doc = "Compare two package versions" diff --git a/tests/reftests/admin.test b/tests/reftests/admin.test index 819d5275bcd..415f3f01db8 100644 --- a/tests/reftests/admin.test +++ b/tests/reftests/admin.test @@ -342,18 +342,6 @@ depends: "lectus" ### # by default, the check does installability & cycle check ### opam admin check Checking installability of every package. This may take a few minutes... -[ERROR] These packages are not installable (3): - ocaml-system.1.2 risus.1 suspendisse.1 -[ERROR] Dependency cycles detected: - * lectus = 1 -> dignissim = 1 - * lectus = 1 -> tortor = 1 -Summary: out of 25 packages (22 distinct names) -- 3 uninstallable roots -- 3 packages part of dependency cycles - -# Return code 1 # -### opam admin check -i -Checking installability of every package. This may take a few minutes... [ERROR] These packages are not installable (2): ocaml-system.1.2 risus.1 [ERROR] Dependency cycles detected: @@ -365,14 +353,6 @@ Summary: out of 25 packages (22 distinct names) # Return code 1 # ### opam admin check --installability Checking installability of every package. This may take a few minutes... -[ERROR] These packages are not installable (3): - ocaml-system.1.2 risus.1 suspendisse.1 -Summary: out of 25 packages (22 distinct names) -- 3 uninstallable roots - -# Return code 1 # -### opam admin check --installability -i -Checking installability of every package. This may take a few minutes... [ERROR] These packages are not installable (2): ocaml-system.1.2 risus.1 Summary: out of 25 packages (22 distinct names) @@ -380,13 +360,6 @@ Summary: out of 25 packages (22 distinct names) # Return code 1 # ### opam admin check --obsolete -[ERROR] Obsolete packages detected: - - lorem 2.0 -Summary: out of 25 packages (22 distinct names) -- 1 obsolete packages - -# Return code 1 # -### opam admin check --obsolete -i [ERROR] Obsolete packages detected: - lorem 1.0, 2.0 Summary: out of 25 packages (22 distinct names) @@ -394,14 +367,6 @@ Summary: out of 25 packages (22 distinct names) # Return code 1 # ### opam admin check --cycles -[ERROR] Dependency cycles detected: - * lectus = 1 -> dignissim = 1 - * lectus = 1 -> tortor = 1 -Summary: out of 25 packages (22 distinct names) -- 3 packages part of dependency cycles - -# Return code 1 # -### opam admin check --cycles -i [ERROR] Dependency cycles detected: * lectus = 1 -> tortor = 1 Summary: out of 25 packages (22 distinct names)