[Pkg-libvirt-commits] [libguestfs] 02/12: builder: move gpg status parsing within import_keyfile
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:11:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.29.42
in repository libguestfs.
commit a1a165e3c43d7743aa48ca18a97540b726cb0bf3
Author: Pino Toscano <ptoscano at redhat.com>
Date: Mon May 11 18:42:29 2015 +0200
builder: move gpg status parsing within import_keyfile
Parse the gpg status output directly within import_keyfile, returning
just the key fingerprint.
Just code motion, no actual behaviour changes.
---
builder/sigchecker.ml | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index 0c292fb..a1a4220 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -43,7 +43,17 @@ let import_keyfile ~gpg ~gpghome ~verbose keyfile =
let r = Sys.command cmd in
if r <> 0 then
error (f_"could not import public key\nUse the '-v' option and look for earlier error messages.");
- status_file
+ let status = read_whole_file status_file in
+ let status = string_nsplit "\n" status in
+ let fingerprint = ref "" in
+ List.iter (
+ fun line ->
+ let line = string_nsplit " " line in
+ match line with
+ | "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
+ | _ -> ()
+ ) status;
+ !fingerprint
let rec create ~verbose ~gpg ~gpgkey ~check_signature =
(* Create a temporary directory for gnupg. *)
@@ -69,18 +79,7 @@ let rec create ~verbose ~gpg ~gpgkey ~check_signature =
| No_Key ->
assert false
| KeyFile kf ->
- let status_file = import_keyfile gpg tmpdir verbose kf in
- let status = read_whole_file status_file in
- let status = string_nsplit "\n" status in
- let fingerprint = ref "" in
- List.iter (
- fun line ->
- let line = string_nsplit " " line in
- match line with
- | "[GNUPG:]" :: "IMPORT_OK" :: _ :: fp :: _ -> fingerprint := fp
- | _ -> ()
- ) status;
- !fingerprint
+ import_keyfile gpg tmpdir verbose kf
| Fingerprint fp ->
let filename = Filename.temp_file "vbpubkey" ".asc" in
unlink_on_exit filename;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list