Mailinglist Archive: zypp-devel (21 mails)

< Previous Next >
Re: [zypp-devel] How to use libzypp-bindings to create a sysroot from a repo?
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Tue, 19 Oct 2010 13:55:47 +0200
  • Message-id: <20101019115547.GA31181@xxxxxxxxxxxxx>
* Klaus Kaempf <kkaempf@xxxxxxx> [Oct 14. 2010 13:28]:
* Michael Andres <ma@xxxxxxx> [Oct 14. 2010 13:22]:

That's a bug in the bindings, we try to fix this ASAP.

Here libzypps strict typing gets into the way.
zypp.KeyRing.ACCEPT_UNSIGNED_FILE refers to the DefaultAcceptBits enum
and appears as Integer in Python.

However, zypp.KeyRing.setDefaultAccept() expects a 'DefaultAccept' type
and swig cannot sufficiently decode zypp/KeyRing.h to provide an
automatic type conversion.

A quick solution is to provide an explicit type conversion function,
e.g.

%inline %{
zypp::KeyRing::DefaultAccept toDefaultAccept(int bits) {
return (zypp::KeyRing::DefaultAccept)
static_cast<zypp::KeyRing::DefaultAccept>(bits);
}
%}

and use this in the sample code as

zypp.KeyRing_setDefaultAccept(zypp.toDefaultAccept(zypp.KeyRing.ACCEPT_UNSIGNED_FILE
| zypp.KeyRing.ACCEPT_VERIFICATION_FAILED) )
^^^^^^^^^^^^^^^^^^^^

A more elaborate solution would involve SWIG typemaps
(http://www.swig.org/Doc1.3/Typemaps.html)


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups