Richard W.M. Jones
2014-Jul-07 18:30 UTC
Re: [Libguestfs] [PATCH] Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp
On Mon, Jul 07, 2014 at 07:53:52PM +0200, Pino Toscano wrote:> --- > builder/sigchecker.ml | 2 +- > sysprep/sysprep_operation_script.ml | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml > index c35d2da..08efa5d 100644 > --- a/builder/sigchecker.ml > +++ b/builder/sigchecker.ml > @@ -54,7 +54,7 @@ let import_keyfile ~gpg ~gpghome ~verbose keyfile > > let rec create ~verbose ~gpg ~gpgkey ~check_signature > (* Create a temporary directory for gnupg. *) > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // "vb.gpghome.XXXXXX") in > + let tmpdir = Mkdtemp.temp_dir "vb.gpghome." "" in > rmdir_on_exit tmpdir; > (* Make sure we have no check_signature=true with no actual key. *) > let check_signature, gpgkey > diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml > index d486a88..06d4dfc 100644 > --- a/sysprep/sysprep_operation_script.ml > +++ b/sysprep/sysprep_operation_script.ml > @@ -44,7 +44,7 @@ let rec script_perform ~verbose ~quiet (g : Guestfs.guestfs) root side_effects > match !scriptdir with > | Some dir -> dir, false > | None -> > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // "virt-sysprep.XXXXXX") in > + let tmpdir = Mkdtemp.temp_dir "virt-sysprep." "" in > tmpdir, true inACK both. Can we use ~prog as an argument to this new function? In most modules there is now a global 'prog' variable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Pino Toscano
2014-Jul-07 18:43 UTC
Re: [Libguestfs] [PATCH] Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp
On Monday 07 July 2014 19:30:38 Richard W.M. Jones wrote:> On Mon, Jul 07, 2014 at 07:53:52PM +0200, Pino Toscano wrote: > > --- > > > > builder/sigchecker.ml | 2 +- > > sysprep/sysprep_operation_script.ml | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml > > index c35d2da..08efa5d 100644 > > --- a/builder/sigchecker.ml > > +++ b/builder/sigchecker.ml > > @@ -54,7 +54,7 @@ let import_keyfile ~gpg ~gpghome ~verbose keyfile > > > > > > let rec create ~verbose ~gpg ~gpgkey ~check_signature > > > > (* Create a temporary directory for gnupg. *) > > > > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // > > "vb.gpghome.XXXXXX") in + let tmpdir = Mkdtemp.temp_dir > > "vb.gpghome." "" in > > > > rmdir_on_exit tmpdir; > > (* Make sure we have no check_signature=true with no actual key. > > *) > > let check_signature, gpgkey > > > > diff --git a/sysprep/sysprep_operation_script.ml > > b/sysprep/sysprep_operation_script.ml index d486a88..06d4dfc 100644 > > --- a/sysprep/sysprep_operation_script.ml > > +++ b/sysprep/sysprep_operation_script.ml > > @@ -44,7 +44,7 @@ let rec script_perform ~verbose ~quiet (g : > > Guestfs.guestfs) root side_effects => > > match !scriptdir with > > > > | Some dir -> dir, false > > | None -> > > > > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // > > "virt-sysprep.XXXXXX") in + let tmpdir = Mkdtemp.temp_dir > > "virt-sysprep." "" in> > > tmpdir, true in > > ACK both. > > Can we use ~prog as an argument to this new function? In most modules > there is now a global 'prog' variable.Hmm I'm not sure how it would be useful -- basically temp_dir is a "directory version" of Filename.temp_file (maybe I should have wrote that in the commit log of patch #1), so just base dir, prefix and suffix. -- Pino Toscano
Richard W.M. Jones
2014-Jul-07 20:42 UTC
Re: [Libguestfs] [PATCH] Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp
On Mon, Jul 07, 2014 at 08:43:06PM +0200, Pino Toscano wrote:> On Monday 07 July 2014 19:30:38 Richard W.M. Jones wrote: > > On Mon, Jul 07, 2014 at 07:53:52PM +0200, Pino Toscano wrote: > > > --- > > > > > > builder/sigchecker.ml | 2 +- > > > sysprep/sysprep_operation_script.ml | 2 +- > > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml > > > index c35d2da..08efa5d 100644 > > > --- a/builder/sigchecker.ml > > > +++ b/builder/sigchecker.ml > > > @@ -54,7 +54,7 @@ let import_keyfile ~gpg ~gpghome ~verbose keyfile > > > > > > > > > let rec create ~verbose ~gpg ~gpgkey ~check_signature > > > > > > (* Create a temporary directory for gnupg. *) > > > > > > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // > > > "vb.gpghome.XXXXXX") in + let tmpdir = Mkdtemp.temp_dir > > > "vb.gpghome." "" in > > > > > > rmdir_on_exit tmpdir; > > > (* Make sure we have no check_signature=true with no actual key. > > > *) > > > let check_signature, gpgkey > > > > > > diff --git a/sysprep/sysprep_operation_script.ml > > > b/sysprep/sysprep_operation_script.ml index d486a88..06d4dfc 100644 > > > --- a/sysprep/sysprep_operation_script.ml > > > +++ b/sysprep/sysprep_operation_script.ml > > > @@ -44,7 +44,7 @@ let rec script_perform ~verbose ~quiet (g : > > > Guestfs.guestfs) root side_effects => > > > match !scriptdir with > > > > > > | Some dir -> dir, false > > > | None -> > > > > > > - let tmpdir = Mkdtemp.mkdtemp (Filename.temp_dir_name // > > > "virt-sysprep.XXXXXX") in + let tmpdir = Mkdtemp.temp_dir > > > "virt-sysprep." "" in> > > > tmpdir, true in > > > > ACK both. > > > > Can we use ~prog as an argument to this new function? In most modules > > there is now a global 'prog' variable. > > Hmm I'm not sure how it would be useful -- basically temp_dir is a > "directory version" of Filename.temp_file (maybe I should have wrote > that in the commit log of patch #1), so just base dir, prefix and > suffix.OK, no problem. ACKed as it is. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org