Skip to content

Commit

Permalink
arg: export require checksum and no checksum flags and share them wit…
Browse files Browse the repository at this point in the history
…h build options
  • Loading branch information
rjbou committed Dec 4, 2024
1 parent efcfa64 commit eee0e46
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ users)
# API updates
## opam-client
* `OpamArg.InvalidCLI`: export exception [#6150 @rjbou]
* `OpamArg`: export `require_checksums` and `no_checksums`, that are shared with `build_options` [#5563 @rjbou]

## opam-repository
* `OpamDownload.get_output`: fix `wget` option for `POST` requests [#6036 @rjbou]
Expand Down
21 changes: 13 additions & 8 deletions src/client/opamArg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,17 @@ let lock_suffix ?section cli =
"Set locked files suffix to $(i,SUFFIX)."
Arg.(string) ("locked")

(* Checksums options *)
let no_checksums ?section cli from_cli =
mk_flag ~cli from_cli ?section ["no-checksums"]
"Do not verify the checksum of downloaded archives.\
This is equivalent to setting $(b,\\$OPAMNOCHECKSUMS) to \"true\"."
let require_checksums ?section cli from_cli =
mk_flag ~cli from_cli ?section ["require-checksums"]
"Reject the installation of packages that don't provide a checksum for\
the upstream archives. This is equivalent to setting \
$(b,\\$OPAMREQUIRECHECKSUMS) to \"true\"."

(* Options common to all build commands *)
let build_option_section = "PACKAGE BUILD OPTIONS"
let man_build_option_section =
Expand Down Expand Up @@ -1440,14 +1451,8 @@ let build_options cli =
affects packages that are explicitly listed on the command-line. \
This is equivalent to setting $(b,\\$OPAMINPLACEBUILD) to \"true\"."
in
let no_checksums =
mk_flag ~cli cli_original ~section ["no-checksums"]
"Do not verify the checksum of downloaded archives.\
This is equivalent to setting $(b,\\$OPAMNOCHECKSUMS) to \"true\"." in
let req_checksums =
mk_flag ~cli cli_original ~section ["require-checksums"]
"Reject the installation of packages that don't provide a checksum for the upstream archives. \
This is equivalent to setting $(b,\\$OPAMREQUIRECHECKSUMS) to \"true\"." in
let no_checksums = no_checksums ~section cli cli_original in
let req_checksums = require_checksums ~section cli cli_original in
let build_test =
mk_flag_replaced ~cli ~section [
cli_between cli2_0 cli2_1 ~replaced:"--with-test", ["build-test"];
Expand Down
6 changes: 6 additions & 0 deletions src/client/opamArg.mli
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ val apply_build_options: OpamCLIVersion.Sourced.t -> build_options -> unit
val locked: ?section:string -> OpamCLIVersion.Sourced.t -> bool Term.t
val lock_suffix: ?section:string -> OpamCLIVersion.Sourced.t -> string Term.t

(** Checksum options *)
val no_checksums:
?section:string -> OpamCLIVersion.Sourced.t -> validity -> bool Term.t
val require_checksums:
?section:string -> OpamCLIVersion.Sourced.t -> validity -> bool Term.t

(** {3 Package listing and filtering options} *)

(** Man section name *)
Expand Down

0 comments on commit eee0e46

Please sign in to comment.