[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

On Tue, Jul 3, 2012 at 6:22 AM, Fabiano Fidêncio <fabiano fidencio org> wrote:
> ---------- Forwarded message ----------
> From: Fabiano Fidêncio <fabiano 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 redhat com>
> On Wed, Jun 13, 2012 at 7:35 AM, Daniel P. Berrange <berrange 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.

For that you can create add a utility function
osinfo_install_script_generate_to_path() that creates the GFile from
the path, calls  osinfo_install_script_generate and then frees the
GFile. Whats more important for apps is for all these I/O functions to
have async variants.


Zeeshan Ali (Khattak)
FSF member#5124

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]