[Libguestfs] [PATCH] builder: move the gpgkey_type type from Sigchecker to Utils
Richard W.M. Jones
rjones at redhat.com
Fri Oct 31 16:19:27 UTC 2014
On Fri, Oct 31, 2014 at 04:30:15PM +0100, Pino Toscano wrote:
> No functional change, just code motion.
> ---
> builder/builder.ml | 6 +++---
> builder/list_entries.ml | 12 ++++++------
> builder/list_entries.mli | 2 +-
> builder/sigchecker.ml | 5 -----
> builder/sigchecker.mli | 7 +------
> builder/utils.ml | 5 +++++
> 6 files changed, 16 insertions(+), 21 deletions(-)
>
> diff --git a/builder/builder.ml b/builder/builder.ml
> index d7d8fb2..9a77a23 100644
> --- a/builder/builder.ml
> +++ b/builder/builder.ml
> @@ -154,13 +154,13 @@ let main () =
> fun { Sources.uri = uri; Sources.gpgkey = gpgkey; Sources.proxy = proxy } ->
> let gpgkey =
> match gpgkey with
> - | None -> Sigchecker.No_Key
> - | Some key -> Sigchecker.KeyFile key in
> + | None -> Utils.No_Key
> + | Some key -> Utils.KeyFile key in
> uri, gpgkey, proxy
> ) repos in
> let sources = List.map (
> fun (source, fingerprint) ->
> - source, Sigchecker.Fingerprint fingerprint, Downloader.SystemProxy
> + source, Utils.Fingerprint fingerprint, Downloader.SystemProxy
> ) sources in
> let sources = List.append repos sources in
> let index : Index_parser.index =
> diff --git a/builder/list_entries.ml b/builder/list_entries.ml
> index 2727c9f..2f8107f 100644
> --- a/builder/list_entries.ml
> +++ b/builder/list_entries.ml
> @@ -50,10 +50,10 @@ and list_entries_long ~sources index =
> fun (source, key, proxy) ->
> printf (f_"Source URI: %s\n") source;
> (match key with
> - | Sigchecker.No_Key -> ()
> - | Sigchecker.Fingerprint fp ->
> + | Utils.No_Key -> ()
> + | Utils.Fingerprint fp ->
> printf (f_"Fingerprint: %s\n") fp;
> - | Sigchecker.KeyFile kf ->
> + | Utils.KeyFile kf ->
> printf (f_"Key: %s\n") kf;
> );
> printf "\n"
> @@ -103,10 +103,10 @@ and list_entries_json ~sources index =
> let item = [ "uri", JSON.String source ] in
> let item =
> match key with
> - | Sigchecker.No_Key -> item
> - | Sigchecker.Fingerprint fp ->
> + | Utils.No_Key -> item
> + | Utils.Fingerprint fp ->
> ("fingerprint", JSON.String fp) :: item
> - | Sigchecker.KeyFile kf ->
> + | Utils.KeyFile kf ->
> ("key", JSON.String kf) :: item in
> JSON.Dict item
> ) sources in
> diff --git a/builder/list_entries.mli b/builder/list_entries.mli
> index ce012c4..520eb33 100644
> --- a/builder/list_entries.mli
> +++ b/builder/list_entries.mli
> @@ -16,4 +16,4 @@
> * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> *)
>
> -val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Sigchecker.gpgkey_type * Downloader.proxy_mode) list -> Index_parser.index -> unit
> +val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Utils.gpgkey_type * Downloader.proxy_mode) list -> Index_parser.index -> unit
> diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
> index 489da28..0c292fb 100644
> --- a/builder/sigchecker.ml
> +++ b/builder/sigchecker.ml
> @@ -24,11 +24,6 @@ open Utils
> open Printf
> open Unix
>
> -type gpgkey_type =
> - | No_Key
> - | Fingerprint of string
> - | KeyFile of string
> -
> type t = {
> verbose : bool;
> gpg : string;
> diff --git a/builder/sigchecker.mli b/builder/sigchecker.mli
> index 5b1885b..4eb7a88 100644
> --- a/builder/sigchecker.mli
> +++ b/builder/sigchecker.mli
> @@ -18,12 +18,7 @@
>
> type t
>
> -type gpgkey_type =
> - | No_Key
> - | Fingerprint of string
> - | KeyFile of string
> -
> -val create : verbose:bool -> gpg:string -> gpgkey:gpgkey_type -> check_signature:bool -> t
> +val create : verbose:bool -> gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> t
>
> val verify : t -> string -> unit
> (** Verify the file is signed (if check_signature is true). *)
> diff --git a/builder/utils.ml b/builder/utils.ml
> index f4f290d..8962636 100644
> --- a/builder/utils.ml
> +++ b/builder/utils.ml
> @@ -22,6 +22,11 @@ open Printf
>
> open Common_utils
>
> +type gpgkey_type =
> + | No_Key
> + | Fingerprint of string
> + | KeyFile of string
> +
> let prog = Filename.basename Sys.executable_name
> let error ?exit_code fs = error ~prog ?exit_code fs
> let warning fs = warning ~prog fs
> --
> 1.9.3
ACK, just code motion.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list