[virt-tools-list] Fwd: [PATCH 09/10] Change osinfo_install_script_generate to write the output in a file

Fabiano Fidêncio fabiano at fidencio.org
Tue Jul 3 03:22:23 UTC 2012


---------- Forwarded message ----------
From: Fabiano Fidêncio <fabiano at fidencio.org>
Date: Sun, Jul 1, 2012 at 4:36 PM
Subject: Re: [virt-tools-list] [PATCH 09/10] Change
osinfo_install_script_generate to write the output in a file
To: "Daniel P. Berrange" <berrange at redhat.com>


On Wed, Jun 13, 2012 at 7:35 AM, Daniel P. Berrange <berrange at redhat.com> wrote:
> On Mon, Jun 11, 2012 at 11:23:10PM -0300, Fabiano Fidêncio wrote:
>>     For libosinfo API:
>>         Now, instead of return a string, writes that string in a file,
>>         passed as argument
>>
>>     For osinfo-install-script tool:
>>         The output will be wrote in:
>>             - Linuxes: <short_id>,ks
>>             - Windows 2k3r2 and older: windows.sif
>>             - Windows 2k8 and newer: windows.xml
>>
>>     It will be used to create, easily, multiple scripts, as used in:
>>     http://bugzilla-attachments.gnome.org/attachment.cgi?id=214681
>
> I was a bit dubious about this one at first, but seeing what you
> needed to do with the windows scripts, I understand now.
>
> If we follow my suggestion, of actually putting the required
> filename in the XML metadata, this API will need to change
> slightly too.

Sorry, It is not so clear to me. How could I set/get the filename in the XML?
Example: <template filename=<xsl:value-of select="config/filename"/>>?
Didn't test but I think I can't do this.

>
>> +gboolean osinfo_install_script_generate(OsinfoInstallScript *script,
>> +                                        OsinfoOs *os,
>> +                                        OsinfoInstallConfig *config,
>> +                                        gchar *path,
>> +                                        GCancellable *cancellable,
>> +                                        GError **error);
>
>
> I'd suggest it should take a 'GFile *outputdir' parameter,
> and then for each template filename listed in the XML,
> we generate  'outputdir/filename'.  Using GFile is preferrable
> to gchar *path, since then we're not tied to local paths - apps
> can use any URI scheme supported by GIO.

Thinking here, we really need this change?
osinfo_install_script_generate can just return the string. Why?
Because it is what the apps will use, commonly.
If some application (as osinfo-install-scirpt tool) would write the
output in the file, we could do it in their own code, adopting your
suggestion.
Another thing is: if we will set/get the filename we could not pass
the "filename" as argument, too?

>
>
> Daniel
> --
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



--
Fabiano Fidêncio


-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list