Don't pass use_installed to every package handler function.
[febootstrap.git] / src / febootstrap_package_handlers.mli
1 (* febootstrap 3
2  * Copyright (C) 2009-2010 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  *)
18
19 (** Generic package handler code. *)
20
21 type package_handler = {
22   ph_detect : unit -> bool;
23   (** Detect if the current system uses this package manager.  This is
24       called in turn on each package handler, until one returns [true]. *)
25
26   ph_init : unit -> unit;
27   (** After a package handler is selected, this function is called
28       which can optionally do any initialization that is required.
29       This is only called on the package handler if it has returned
30       [true] from {!ph_detect}. *)
31
32   ph_resolve_dependencies_and_download : string list -> string list;
33   (** [ph_resolve_dependencies_and_download pkgs]
34       Take a list of package names, and using the package manager
35       resolve those to a list of all the packages that are required
36       including dependencies.  Download the full list of packages and
37       dependencies into a tmpdir.  Return the list of full filenames.
38
39       Note this should also process the [excludes] list. *)
40
41   ph_list_files : string -> (string * file_type) list;
42   (** [ph_list_files pkg] lists the files and file metadata in the
43       package called [pkg] (a package file). *)
44
45   ph_get_file_from_package : string -> string -> string;
46   (** [ph_get_file_from_package pkg file] extracts the
47       single named file [file] from [pkg].  The path of the
48       extracted file is returned. *)
49 }
50
51 (* These file types are inspired by the metadata specifically
52  * stored by RPM.  We should look at what other package formats
53  * can use too.
54  *)
55 and file_type = {
56   ft_dir : bool;               (** Is a directory. *)
57   ft_config : bool;            (** Is a configuration file. *)
58   ft_ghost : bool;             (** Is a ghost (created empty) file. *)
59   ft_mode : int;               (** File mode. *)
60   ft_size : int;               (** File size. *)
61 }
62
63 val register_package_handler : string -> package_handler -> unit
64   (** Register a package handler. *)
65
66 val check_system : unit -> unit
67   (** Check which package manager this system uses. *)
68
69 val get_package_handler : unit -> package_handler
70   (** Get the selected package manager for this system. *)
71
72 val get_package_handler_name : unit -> string
73   (** Get the name of the selected package manager for this system. *)