package opam-format

  1. Overview
  2. Docs

Repository metadata

include IO_FILE
type t

File contents

val format_version : OpamVersion.t
val empty : t

Empty file

val write : t typed_file -> t -> unit

Write some contents to a file

val read : t typed_file -> t

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

val read_opt : t typed_file -> t option

Returns None on non-existing file

val safe_read : t typed_file -> t

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

val read_from_channel : ?filename:t typed_file -> in_channel -> t
val read_from_string : ?filename:t typed_file -> string -> t
val write_to_channel : ?filename:t typed_file -> out_channel -> t -> unit
val write_to_string : ?filename:t typed_file -> t -> string
val create : ?browse:string -> ?upstream:string -> ?opam_version:OpamVersion.t -> ?redirect:(string * OpamTypes.filter option) list -> ?root_url:OpamTypes.url -> ?dl_cache:string list -> ?announce:(string * OpamTypes.filter option) list -> ?stamp:string -> unit -> t
val opam_version : t -> OpamVersion.t option

The minimum OPAM version required for this repository, if defined

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 root_url : t -> OpamTypes.url option

The root URL of the repository (not an actual file field, determined at runtime by opam)

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

Redirections.

val dl_cache : t -> string list

Cache URLs, either full or relative to the repo root

val announce : t -> (string * OpamTypes.filter option) list
val stamp : t -> string option
val with_opam_version : OpamVersion.t -> t -> t
val with_browse : string -> t -> t
val with_upstream : string -> t -> t
val with_redirect : (string * OpamTypes.filter option) list -> t -> t
val with_root_url : OpamTypes.url -> t -> t
val with_dl_cache : string list -> t -> t
val with_announce : (string * OpamTypes.filter option) list -> t -> t
val with_stamp : string -> t -> t
val with_stamp_opt : string option -> t -> t