2 * Copyright (C) 2009-2010 Red Hat Inc.
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.
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.
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
19 (** Generic package handler code. *)
21 type package_handler = {
22 ph_detect : unit -> bool;
23 (** Detect if the current system uses this package manager. *)
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.
32 Note this should also process the [excludes] list. *)
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). *)
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. *)
44 (* These file types are inspired by the metadata specifically
45 * stored by RPM. We should look at what other package formats
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 ft_size : int; (** File size. *)
56 val register_package_handler : string -> package_handler -> unit
57 (** Register a package handler. *)
59 val check_system : unit -> unit
60 (** Check which package manager this system uses. *)
62 val get_package_handler : unit -> package_handler
63 (** Get the selected package manager for this system. *)
65 val get_package_handler_name : unit -> string
66 (** Get the name of the selected package manager for this system. *)