On Wednesday 17 September 2014 13:17:38 Richard W.M. Jones wrote:
On Wed, Sep 17, 2014 at 01:58:24PM +0200, Pino Toscano wrote:
> Add a ph_fini callback to package handlers, so they can do teardown
> operations, if needed, at the very end of the supermin run.
>
> Currently all of the current package handlers do nothing.
> ---
>
> src/dpkg.ml | 1 +
> src/package_handler.ml | 10 ++++++++++
> src/package_handler.mli | 10 ++++++++++
> src/pacman.ml | 1 +
> src/rpm.ml | 1 +
> src/supermin.ml | 4 +++-
> 6 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/src/dpkg.ml b/src/dpkg.ml
> index 1bb3f7f..ed899cf 100644
> --- a/src/dpkg.ml
> +++ b/src/dpkg.ml
> @@ -191,6 +191,7 @@ let () =
>
> let ph = {
>
> ph_detect = dpkg_detect;
> ph_init = dpkg_init;
>
> + ph_fini = PHNoFini;
>
> ph_package_of_string = dpkg_package_of_string;
> ph_package_to_string = dpkg_package_to_string;
> ph_package_name = dpkg_package_name;
>
> diff --git a/src/package_handler.ml b/src/package_handler.ml
> index b1dffc0..74d68f4 100644
> --- a/src/package_handler.ml
> +++ b/src/package_handler.ml
> @@ -59,6 +59,7 @@ let file_source file =
>
> type package_handler = {
>
> ph_detect : unit -> bool;
> ph_init : settings -> unit;
>
> + ph_fini : ph_fini;
>
> ph_package_of_string : string -> package option;
> ph_package_to_string : package -> string;
> ph_package_name : package -> string;
>
> @@ -76,6 +77,9 @@ and ph_get_files =
>
> and ph_download_package =
>
> | PHDownloadPackage of (package -> string -> unit)
> | PHDownloadAllPackages of (PackageSet.t -> string -> unit)
>
> +and ph_fini =
> +| PHNoFini
> +| PHFini of (unit -> unit)
This is unnecessary, since you can write the default (no handler) as:
ph_fini = fun () -> ()
Actually that would be:
ph_fini = (fun () -> ());
(i.e. with parenthesis) otherwise I get the following:
ocamlfind ocamlopt -warn-error CDEFLMPSUVXYZ-3 -package unix,str \
-c rpm.ml -o rpm.cmx
File "rpm.ml", line 398, characters 4-24:
Error: Unbound value ph_package_of_string
--
Pino Toscano