Olaf Hering
2013-Jun-11 14:07 UTC
Re: [Libguestfs] [PATCH] Mask some package names if appliance is build for SUSE
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.It looks like zypper has no "ignore unknown packages/provides" flag. zypper .. install $pkg is called with an unknown package then zypper will just abort because it expects valid input. Maybe there should be some code which iterates over "names" and lets zypper check for every single pkg and drop the ones which it can not resolve. Later the smaller "names" list can be passed to zypper. Are other plugins more forgiving in this? Olaf
Olaf Hering
2013-Jun-11 14:24 UTC
Re: [Libguestfs] [PATCH] Mask some package names if appliance is build for SUSE
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? 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 'gdisk' found.</message> Olaf
Richard W.M. Jones
2013-Jun-11 14:53 UTC
Re: [Libguestfs] [PATCH] Mask some package names if appliance is build for SUSE
On Tue, Jun 11, 2013 at 04:07:17PM +0200, 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. > > It looks like zypper has no "ignore unknown packages/provides" flag. > zypper .. install $pkg is called with an unknown package then zypper > will just abort because it expects valid input. > > Maybe there should be some code which iterates over "names" and lets > zypper check for every single pkg and drop the ones which it can not > resolve. Later the smaller "names" list can be passed to zypper. > > Are other plugins more forgiving in this?Yes. For example, the yum/RPM plugin does effectively this: #!/usr/bin/python import yum import yum.misc import sys yb = yum.YumBase () yb.setCacheDir () patterns = ["bash", "notarealpackage"] pkgs = yb.pkgSack.returnPackages (patterns=patterns, repoid=0) for pkg in pkgs: print pkg ... which prints (after ages, for yum is very slow): bash-4.2.39-3.fc18.x86_64 bash-4.2.45-1.fc18.x86_64 This is a feature of supermin, because it lets you have package lists that don't need to be heavily conditionalized based on the precise version of a distro, especially when packages are often being renamed (like util-linux -> util-linux-ng and back again). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Richard W.M. Jones
2013-Jun-11 15:00 UTC
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 'gdisk' 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
Seemingly Similar Threads
- Re: [PATCH] Mask some package names if appliance is build for SUSE
- [PATCH] handle --use-installed in zypp driver
- Re: [PATCH] Mask some package names if appliance is build for SUSE
- [PATCH] Mask some package names if appliance is build for SUSE
- [PATCH / RFC] Handle --packager-config in zypp_rpm