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

Re: [Libguestfs] [PATCH] Mask some package names if appliance is build for SUSE



On Tue, Jun 11, 2013 at 04:24:38PM +0200, Olaf Hering wrote:
> On Tue, Jun 11, Olaf Hering wrote:
> 
> > On Tue, Jun 11, Richard W.M. Jones wrote:
> > 
> > > But supermin is supposed to ignore packages that don't exist in the
> > > distro.  This is a bug in supermin or the zypp plugin for supermin.
> 
> Related to this, zypper --xml gives the chance to parse the output. But
> doing it all in the shell is cumbersome. Right now there is no output if
> something fails.
> 
> Whats the best way to do "xml sel -t -m
> 'stream/install-summary/to-install/solvable[ type='\''package'\'']' -c
> 'string(@name)' -n" in ocaml itself?

Unfortunately there's no best (or even good) way.  Two ways are:

 - Use an external OCaml library.  Ones I would recommend are:
   XML Light (very simple), xmlm (not used it but active upstream), or
   PXP (very comprehensive but also very masochistic).

 - Run the external bash command above and try parsing the output
   using regexps or something.  Has the possible advantage of not needing
   any extra OCaml deps.

Does zypper have a C API?  Binding C APIs from OCaml is easy (or
at least much easier than dealing with XML).

> So zypper can write to a tmpfile
> and the .ml file can parse the xml output and process it as needed.
> 
> There is no obvious way to extract the "pkg not found" other than:
> <message type="error">No provider of &apos;gdisk&apos; found.</message>

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org


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