# Module OpamFile.OPAM

    module OPAM: sig .. end

OPAM files

    include OpamFile.IO_FILE

    val empty : t

    val create : OpamTypes.package -> t

Create an opam file

    val template : OpamTypes.package -> t

Create an OPAM package template filled with common options

    val validate : t -> (int * [ `Error | `Warning ] * 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 validate_file : OpamTypes.filename -> (int * [ `Error | `Warning ] * string) list * t option

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

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

Utility function to print validation results

    val is_explicit : OpamTypes.filename -> bool

Returns true if the given OPAM file contains 'name' or 'version' fields

    val opam_version : t -> OpamTypes.opam_version

Get OPAM version.

    val name : t -> OpamTypes.name

Package name

    val name_opt : t -> OpamTypes.name option

    val version : t -> OpamTypes.version

Package version

    val version_opt : t -> OpamTypes.version option

    val ocaml_version : t -> OpamTypes.compiler_constraint option

Compiler constraint

    val os : t -> (bool * string) OpamTypes.generic_formula

OS constraint

    val available : t -> OpamTypes.filter

Availability formula (OS + compiler constraints)

    val maintainer : t -> string list

Package maintainer(s)

    val substs : t -> OpamTypes.basename list

File substitutions

    val build_env : t -> (string * string * string) list

List of environment variables to set-up for the build

    val build : t -> OpamTypes.command list

List of command to run for building the package

    val install : t -> OpamTypes.command list

List of command to run for installing the package

    val remove : t -> OpamTypes.command list

List of command to run for removing the package

    val depends : t -> OpamTypes.ext_formula

Package dependencies

    val depopts : t -> OpamTypes.ext_formula

Optional dependencies

    val depexts : t -> OpamTypes.tags option

External dependencies

    val with_messages : t -> (string * OpamTypes.filter option) list -> t

    val with_post_messages : t -> (string * OpamTypes.filter option) list -> t

    val conflicts : t -> OpamTypes.formula

Package conflicts

    val features : t -> (OpamVariable.t * string * OpamTypes.filter) list

Contents of the 'features' field

    val libraries : t -> (string * OpamTypes.filter option) list

List of exported libraries

    val syntax : t -> (string * OpamTypes.filter option) list

List of exported syntax extensions

    val patches : t -> (OpamTypes.basename * OpamTypes.filter option) list

Patches

    val homepage : t -> string list

Homepage(s)

    val author : t -> string list

Author(s)

    val license : t -> string list

License(s)

    val doc : t -> string list

API documentation

    val tags : t -> string list

Classification tags

    val build_test : t -> OpamTypes.command list

Commands to build and run the tests

    val build_doc : t -> OpamTypes.command list

Commands to build the documentation

    val messages : t -> (string * OpamTypes.filter option) list

Messages to display before taking action

    val post_messages : t -> (string * OpamTypes.filter option) list

Messages to display at end of install

    val bug_reports : t -> string list

Where to post bug reports.

    val flags : t -> OpamTypes.package_flag list

The package flags that are present for this package.

    val has_flag : OpamTypes.package_flag -> t -> bool

Check the package for the given flag. Allows flags specified through tags for compatibility

    val with_opam_version : t -> OpamTypes.opam_version -> t

Sets the opam version

    val dev_repo : t -> OpamTypes.pin_option option

The package source repository address

    val with_name : t -> OpamTypes.name -> t

construct as `name`

    val with_name_opt : t -> OpamTypes.name option -> t

    val with_version : t -> OpamTypes.version -> t

construct as `version`

    val with_version_opt : t -> OpamTypes.version option -> t

    val with_depends : t -> OpamTypes.ext_formula -> t

Construct as `depends`

    val with_depopts : t -> OpamTypes.ext_formula -> t

Construct as `depopts`

    val with_conflicts : t -> OpamTypes.formula -> t

    val with_features : t -> (OpamVariable.t * string * OpamTypes.filter) list -> t

    val with_build : t -> OpamTypes.command list -> t

Construct as `build`

    val with_install : t -> OpamTypes.command list -> t

    val with_remove : t -> OpamTypes.command list -> t

Construct as `remove`

    val with_libraries : t -> (string * OpamTypes.filter option) list -> t

Construct as `libraries`

    val with_syntax : t -> (string * OpamTypes.filter option) list -> t

Replace the `syntax` field of the given OPAM file.

    val with_substs : t -> OpamTypes.basename list -> t

Construct as `substs`

    val with_ocaml_version : t -> OpamTypes.compiler_constraint option -> t

Construct as `compiler_version`

    val with_os : t -> (bool * string) OpamTypes.generic_formula -> t

    val with_available : t -> OpamTypes.filter -> t

    val with_maintainer : t -> string list -> t

Construct as `maintainer`

    val with_patches : t -> (OpamTypes.basename * OpamTypes.filter option) list -> t

Construct as `patches`

    val with_bug_reports : t -> string list -> t

Construct using `bug_reports`

    val with_depexts : t -> OpamTypes.tags option -> t

Construct using `depexts`

    val with_flags : t -> OpamTypes.package_flag list -> t

    val with_dev_repo : t -> OpamTypes.pin_option option -> t

    val to_1_0 : OpamTypes.file -> OpamTypes.file

Convert to OPAM 1.0