Up

module Distro

: sig

Generic code for interacting with distribution package managers.

#
type query = {
# elem
: [
| `package_impl
] Element.t
;
# package_name
: string;
# elem_props
: Impl.properties;
# feed
: Feed.feed;
# results
: Impl.distro_implementation Support.Common.StringMap.t Pervasives.ref;
}

Passed to distribution#get_package_impls. It provides details of the query and a place to collect the results.

#
type quick_test_condition =
# | Exists
# | UnchangedSince of float
#
type quick_test = Support.Common.filepath * quick_test_condition
#
class virtual distribution : General.config ->
#
val valid_package_name : Str.regexp

Only <package-implementation>s whose names match this regexp will be considered. The default disallows names starting with '.' or '-' or containing '/', to avoid potential problems with shell commands and path lookups.

#
val virtual check_host_python : bool
#
val virtual distro_name : string
#
val virtual id_prefix : string

All IDs will start with this string (e.g. "package:deb")

#
val system_paths : string list

Paths to search for missing binaries (i.e. the platform default for $PATH)

#
val packagekit : Packagekit.packagekit
#
method match_name : string -> bool

Can we use packages for this distribution? For example, MacPortsDistribution can use "MacPorts" and "Darwin" packages.

#
method is_installed : Selections.selection -> bool

Test whether this <selection> element is still valid. The default implementation tries to load the feed from the feed cache, calls distribution#get_impls_for_feed on it and checks whether the required implementation ID is in the returned map. Override this if you can provide a more efficient implementation.

#
method private get_package_impls : query -> unit

Add the implementations for this feed to query. Called by get_impls_for_feed once for each <package-implementation> element. This default implementation adds anything found previously by PackageKit.

#
method get_impls_for_feed : ?init:Impl.distro_implementation Support.Common.StringMap.t -> Feed.feed -> Impl.distro_implementation Support.Common.StringMap.t

Get the native implementations (installed or candidates for installation) for this feed. This default implementation finds the best <package-implementation> elements and calls get_package_impls on each one.

init add the results to this map, rather than starting with an empty one
#
method check_for_candidates : 'a . ui:(Packagekit.#ui as 'a) -> Feed.feed -> unit Lwt.t

Check (asynchronously) for available but currently uninstalled candidates. Once the returned promise resolves, the candidates should be included in future responses from get_package_impls.

#
method install_distro_packages : 'a . (Packagekit.#ui as 'a) -> string -> (Impl.distro_implementation * Impl.distro_retrieval_method) list -> [
| `ok
| `cancel
] Lwt.t

Install a set of packages of a given type (as set previously by check_for_candidates). Normally called only by the Distro.install_distro_packages function.

#
method is_valid_package_name : string -> bool

Check whether this name is possible for this distribution. The default implementation filters using valid_package_name.

#
method private get_correct_main : Impl.distro_implementation -> Impl.command -> Support.Common.filepath option

Called when an installed package is added, or when installation completes, to find the correct main value, since we might not be able to work it out before-hand. The default checks that the path exists and, if not, searches system_paths for it. Note: Only called if the implementation already has a "run" command.

#
method private add_package_implementation : ?id:string -> ?main:string -> query -> version:Version.t -> machine:string option -> quick_test:quick_test option -> package_state:Impl.package_state -> distro_name:string -> unit

Add a new Feed.implementation result to query.

#
val is_installed : General.config -> distribution -> Selections.selection -> bool

Check whether this <selection> is still valid. If the quick-test-* attributes are present, we use them to check. Otherwise, we call distribution#is_installed.

#
val install_distro_packages : distribution -> Packagekit.#ui -> Impl.distro_implementation list -> [
| `ok
| `cancel
] Lwt.t

Install these packages using the distribution's package manager. Sorts the implementations into groups by their type and then calls distribution#install_distro_packages once for each group.

#
val get_matching_package_impls : distribution -> Feed.feed -> ([
| `package_impl
] Element.t * Impl.properties) list

Return the <package-implementation> elements that best match this distribution.

end