Up

module OpamFile

: sig

Functions to read and write OPAM configuration files in a typed way

#
module type IO_FILE = sig

All Configuration files satisfies this signature

#
type t

File contents

#
val empty : t

Empty file

#
val write : OpamTypes.filename -> t -> unit

Write some contents to a file

#
val read : OpamTypes.filename -> t

Read file contents. Raise an error if the file does not exist.

#
val safe_read : OpamTypes.filename -> t

Read file contents. Return empty if the file does not exist.

#
val read_from_channel : Pervasives.in_channel -> t

Read from channel.

#
val write_to_channel : Pervasives.out_channel -> t -> unit

Write to channel.

end
#
module Lines : IO_FILE with type t = string list list

Lines of space-separated words.

#
module Config : sig

Configuration file: $opam/config

include IO_FILE
#
val create : OpamTypes.switch -> OpamTypes.repository_name list -> ?criteria:(OpamTypes.solver_criteria * string) list -> ?solver:string -> int -> int -> t

Creation

#
val with_switch : t -> OpamTypes.switch -> t

OCaml switch updates

#
val with_repositories : t -> OpamTypes.repository_name list -> t

Repository updates

#
val with_current_opam_version : t -> t

Update opam-version to the current one

#
val with_criteria : t -> (OpamTypes.solver_criteria * string) list -> t
#
val with_solver : t -> string option -> t
#
val opam_version : t -> OpamTypes.opam_version

Return the OPAM version

#
val repositories : t -> OpamTypes.repository_name list

Return the list of repository

#
val switch : t -> OpamTypes.switch

Return the OCaml switch

#
val jobs : t -> int

Return the number of jobs

#
val dl_jobs : t -> int

Return the number of download jobs

#
val criteria : t -> (OpamTypes.solver_criteria * string) list
#
val solver : t -> string option
end
#
module OPAM : sig

OPAM files

include IO_FILE
#
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 -> string list

Runs several sanity checks on the opam file; returns a list of warnings

#
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 conflicts : t -> OpamTypes.formula

Package conflicts

#
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 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_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_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

end
#
module Descr : sig

Package descriptions: $opam/descr/

include IO_FILE
#
val of_string : string -> t

Create an abstract description file from a string

#
val synopsis : t -> string

Return the first line

#
val body : t -> string

Return the body

#
val full : t -> string

Return the full description

end
#
module Aliases : IO_FILE with type t = OpamTypes.compiler OpamTypes.switch_map

Compiler aliases: $opam/aliases

#

Import/export file. This difference with installed is that we are explicit about root packages.

#
module Installed : IO_FILE with type t = OpamTypes.package_set

List of installed packages: $opam/$oversion/installed

#
module Installed_roots : IO_FILE with type t = OpamTypes.package_set

List of packages explicitly installed by the user: $opam/$switch/installed.user

#
module Reinstall : IO_FILE with type t = OpamTypes.package_set

List of packages to reinstall: $opam/$oversion/reinstall

#
module Comp : sig

Compiler version $opam/compilers/

include IO_FILE
#
val create_preinstalled : OpamTypes.compiler -> OpamTypes.compiler_version -> OpamTypes.name list -> (string * string * string) list -> t

Create a pre-installed compiler description file

#
val preinstalled : t -> bool

Is it a pre-installed compiler description file

#
val opam_version : t -> OpamTypes.opam_version

Get OPAM version

#
val name : t -> OpamTypes.compiler

Return the compiler name

#
val version : t -> OpamTypes.compiler_version

Return the compiler version

#
val src : t -> OpamTypes.address option

Return the url of the compiler

#
val kind : t -> OpamTypes.repository_kind

Return the url kind

#
val patches : t -> OpamTypes.filename list

Return the list of patches to apply

#
val configure : t -> string list

Options to give to the "./configure" command

#
val make : t -> string list

Options to give to the "make" command

#
val build : t -> OpamTypes.command list

Options to give to build the package. If this one is provided, nothing should be specified for configure and make.

#
val packages : t -> OpamTypes.formula

Packages to install immediately after the creation of OCaml

#
val env : t -> (string * string * string) list

Environment variable to set-up before running commands in the subtree

#
val to_1_0 : OpamTypes.file -> OpamTypes.file

Convert to OPAM 1.0

end

Configuration files

#
module Dot_install : sig

.install files

include IO_FILE
#
val bin : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of files to install in $bin/

#
val sbin : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of files to install in $sbin/

#
val lib : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of files to install in $lib/

#
val toplevel : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of toplevel files

#
val stublibs : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

C bindings

#
val share : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of architecture-independent files

#
val share_root : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of files under the more general share prefix

#
val etc : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of etc files

#
val doc : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

List of doc files

#
val man : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.basename option) list

Man pages

#
val misc : t -> (OpamTypes.basename OpamTypes.optional * OpamTypes.filename) list

List of other files to install

end
#
module Dot_config : sig

.config files

include IO_FILE
#
val create : (OpamTypes.variable * OpamTypes.variable_contents) list -> t

Create a new .config file (containing only variables)

#
val variable : t -> OpamTypes.variable -> OpamTypes.variable_contents option

Top-level variables

#
val variables : t -> OpamTypes.variable list

The list of top-level variables

end

Repository files

#
module Package_index : IO_FILE with type t = (OpamTypes.repository_name * string option) OpamTypes.package_map

Association between package names and repositories

#
module Compiler_index : IO_FILE with type t = (OpamTypes.repository_name * string option) OpamTypes.compiler_map

Association between compiler names and repositories

#
module Repo_config : IO_FILE with type t = OpamTypes.repository

Repository config: $opam/repo/$repo/config

#
module Pinned : IO_FILE with type t = OpamTypes.pin_option OpamTypes.name_map

Pinned package files

#
module Repo : sig

Repository metadata

include IO_FILE
#
val create : ?browse:string -> ?upstream:string -> ?opam_version:string -> ?redirect:(string * OpamTypes.filter option) list -> unit -> t
#
val opam_version : t -> OpamVersion.t

The minimum OPAM version required for this repository

#
val browse : t -> string option

Base URL for browsing packages on the WWW

#
val upstream : t -> string option

Base URL for browsing OPAM repository source on the WWW

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

Redirections.

end

Substitution files

#
module Subst : sig

Substitution files

include IO_FILE
#
val replace : t -> (OpamTypes.full_variable -> OpamTypes.variable_contents) -> t

Substitute the variables appearing in a file

#
val replace_string : string -> (OpamTypes.full_variable -> OpamTypes.variable_contents) -> string

Substitute the variables appearing in a string

end
#
module URL : sig

Urls for OPAM repositories

include IO_FILE
#
val create : OpamTypes.repository_kind -> ?mirrors:OpamTypes.address list -> OpamTypes.address -> t
#
val url : t -> OpamTypes.address

URL address

#
val mirrors : t -> OpamTypes.address list
#
val kind : t -> OpamTypes.repository_kind

Backend kind (could be curl/rsync/git/darcs/hg at the moment)

#
val checksum : t -> string option

Archive checksum

#
val with_checksum : t -> string -> t

Constructor

end
#
module File_attributes : IO_FILE with type t = OpamTypes.file_attribute_set

urls.txt file *

#
module Filenames : IO_FILE with type t = OpamTypes.filename_set

List of filenames

#
module Prefix : IO_FILE with type t = string OpamTypes.name_map

Prefix of package directories

#
val print_stats : unit -> unit

Display statistics about file access.

end