helper: Print /modules when verbose >= 2
[febootstrap.git] / 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. *)
24
25   ph_resolve_dependencies_and_download : string list -> string list;
26   (** [ph_resolve_dependencies_and_download pkgs]
27       Take a list of package names, and using the package manager
28       resolve those to a list of all the packages that are required
29       including dependencies.  Download the full list of packages and
30       dependencies into a tmpdir.  Return the list of full filenames.
31
32       Note this should also process the [excludes] list. *)
33
34   ph_list_files : string -> (string * file_type) list;
35   (** [ph_list_files pkg] lists the files and file metadata in the
36       package called [pkg] (a package file). *)
37
38   ph_get_file_from_package : string -> string -> string;
39   (** [ph_get_file_from_package pkg file] extracts the
40       single named file [file] from [pkg].  The path of the
41       extracted file is returned. *)
42 }
43
44 (* These file types are inspired by the metadata specifically
45  * stored by RPM.  We should look at what other package formats
46  * can use too.
47  *)
48 and file_type = {
49   ft_dir : bool;               (** Is a directory. *)
50   ft_config : bool;            (** Is a configuration file. *)
51   ft_ghost : bool;             (** Is a ghost (created empty) file. *)
52   ft_mode : int;               (** File mode. *)
53 }
54
55 val register_package_handler : string -> package_handler -> unit
56   (** Register a package handler. *)
57
58 val check_system : unit -> unit
59   (** Check which package manager this system uses. *)
60
61 val get_package_handler : unit -> package_handler
62   (** Get the selected package manager for this system. *)
63
64 val get_package_handler_name : unit -> string
65   (** Get the name of the selected package manager for this system. *)