Skip to content

Commit 836149c

Browse files
committed
address review comments
elaborate on the new pkg_enabled function, and remove opam hint from the user error Signed-off-by: Sudha Parimala <sudharg247@gmail.com>
1 parent 382a8ee commit 836149c

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

bin/install_uninstall.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,7 @@ let run
526526
if Pkg.Pkg_common.pkg_enabled ~workspace:source_workspace ~lock_dir_paths
527527
then
528528
User_error.raise
529-
[ Pp.text "dune install is not supported with Dune package management." ]
530-
~hints:
531-
[ Pp.concat
532-
~sep:Pp.space
533-
[ Pp.text "Use"; User_message.command "opam"; Pp.text "instead." ]
534-
];
529+
[ Pp.text "dune install is not supported with Dune package management." ];
535530
let* pkgs =
536531
match pkgs with
537532
| _ :: _ -> Fiber.return pkgs

bin/pkg/pkg_common.mli

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ end
8282
[lock_dir]. *)
8383
val pp_packages : Dune_pkg.Lock_dir.Pkg.t list -> User_message.Style.t Pp.t
8484

85-
(** [pkg_enabled ~workspace ~lock_dir_paths] returns [true] if package management is
86-
enabled. *)
85+
(** [pkg_enabled ~workspace ~lock_dir_paths] returns [true] if package
86+
management is enabled. This is intended to be used by commands that don't
87+
run the build system. For commands that do run the build system, use
88+
[Dune_rules.Lock_dir.lock_dir_active]. *)
8789
val pkg_enabled : workspace:Workspace.t -> lock_dir_paths:Path.Source.t list -> bool
8890

8991
(** [check_pkg_management_enabled ()] checks if package management is enabled in the

test/blackbox-tests/test-cases/pkg/install-crash-lock-context.t

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ Build the lockdir first
3232

3333
$ dune install --prefix "$PWD/_install"
3434
Error: dune install is not supported with Dune package management.
35-
Hint: Use 'opam' instead.
3635
[1]
3736

3837
But `dune install` without a prefix argument crashes with an internal error.
3938

4039
$ dune install
4140
Error: dune install is not supported with Dune package management.
42-
Hint: Use 'opam' instead.
4341
[1]
4442

4543

@@ -60,10 +58,8 @@ crashes with the same error.
6058

6159
$ dune install --prefix "$PWD/_install"
6260
Error: dune install is not supported with Dune package management.
63-
Hint: Use 'opam' instead.
6461
[1]
6562

6663
$ dune install
6764
Error: dune install is not supported with Dune package management.
68-
Hint: Use 'opam' instead.
6965
[1]

0 commit comments

Comments
 (0)