summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--swig/Atom.i20
-rw-r--r--swig/Language.i26
-rw-r--r--swig/Message.i26
-rw-r--r--swig/Pattern.i43
-rw-r--r--swig/PoolItem.i9
-rw-r--r--swig/Product.i68
-rw-r--r--swig/ResObject.i29
-rw-r--r--swig/ResStatus.i16
-rw-r--r--swig/ResTraits.i66
-rw-r--r--swig/Script.i0
-rw-r--r--swig/SrcPackage.i25
-rw-r--r--swig/zypp.i24
12 files changed, 299 insertions, 53 deletions
diff --git a/swig/Atom.i b/swig/Atom.i
new file mode 100644
index 0000000..83aa460
--- /dev/null
+++ b/swig/Atom.i
@@ -0,0 +1,20 @@
+ class Atom : public ResObject
+ {
+ public:
+ typedef detail::AtomImplIf Impl;
+ typedef Atom Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ protected:
+ Atom( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~Atom();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/Language.i b/swig/Language.i
new file mode 100644
index 0000000..8fabb7f
--- /dev/null
+++ b/swig/Language.i
@@ -0,0 +1,26 @@
+ class Language : public ResObject
+ {
+ public:
+ typedef detail::LanguageImplIf Impl;
+ typedef Language Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ /** Installed Language instance. */
+ static Ptr installedInstance( const Locale & locale_r );
+ /** Available Language instance. */
+ static Ptr availableInstance( const Locale & locale_r );
+
+ protected:
+ /** Ctor */
+ Language( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~Language();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/Message.i b/swig/Message.i
new file mode 100644
index 0000000..5feaa9b
--- /dev/null
+++ b/swig/Message.i
@@ -0,0 +1,26 @@
+ class Message : public ResObject
+ {
+ public:
+ typedef detail::MessageImplIf Impl;
+ typedef Message Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ /** Get the text of the message */
+ TranslatedText text() const;
+ /** Patch the message belongs to - if any */
+ Patch::constPtr patch() const;
+
+ protected:
+ Message( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~Message();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/Pattern.i b/swig/Pattern.i
new file mode 100644
index 0000000..28edfd2
--- /dev/null
+++ b/swig/Pattern.i
@@ -0,0 +1,43 @@
+ class Pattern : public ResObject
+ {
+ public:
+ typedef detail::PatternImplIf Impl;
+ typedef Pattern Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ /** */
+ bool isDefault() const;
+ /** */
+ bool userVisible() const;
+ /** */
+ std::string category() const;
+ /** */
+ Pathname icon() const;
+ /** */
+ Pathname script() const;
+ /** */
+ Label order() const;
+
+ /** \deprecated AFAIK unused old Selection interface method. */
+ std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
+
+ /** Ui hint. */
+ const CapSet & includes() const;
+ /** Ui hint. */
+ const CapSet & extends() const;
+
+ protected:
+ /** Ctor */
+ Pattern( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~Pattern();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/PoolItem.i b/swig/PoolItem.i
index ded8859..d766fb3 100644
--- a/swig/PoolItem.i
+++ b/swig/PoolItem.i
@@ -56,3 +56,12 @@ class PoolItem_Ref
typedef PoolItem_Ref PoolItem;
+%extend PoolItem_Ref
+{
+ std::string asString() const
+ {
+ std::ostringstream str;
+ str << *self;
+ return str.str();
+ }
+} \ No newline at end of file
diff --git a/swig/Product.i b/swig/Product.i
new file mode 100644
index 0000000..d6768b8
--- /dev/null
+++ b/swig/Product.i
@@ -0,0 +1,68 @@
+ class Product : public ResObject
+ {
+ public:
+ typedef detail::ProductImplIf Impl;
+ typedef Product Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ /** Get the product type (base, add-on) */
+ std::string type() const;
+ /** \deprecated Use \ref type. */
+ std::string category() const
+ { return type(); }
+
+ /** Get the vendor of the product */
+ Label vendor() const;
+
+ /** The URL to download the release notes for this product */
+ Url releaseNotesUrl() const;
+
+ /**
+ * Online updates for the product.
+ * They are complementary, not alternatives. #163192
+ */
+ std::list<Url> updateUrls() const;
+
+ /**
+ * Additional software for the product
+ * They are complementary, not alternatives.
+ */
+ std::list<Url> extraUrls() const;
+
+ /**
+ * Optional software for the product
+ * (for example. Non OSS repositories)
+ * They are complementary, not alternatives.
+ */
+ std::list<Url> optionalUrls() const;
+
+ /** The product flags */
+ std::list<std::string> flags() const;
+
+ /** */
+ Label shortName() const;
+
+ /** */
+ Label longName() const;
+
+ /** Vendor specific distribution id. */
+ std::string distributionName() const;
+
+ /** Vendor specific distribution version. */
+ Edition distributionEdition() const;
+
+ protected:
+ /** Ctor */
+ Product( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~Product();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/ResObject.i b/swig/ResObject.i
index 824b31f..bec5e39 100644
--- a/swig/ResObject.i
+++ b/swig/ResObject.i
@@ -1,6 +1,4 @@
-%template(ResObject_constPtr) intrusive_ptr<const ResObject>;
-
class ResObject : public Resolvable
{
public:
@@ -29,30 +27,3 @@ class ResObject : public Resolvable
const NVRAD & nvrad_r );
virtual ~ResObject();
};
-
-
-#if 0
-%extend intrusive_ptr<const ResObject>
-{
- // FIXME: this is just a workaround, see Kind.i
- const char* kindToS()
- {
- if (isKind<Package>(*self))
- return "package";
- else if (isKind<Patch>(*self))
- return "patch";
- else if (isKind<Product>(*self))
- return "product";
- else if (isKind<Pattern>(*self))
- return "pattern";
- else if (isKind<Language>(*self))
- return "language";
- return "unknown";
- }
-
- int __cmp__(intrusive_ptr<const ResObject>& other)
- {
- return compareByNVRA(*self, other);
- }
-}
-#endif
diff --git a/swig/ResStatus.i b/swig/ResStatus.i
index 28423c8..a7986b7 100644
--- a/swig/ResStatus.i
+++ b/swig/ResStatus.i
@@ -374,11 +374,11 @@ class ResStatus
#ifdef SWIGPERL5
%extend ResStatus {
-
+
bool setToBeInstalledUser()
- {
+ {
return self->setToBeInstalled(ResStatus::USER);
- }
+ }
bool resetTransactUser()
{
@@ -386,3 +386,13 @@ class ResStatus
}
};
#endif
+
+%extend ResStatus
+{
+ std::string asString() const
+ {
+ std::ostringstream str;
+ str << *self;
+ return str.str();
+ }
+} \ No newline at end of file
diff --git a/swig/ResTraits.i b/swig/ResTraits.i
index fb165df..c250a20 100644
--- a/swig/ResTraits.i
+++ b/swig/ResTraits.i
@@ -15,25 +15,49 @@ template<typename _Res>
%template(ResTraitsResolvable) ResTraits<Resolvable>;
-#ifdef SWIGPYTHON
-%pythoncode %{
-def KindOfPackage():
- return KindOfResolvable( "package" )
-def KindOfSrcPackage():
- return KindOfResolvable( "srcpackage" )
-def KindOfPatch():
- return KindOfResolvable( "patch" )
-def KindOfPattern():
- return KindOfResolvable( "pattern" )
-def KindOfProduct():
- return KindOfResolvable( "product" )
-def KindOfAtom():
- return KindOfResolvable( "atom" )
-def KindOfScript():
- return KindOfResolvable( "script" )
-def KindOfMessage():
- return KindOfResolvable( "message" )
-def KindOfLanguage():
- return KindOfResolvable( "language" )
-%}
+%template(ResObject_constPtr) intrusive_ptr<const ResObject>;
+%template(ResObject_Ptr) intrusive_ptr<ResObject>;
+
+%define %STUFF(X)
+typedef intrusive_ptr<const X> X##_constPtr;
+typedef intrusive_ptr<X> X##_Ptr;
+
+%template(X##_constPtr) intrusive_ptr<const X>;
+%template(X##_Ptr) intrusive_ptr<X>;
+
+bool isKind##X( const Resolvable::constPtr & p );
+bool isKind##X( const PoolItem & p );
+
+X##_constPtr asKind##X( const Resolvable::constPtr & p );
+X##_constPtr asKind##X( const PoolItem & p );
+
+%header
+{
+ inline bool isKind##X( const Resolvable::constPtr & p )
+ { return isKind<X>( p ); }
+ inline bool isKind##X( const PoolItem & p )
+ { return isKind<X>( p.resolvable() ); }
+
+ inline X::constPtr asKind##X( const Resolvable::constPtr & p )
+ { return asKind<X>( p ); }
+ inline X::constPtr asKind##X( const PoolItem & p )
+ { return asKind<X>( p.resolvable() ); }
+}
+#if defined(SWIGPYTHON)
+%pythoncode
+{
+ def KindOf##X():
+ return KindOfResolvable( #X )
+}
#endif
+%enddef
+
+%STUFF(Package)
+%STUFF(Patch)
+%STUFF(SrcPackage)
+%STUFF(Pattern)
+%STUFF(Product)
+%STUFF(Atom)
+%STUFF(Script)
+%STUFF(Message)
+%STUFF(Language)
diff --git a/swig/Script.i b/swig/Script.i
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/swig/Script.i
diff --git a/swig/SrcPackage.i b/swig/SrcPackage.i
new file mode 100644
index 0000000..c60ccfb
--- /dev/null
+++ b/swig/SrcPackage.i
@@ -0,0 +1,25 @@
+ class SrcPackage : public ResObject
+ {
+
+ public:
+ typedef detail::SrcPackageImplIf Impl;
+ typedef SrcPackage Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ /** location of resolvable in repo */
+ OnMediaLocation location() const;
+
+ protected:
+ SrcPackage( const NVRAD & nvrad_r );
+ /** Dtor */
+ virtual ~SrcPackage();
+
+ private:
+ /** Access implementation */
+ virtual Impl & pimpl() = 0;
+ /** Access implementation */
+ virtual const Impl & pimpl() const = 0;
+ };
diff --git a/swig/zypp.i b/swig/zypp.i
index 72ed0e6..0ee203b 100644
--- a/swig/zypp.i
+++ b/swig/zypp.i
@@ -12,6 +12,7 @@
%{
/* Includes the header in the wrapper code */
+#include <sstream>
#include "zypp/base/PtrTypes.h"
#include "zypp/Edition.h"
#include "zypp/ResTraits.h"
@@ -28,6 +29,14 @@
#include "zypp/TranslatedText.h"
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
+#include "zypp/Patch.h"
+#include "zypp/Atom.h"
+#include "zypp/SrcPackage.h"
+#include "zypp/Script.h"
+#include "zypp/Message.h"
+#include "zypp/Pattern.h"
+#include "zypp/Language.h"
+#include "zypp/Product.h"
#include "zypp/ResFilters.h"
#include "zypp/OnMediaLocation.h"
#include "zypp/Repository.h"
@@ -113,6 +122,13 @@ class intrusive_ptr {
%include "NVRAD.i"
%include "Package.i"
%include "Patch.i"
+%include "Atom.i"
+%include "SrcPackage.i"
+%include "Script.i"
+%include "Message.i"
+%include "Pattern.i"
+%include "Language.i"
+%include "Product.i"
%include "PublicKey.i"
%include "KeyRing.i"
%include "Target.i"
@@ -172,6 +188,14 @@ class ZYpp
Arch architecture() const;
void setArchitecture( const Arch & arch );
+ /**
+ * \short Apply persistant locks to current pool.
+ * Call this before solving
+ *
+ * \returns Number of items locked
+ */
+ int applyLocks();
+
protected:
virtual ~ZYpp();
private: