Module B0_opam.File

opam file generation.

Generic representation

type value = [
| `Raw of string
| `B of bool
| `S of string
| `L of bool * value list
]

The type for opam values. In `L the boolean indicates whether line-by-line rendering should be forced.

type field = string * value

The type for opam fields. The field name and its value.

type section = string * string option * t

The type for opam sections. The section name, the optional string and the contents of the section.

and comment = string

The type for comments.

and item = [
| `Comment of comment
| `Field of field
| `Section of section
]

The type for items.

and t = item list

The type for generic opam file contents.

val gen_by : gen:string -> item

gen_by is a comment indicating it was generated by generator gen.

val v2 : item

v2 is opam-version: "2.0".

Formatting

val pp : t B00_std.Fmt.t

pp formats file contents.

val to_string : t -> string

to_string formats file contents to a string.

opam package files

val of_meta : B0_meta.t -> t

of_meta m is an opam file from m. Here's an account of how opam fields are populated by standard and B0_opam.Meta keys.

Besides the contents of B0_opam.Meta.append_file is appended after the definition of these fields.

val of_pack : B0_pack.t -> t

of_pack u XXX explain the details of field inference. For derivation could be done meta only but we might use a pack's units at some point.