package opam-state

  1. Overview
  2. Docs

Tools for manipulating and checking package definition ("opam") files

Create an OPAM package template filled with common options

val lint : OpamFile.OPAM.t -> (int * [ `Warning | `Error ] * string) list

Runs several sanity checks on the opam file; returns a list of warnings. `Error level should be considered unfit for publication, while `Warning are advisory but may be accepted. The int is an identifier for this specific warning/error.

val lint_file : OpamFile.OPAM.t OpamFile.typed_file -> (int * [ `Warning | `Error ] * string) list * OpamFile.OPAM.t option

Same as lint, but operates on a file, which allows catching parse errors too. You can specify an expected name and version

val lint_channel : OpamFile.OPAM.t OpamFile.typed_file -> Pervasives.in_channel -> (int * [ `Warning | `Error ] * string) list * OpamFile.OPAM.t option

Same as lint_file, but taking input from a channel

val lint_string : OpamFile.OPAM.t OpamFile.typed_file -> string -> (int * [ `Warning | `Error ] * string) list * OpamFile.OPAM.t option

Like lint_file, but takes the file contents as a string

val warns_to_string : (int * [ `Warning | `Error ] * string) list -> string

Utility function to print validation results

val read_opam : OpamTypes.dirname -> OpamFile.OPAM.t option

Read the opam metadata from a given directory (opam file, with possible overrides from url and descr files). Also includes the names and hashes of files below files/

val add_aux_files : ?dir:OpamTypes.dirname -> OpamFile.OPAM.t -> OpamFile.OPAM.t

Adds (or overrides) data from url, descr or files/ in the specified dir or the opam file's metadata dir (only files and hashes are included for files below files/)

Tools to manipulate the OpamFile.OPAM.t contents

OCaml

Innovation. Community. Security.