Module Dose_pef.Packages

Exceptions

exception IgnorePackage of string

IgnorePackage error message

Common Parsing Functions

val parse_string : Dose_extra.Format822.field -> string
val parse_string_opt : Dose_extra.Format822.field -> string option
val parse_string_list : ?rex:Re.re -> Dose_extra.Format822.field -> string list
val parse_int : Dose_extra.Format822.field -> int
val parse_int_s : Dose_extra.Format822.field -> string
val parse_bool : Dose_extra.Format822.field -> bool
val parse_bool_s : Dose_extra.Format822.field -> string

Generic Parsing Functions

val lexbuf_wrapper : ((Stdlib.Lexing.lexbuf -> Packages_parser.token) -> Stdlib.Lexing.lexbuf -> 'a) -> Dose_extra.Format822.field -> 'a
val blank_regexp : Re.re
val comma_regexp : Re.re
type parse_extras_f = string -> Dose_extra.Format822.stanza -> string

Parsing function for extra values. An extra value can only be a string. Ex. parse_s ?required:true parse_string

val parse_e : (string * parse_extras_f option) list -> Dose_extra.Format822.stanza -> (string * string) list
val parse_s : ?default:'a -> ?required:bool -> (Dose_extra.Format822.field -> 'a) -> string -> Dose_extra.Format822.stanza -> 'a

parse_s is a generic function used to extract and parse a field from a stanza and cast it to a value. ?default assign a default value if the field is absent. The function raise ParseError if ?required is true ( default false ) and the field is absent and no default is given. parse_s gets a parsing function, a label and a stanza and returns the value associated to the label.

val get_field_value : parse:(string -> Dose_extra.Format822.stanza -> 'a) -> par:Dose_extra.Format822.stanza -> field:(string * 'a option) -> string * 'a

get_field_value is a generic function used to extract and parse values from a Format822.stanza. It gets a parsing function parse, a stanza par and a tuple field where the first element is the label associated to the value to be parsed and the second element is a parsed value. If the parsed value is not none, the the function returns it directly together with the associated label. Otherwise the function will use the parsing function to extract the value from the stanza. This function is used to initialize a package object with certains defaults values without parsing the entire stanza.

Generic Parsing Functions

class package : ?name:(string * Packages_types.name option) -> ?version:(string * Packages_types.version option) -> ?installed:(string * Packages_types.installed option) -> ?depends:(string * Packages_types.vpkgformula option) -> ?conflicts:(string * Packages_types.vpkglist option) -> ?provides:(string * Packages_types.vpkglist option) -> ?recommends:(string * Packages_types.vpkgformula option) -> ?extras:((string * parse_extras_f option) list * (string * string) list option) -> Dose_extra.Format822.stanza -> object ... end

Representation of a PEF package. This object gets a stanza (a list of list of fields) and return a pef object. Each field can be directly initialized using the optional arguments, providing the name of the field and an optional value. If the value is None, then the value is computed by parsing the corresponding field in the 822 stanza. Otherwise, the field is initialized using the given value (and ignoring the value in the 822 stanza).

val parse_package_stanza : filter:(Dose_extra.Format822.stanza -> bool) option -> extras:(string * (string -> Dose_extra.Format822.stanza -> string) option) list -> Dose_extra.Format822.stanza -> package option
val input_raw : ?extras:(string * (string -> Dose_extra.Format822.stanza -> string) option) list -> string list -> package list

Read n files from disk and return the list of all unique packages. Extras have the same format as in parse_package_stanza

val parse_packages_in : ?filter:(Dose_extra.Format822.stanza -> bool) -> ?extras:(string * (string -> Dose_extra.Format822.stanza -> string) option) list -> string -> IO.input -> package list

same as parse_package_stanza but read packages stanzas from the given IO channel

val input_raw_in : ?extras:(string * (string -> Dose_extra.Format822.stanza -> string) option) list -> IO.input -> package list

input_raw_in behaves as input_raw but read the packages stanzas from the given IO channel

Low Level Parsing Functions

val packages_parser : string -> (Dose_extra.Format822.stanza -> 'package option) -> Dose_extra.Format822.f822_parser -> 'package list