diff options
author | Duncan Mac-Vicar P <dmacvicar@suse.de> | 2008-02-16 14:56:58 +0000 |
---|---|---|
committer | Duncan Mac-Vicar P <dmacvicar@suse.de> | 2008-02-16 14:56:58 +0000 |
commit | d762c73c6924c03a43c3c9b0a7e51790ad8bba6d (patch) | |
tree | 3d098584d577d7b1e2af7ddb80726e8e5e9ab64f | |
parent | f15b92b90720479d81252ee589aee90ececbe9f3 (diff) | |
download | libzypp-bindings-d762c73c6924c03a43c3c9b0a7e51790ad8bba6d.tar.gz libzypp-bindings-d762c73c6924c03a43c3c9b0a7e51790ad8bba6d.tar.bz2 libzypp-bindings-d762c73c6924c03a43c3c9b0a7e51790ad8bba6d.zip |
- ruby bindings compile, but python makes swig go nuts...
46 files changed, 555 insertions, 1690 deletions
diff --git a/swig/Arch.i b/swig/Arch.i index 3f314b1..ce22358 100644 --- a/swig/Arch.i +++ b/swig/Arch.i @@ -3,33 +3,5 @@ typedef std::set<Arch,CompareByGT<Arch> > CompatSet; %ignore Arch::compare(const Arch &, const Arch &); -class Arch -{ -public: - //Arch(); - Arch( const std::string & rhs ); - const std::string & asString() const; - bool empty() const; - bool compatibleWith( const Arch & targetArch_r ) const; - int compare( const Arch & rhs ) const; - static int compare( const Arch & lhs, const Arch & rhs ); - //static std::string asString( const CompatSet & cset ); - struct CompatEntry; -private: - Arch( const CompatEntry & ); - const CompatEntry * _entry; -}; - -extern const Arch Arch_noarch; -extern const Arch Arch_x86_64; -extern const Arch Arch_athlon; -extern const Arch Arch_i686; -extern const Arch Arch_i586; -extern const Arch Arch_i486; -extern const Arch Arch_i386; -extern const Arch Arch_s390x; -extern const Arch Arch_s390; -extern const Arch Arch_ppc64; -extern const Arch Arch_ppc; -extern const Arch Arch_ia64; +%include <zypp/Arch.h> diff --git a/swig/CapFactory.i b/swig/CapFactory.i deleted file mode 100644 index cb61475..0000000 --- a/swig/CapFactory.i +++ /dev/null @@ -1,56 +0,0 @@ - -class CapFactory -{ - - public: - /** Default ctor */ - CapFactory(); - - /** Dtor */ - ~CapFactory(); - - public: - /** Parse Capability from string providing Resolvable::Kind. - * \a strval_r is expected to define a valid Capability. - * \throw EXCEPTION on parse error. - */ - Capability parse( const Resolvable::Kind & refers_r, - const std::string & strval_r ) const; - - - /** Parse Capability providing Resolvable::Kind, name, Rel and Edition as strings. - * \throw EXCEPTION on parse error. - */ - Capability parse( const Resolvable::Kind & refers_r, - const std::string & name_r, - const std::string & op_r, - const std::string & edition_r ) const; - - /** Parse Capability providing Resolvable::Kind, name, Rel and Edition. - * \throw EXCEPTION on parse error. - */ - Capability parse( const Resolvable::Kind & refers_r, - const std::string & name_r, - Rel op_r, - const zypp::Edition & edition_r ) const; - - /** Special Capability, triggering evaluation of Hal - * capabilities when matched. - */ - Capability halEvalCap() const; - - /** Special Capability, triggering evaluation of modalias - * capabilities when matched. - */ - Capability modaliasEvalCap() const; - - public: - /** Provide a parsable string representation of \a cap_r. */ - std::string encode( const Capability & cap_r ) const; - - private: - /** Implementation */ - struct Impl; - /** Pointer to implementation */ - RW_pointer<Impl> _pimpl; -}; diff --git a/swig/CapSet.i b/swig/Capabilities.i index 35eb603..ace282b 100644 --- a/swig/CapSet.i +++ b/swig/Capabilities.i @@ -1,31 +1,31 @@ // I don't think this is correct: ctor and dtor are not taken into account -class CapSet +class Capabilities { }; #ifdef SWIGRUBY -iter3(CapSet, Capability*); +iter3(Capabilities, Capability*); #endif // The ruby std_set.i can only handle one template parameter // #ifdef SWIGPYTHON -// %template(CapSetTemp) std::set<Capability, CapOrder>; -// typedef std::set<Capability,CapOrder> CapSetTemp; +// %template(CapabilitiesTemp) std::set<Capability, CapOrder>; +// typedef std::set<Capability,CapOrder> CapabilitiesTemp; // #endif #ifdef SWIGPYTHON -%extend CapSet +%extend Capabilities { // just a test const Capability* haha() { - CapSet::iterator i = self->begin(); + Capabilities::iterator i = self->begin(); const Capability* tmp = &*i; return tmp; } @@ -33,5 +33,5 @@ iter3(CapSet, Capability*); #endif #ifdef SWIGPERL5 -iter2(CapSet, Capability); +iter2(Capabilities, Capability); #endif diff --git a/swig/Capability.i b/swig/Capability.i index 5f3984c..8c32158 100644 --- a/swig/Capability.i +++ b/swig/Capability.i @@ -1,80 +1,136 @@ -class Capability -{ - public: - /** */ - typedef capability::CapabilityTraits::KindType Kind; - - public: - /** DefaultCtor creating \ref noCap. */ - Capability(); - - /** Dtor */ - virtual ~Capability(); - - /** Constant representing no Capabiliy. - * It refers to no kind of Resolvable, and matches returns - * returns \c CapMatch::irrelevant. - */ - static const Capability noCap; - - public: - /** Kind of Capability. */ - const Kind & kind() const; - - /** Kind of Resolvable the Capability refers to. */ - const Resolvable::Kind & refers() const; - - /** Whether to consider this Capability. - * Evaluates the Capabilities pre-condition (if any), and - * returns whether the condition applies. If not, the Capability - * is to be ignored. - */ - bool relevant() const; - - /** Return whether the Capabilities match. - * If either Capability is not \ref relevant, CapMatch::irrelevant - * is returned. - */ - CapMatch matches( const Capability & rhs ) const; - - /** More or less human readable representation as string. */ - std::string asString() const; - - /** accessors needed by solver/zmd */ - /** Deprecated */ - std::string index() const; - - private: - typedef capability::CapabilityImpl Impl; - typedef capability::CapabilityImpl_Ptr Impl_Ptr ; - typedef capability::CapabilityImpl_constPtr Impl_constPtr; - - /** Factory */ - friend class CapFactory; - - /** Factory ctor */ - explicit - Capability( Impl_Ptr impl_r ); - - private: - /** */ - friend class capability::CapabilityImpl; - /** Pointer to implementation */ - RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl; -}; - -template<class _Cap> -inline bool isKind( const Capability & cap ) -{ return cap.kind() == capability::CapTraits<_Cap>::kind; } - - -/** Ordering relation used by ::CapSet. */ -struct CapOrder : public std::binary_function<Capability, Capability, bool> -{ - bool operator()( const Capability & lhs, const Capability & rhs ) const - { return lhs._pimpl.get() < rhs._pimpl.get(); } -}; + class Capability: protected sat::detail::PoolMember, + private base::SafeBool<Capability> + { + public: + // legacy + std::string index() const ZYPP_DEPRECATED; + + public: + enum CtorFlag { PARSED, UNPARSED }; + + public: + /** Default ctor, \ref Empty capability. */ + Capability() : _id( sat::detail::emptyId ) {} + + /** Ctor from id. */ + explicit Capability( sat::detail::IdType id_r ) : _id( id_r ) {} + + /** Ctor from string. + * \a str_r is parsed to check whether it contains an <tt>[op edition]</tt> part, + * unless the \ref PARSED flag is passed to the ctor. + */ + explicit Capability( const char * str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); + /** \overload */ + explicit Capability( const std::string & str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED ); + /** \overload Convenience for parsed (name only) packages. */ + Capability( const char * str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); + /** \overload */ + Capability( const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() ); + + /** Ctor from <tt>name op edition</tt>. */ + Capability( const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() ); + /** \overload */ + Capability( const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() ); + /** \overload */ + Capability( const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() ); + + public: + /** No or Null \ref Capability ( Id \c 0 ). */ + static const Capability Null; + + /** Empty Capability. */ + static const Capability Empty; + + public: + /** Evaluate in a boolean context <tt>( ! empty() )</tt>. */ + //using base::SafeBool<Capability>::operator bool_type; + + /** Whether the \ref Capability is empty. + * This is true for \ref Null and \ref Empty. + */ + bool empty() const + { return( _id == sat::detail::emptyId || _id == sat::detail::noId ); } + + public: + /** Conversion to <tt>const char *</tt> */ + const char * c_str() const; + + /** \overload */ + std::string asString() const + { return c_str(); } + + public: + /** Helper providing more detailed information about a \ref Capability. */ + CapDetail detail() const; + + public: + /** \name Match two simple capabilities. + * + * Two simple capabilities match if they have the same \c name + * and their \c edition ranges overlap. Where no edition matches + * ANY edition. \see \ref Edition::match. + * + * If a capability expression is involved, \ref matches returns + * \ref CapMatch::irrelevant. + * + * \todo check whether we must promote string to Capability in order to match. + */ + //@{ + static CapMatch matches( const Capability & lhs, const Capability & rhs ) { return _doMatch( lhs.id(), rhs.id() ); } + static CapMatch matches( const Capability & lhs, const IdString & rhs ) { return _doMatch( lhs.id(), rhs.id() ); } + static CapMatch matches( const Capability & lhs, const std::string & rhs ) { return _doMatch( lhs.id(), Capability(rhs).id() ); } + static CapMatch matches( const Capability & lhs, const char * rhs ) { return _doMatch( lhs.id(), Capability(rhs).id() );} + + static CapMatch matches( const IdString & lhs, const Capability & rhs ) { return _doMatch( lhs.id(), rhs.id() ); } + static CapMatch matches( const IdString & lhs, const IdString & rhs ) { return _doMatch( lhs.id(), rhs.id() ); } + static CapMatch matches( const IdString & lhs, const std::string & rhs ) { return _doMatch( lhs.id(), Capability(rhs).id() ); } + static CapMatch matches( const IdString & lhs, const char * rhs ) { return _doMatch( lhs.id(), Capability(rhs).id() ); } + + static CapMatch matches( const std::string & lhs, const Capability & rhs ) { return _doMatch( Capability(lhs).id(), rhs.id() );} + static CapMatch matches( const std::string & lhs, const IdString & rhs ) { return _doMatch( Capability(lhs).id(), rhs.id() ); } + static CapMatch matches( const std::string & lhs, const std::string & rhs ) { return _doMatch( Capability(lhs).id(), Capability(rhs).id() ); } + static CapMatch matches( const std::string & lhs, const char * rhs ) { return _doMatch( Capability(lhs).id(), Capability(rhs).id() ); } + + static CapMatch matches( const char * lhs, const Capability & rhs ) { return _doMatch( Capability(lhs).id(), rhs.id() );} + static CapMatch matches( const char * lhs, const IdString & rhs ) { return _doMatch( Capability(lhs).id(), rhs.id() ); } + static CapMatch matches( const char * lhs, const std::string & rhs ) { return _doMatch( Capability(lhs).id(), Capability(rhs).id() ); } + static CapMatch matches( const char * lhs, const char * rhs ) { return _doMatch( Capability(lhs).id(), Capability(rhs).id() ); } + + CapMatch matches( const Capability & rhs ) const { return _doMatch( id(), rhs.id() ); } + CapMatch matches( const IdString & rhs ) const { return _doMatch( id(), rhs.id() ); } + CapMatch matches( const std::string & rhs ) const { return _doMatch( id(), Capability(rhs).id() ); } + CapMatch matches( const char * rhs ) const { return _doMatch( id(), Capability(rhs).id() ); } + //@} + + /** \ref matches functor. + */ + struct Matches: public std::binary_function<Capability,Capability,CapMatch> + { + CapMatch operator()( const Capability & lhs, const Capability & rhs ) const + { return Capability::matches( lhs, rhs ); } + }; + + public: + /** Test for a filename that is likely being REQUIRED. + * Files below \c /bin , \c /sbin , \c /lib etc. Scanning a + * packages filelist, an \e interesting filename might be worth + * being remembered in PROVIDES. + */ + static bool isInterestingFileSpec( const IdString & name_r ) { return isInterestingFileSpec( name_r.c_str() ); } + static bool isInterestingFileSpec( const std::string & name_r ) { return isInterestingFileSpec( name_r.c_str() ); } + static bool isInterestingFileSpec( const char * name_r ); + + public: + /** Expert backdoor. */ + sat::detail::IdType id() const + { return _id; } + private: + /** Match two Capabilities */ + static CapMatch _doMatch( sat::detail::IdType lhs, sat::detail::IdType rhs ); + private: + }; + %extend Capability diff --git a/swig/CheckSum.i b/swig/CheckSum.i index 3c3e223..0a0add8 100644 --- a/swig/CheckSum.i +++ b/swig/CheckSum.i @@ -1,45 +1,2 @@ +%include <zypp/CheckSum.h> -class CheckSum - { - public: - /** - * Creates a checksum for algorithm \param type - * \throws if the checksum is invalid and can't be constructed - */ - CheckSum( const std::string & type, const std::string & checksum); - CheckSum( const std::string & type, std::istream & input_r ); - CheckSum(); - - public: - static const std::string & md5Type(); - static const std::string & shaType(); - static const std::string & sha1Type(); - static const std::string & sha256Type(); - - static CheckSum md5( const std::string & checksum ) - { return CheckSum( md5Type(), checksum); } - static CheckSum sha( const std::string & checksum ) - { return CheckSum( shaType(), checksum); } - static CheckSum sha1( const std::string & checksum ) - { return CheckSum( sha1Type(), checksum); } - static CheckSum sha256( const std::string & checksum ) - { return CheckSum( sha256Type(), checksum); } - - static CheckSum md5( std::istream & input_r ) - { return CheckSum( md5Type(), input_r ); } - static CheckSum sha( std::istream & input_r ) - { return CheckSum( sha1Type(), input_r ); } - static CheckSum sha1( std::istream & input_r ) - { return CheckSum( sha1Type(), input_r ); } - static CheckSum sha256( std::istream & input_r ) - { return CheckSum( sha256Type(), input_r ); } - - public: - std::string type() const; - std::string checksum() const; - bool empty() const; - - private: - std::string _type; - std::string _checksum; - };
\ No newline at end of file @@ -1,64 +1,3 @@ -struct Dep -{ - /** \name Dependency types - * These are the \em real dependency type contants to - * use. Don't mind that it's not an enum. - * \see \ref zypp::Dep::inSwitch - */ - //@{ - static const Dep PROVIDES; - static const Dep PREREQUIRES; - static const Dep REQUIRES; - static const Dep CONFLICTS; - static const Dep OBSOLETES; - static const Dep RECOMMENDS; - static const Dep SUGGESTS; - static const Dep FRESHENS; - static const Dep ENHANCES; - static const Dep SUPPLEMENTS; - //@} - - /** Enumarators provided \b only for use \ref inSwitch statement. - * \see inSwitch - */ - enum for_use_in_switch { - PROVIDES_e, - PREREQUIRES_e, - REQUIRES_e, - CONFLICTS_e, - OBSOLETES_e, - RECOMMENDS_e, - SUGGESTS_e, - FRESHENS_e, - ENHANCES_e, - SUPPLEMENTS_e, - }; - - /** Ctor from string. - * Legal values for \a strval_r are the constants names - * (case insignificant). - * - * \throw PARSE if \a strval_r is not legal. - * \todo refine exceptions and check throw. - */ - explicit - Dep( const std::string & strval_r ); - - /** String representation of dependency type. - * \return The constants names lowercased. - */ - const std::string & asString() const; - - /** Enumarator provided for use in \c switch statement. */ - for_use_in_switch inSwitch() const - { return _type; } - - private: - /** Ctor to initialize the dependency type contants. */ - Dep( for_use_in_switch type_r ) - : _type( type_r ) - {} - /** The operator. */ - for_use_in_switch _type; -}; +%nodefault Dep; +%include "zypp/Dep.h"
\ No newline at end of file diff --git a/swig/Dependencies.i b/swig/Dependencies.i index e1b5c91..f3fc44f 100644 --- a/swig/Dependencies.i +++ b/swig/Dependencies.i @@ -3,10 +3,10 @@ struct Dependencies { - CapSet & operator[]( Dep idx_r ) + Capabilities & operator[]( Dep idx_r ) { return _capsets[idx_r]; } - const CapSet & operator[]( Dep idx_r ) const - { return const_cast<std::map<Dep,CapSet>&>(_capsets)[idx_r]; } + const Capabilities & operator[]( Dep idx_r ) const + { return const_cast<std::map<Dep,Capabilities>&>(_capsets)[idx_r]; } }; diff --git a/swig/ItemCapKind.i b/swig/ItemCapKind.i deleted file mode 100644 index bbe5bdf..0000000 --- a/swig/ItemCapKind.i +++ /dev/null @@ -1,49 +0,0 @@ -%template(ItemCapKindList) std::list<solver::detail::ItemCapKind>; - -namespace solver -{ - namespace detail - { - - struct ItemCapKind - { - public: - Capability cap; - Dep capKind; - PoolItem_Ref item; - bool initialInstallation; - - /*%extend { - ItemCapKind(){}; - }*/ - - //ItemCapKind(); - ItemCapKind( PoolItem i, Capability c, Dep k, bool initial) - : cap( c ) - , capKind( k ) - , item( i ) - , initialInstallation( initial ) - { } - }; - #ifdef SWIGPERL5 - %extend ItemCapKind { - PoolItem_Ref getItem(){ - return self->item; - } - Capability getCap(){ - return self->cap; - } - Dep getCapKind(){ - return self->capKind; - } - bool getInitialInstallation(){ - return self->initialInstallation; - } - }; - #endif - } -} -#ifdef SWIGRUBY - auto_iterator(std::list<solver::detail::ItemCapKind>, solver::detail::ItemCapKind); -#endif - diff --git a/swig/KeyRing.i b/swig/KeyRing.i index b57eb4e..110782a 100644 --- a/swig/KeyRing.i +++ b/swig/KeyRing.i @@ -1,25 +1,11 @@ typedef intrusive_ptr<KeyRing> KeyRing_Ptr; -class KeyRing -{ +%ignore KeyRingReport; +%ignore KeyRingSignals; -public: - KeyRing(const zypp::Pathname& baseTmpDir); - ~KeyRing(); - - void importKey(const PublicKey& key, bool trusted = false); - - bool isKeyTrusted(const std::string& id); - bool isKeyKnown(const std::string& id); - - void deleteKey(const std::string& id, bool trusted = false); - - std::list<PublicKey> publicKeys(); - std::list<PublicKey> trustedPublicKeys(); - -}; +%include <zypp/KeyRing.h> %template(KeyRing_Ptr) intrusive_ptr<KeyRing>; diff --git a/swig/Language.i b/swig/Language.i deleted file mode 100644 index 8fabb7f..0000000 --- a/swig/Language.i +++ /dev/null @@ -1,26 +0,0 @@ - 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/MediaSetAccess.i b/swig/MediaSetAccess.i index 9193124..5775d28 100644 --- a/swig/MediaSetAccess.i +++ b/swig/MediaSetAccess.i @@ -1,16 +1,3 @@ -class MediaSetAccess -{ - -public: - - MediaSetAccess( const Url &url, const Pathname &path ); - - ~MediaSetAccess(); - - void setVerifier( unsigned media_nr, media::MediaVerifierRef verifier ); - - Pathname provideFile(const Pathname & file, unsigned media_nr ); - -}; +%include <zypp/MediaSetAccess.h> diff --git a/swig/Message.i b/swig/Message.i index 5feaa9b..460c5a4 100644 --- a/swig/Message.i +++ b/swig/Message.i @@ -1,26 +1 @@ - 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; - }; +%include <zypp/Message.h> diff --git a/swig/NVR.i b/swig/NVR.i deleted file mode 100644 index 19a515d..0000000 --- a/swig/NVR.i +++ /dev/null @@ -1,33 +0,0 @@ - struct NVR - { - /** Default ctor */ - NVR() - {} - - /** Ctor */ - explicit - NVR( const std::string & name_r, - const zypp::Edition & edition_r = zypp::Edition() ) - : name( name_r ) - , edition( edition_r ) - {} - - /** Ctor from Resolvable::constPtr */ - explicit - NVR( ResTraits<Resolvable>::constPtrType res_r ); - - /** */ - std::string name; - /** */ - zypp::Edition edition; - - public: - /** Comparison mostly for std::container */ - static int compare( const NVR & lhs, const NVR & rhs ) - { - int res = lhs.name.compare( rhs.name ); - if ( res ) - return res; - return lhs.edition.compare( rhs.edition ); - } - }; diff --git a/swig/NVRA.i b/swig/NVRA.i deleted file mode 100644 index f62d529..0000000 --- a/swig/NVRA.i +++ /dev/null @@ -1,40 +0,0 @@ -struct NVRA : public NVR - { - /** Default ctor */ - NVRA() - {} - - /** Ctor */ - explicit - NVRA( const std::string & name_r, - const zypp::Edition & edition_r = Edition(), - const Arch & arch_r = Arch() ) - : NVR( name_r, edition_r ) - , arch( arch_r ) - {} - - /** Ctor */ - explicit - NVRA( const NVR & nvr_r, - const Arch & arch_r = Arch() ) - : NVR( nvr_r ) - , arch( arch_r ) - {} - - /** Ctor from Resolvable::constPtr */ - explicit - NVRA( ResTraits<Resolvable>::constPtrType res_r ); - - /** */ - Arch arch; - - public: - /** Comparison mostly for std::container */ - static int compare( const NVRA & lhs, const NVRA & rhs ) - { - int res = NVR::compare( lhs, rhs ); - if ( res ) - return res; - return lhs.arch.compare( rhs.arch ); - } - }; diff --git a/swig/NVRAD.i b/swig/NVRAD.i deleted file mode 100644 index eae9a06..0000000 --- a/swig/NVRAD.i +++ /dev/null @@ -1,38 +0,0 @@ - -struct NVRAD : public NVRA, public Dependencies - { - /** Default ctor */ - NVRAD() - {} - - /** Ctor */ - explicit - NVRAD( const std::string & name_r, - const zypp::Edition & edition_r = zypp::Edition(), - const Arch & arch_r = Arch(), - const Dependencies & deps_r = Dependencies() ) - : NVRA( name_r, edition_r, arch_r ) - , Dependencies( deps_r ) - {} - - /** Ctor */ - explicit - NVRAD( const NVRA & nvra_r, - const Dependencies & deps_r = Dependencies() ) - : NVRA( nvra_r ) - , Dependencies( deps_r ) - {} - - /** Ctor from Resolvable::constPtr */ - explicit - NVRAD( const NVR & nvr_r, - const Arch & arch_r = Arch(), - const Dependencies & deps_r = Dependencies() ) - : NVRA( nvr_r, arch_r ) - , Dependencies( deps_r ) - {} - - /** Ctor */ - explicit - NVRAD( Resolvable::constPtr res_r ); - }; diff --git a/swig/OnMediaLocation.i b/swig/OnMediaLocation.i index e55330d..d2b633f 100644 --- a/swig/OnMediaLocation.i +++ b/swig/OnMediaLocation.i @@ -1,29 +1,2 @@ - class OnMediaLocation - { - friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj ); - - public: - /** Ctor */ - OnMediaLocation() - : _medianr( 1 ) - {} - - public: - unsigned medianr() const { return _medianr; } - const Pathname & filename() const { return _filename; } - const CheckSum & checksum() const { return _checksum; } - const ByteCount & downloadsize() const { return _downloadsize; } - - public: - OnMediaLocation & medianr( unsigned val_r ) { _medianr = val_r; return *this; } - OnMediaLocation & filename( const Pathname & val_r ) { _filename = val_r; return *this; } - OnMediaLocation & checksum( const CheckSum & val_r ) { _checksum = val_r; return *this; } - OnMediaLocation & downloadsize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; } - - private: - unsigned _medianr; - Pathname _filename; - CheckSum _checksum; - ByteCount _downloadsize; - };
\ No newline at end of file +%include <zypp/OnMediaLocation.h>
\ No newline at end of file diff --git a/swig/Package.i b/swig/Package.i index 433977d..699c386 100644 --- a/swig/Package.i +++ b/swig/Package.i @@ -1,57 +1,3 @@ - -class Package : public ResObject -{ - - public: - typedef detail::PackageImplIf Impl; - typedef Package Self; - typedef ResTraits<Self> TraitsType; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - - /** Get the package change log */ - Changelog changelog() const; - /** */ - std::string buildhost() const; - /** */ - std::string distribution() const; - /** */ - Label license() const; - /** */ - std::string packager() const; - /** */ - PackageGroup group() const; - /** Don't ship it as class Url, because it might be - * in fact anything but a legal Url. */ - std::string url() const; - /** */ - std::string os() const; - /** */ - Text prein() const; - /** */ - Text postin() const; - /** */ - Text preun() const; - /** */ - Text postun() const; - /** */ - zypp::ByteCount sourcesize() const; - /** */ - std::list<std::string> authors() const; - /** */ - std::list<std::string> filenames() const; - - /** Disk usage per directory */ - //DiskUsage diskusage() const; - - /** location in source */ - OnMediaLocation location() const; - - protected: - Package( const NVRAD & nvrad_r ); - /** Dtor */ - virtual ~Package(); -}; +%ignore Package::checksum(); +%include <zypp/Package.h> diff --git a/swig/Patch.i b/swig/Patch.i index 488754b..7de896b 100644 --- a/swig/Patch.i +++ b/swig/Patch.i @@ -1,41 +1,2 @@ -class Patch : public ResObject -{ - public: - typedef detail::PatchImplIf Impl; - typedef Patch Self; - typedef ResTraits<Self> TraitsType; - typedef TraitsType::PtrType Ptr; - typedef TraitsType::constPtrType constPtr; - public: - typedef Impl::AtomList AtomList; - - public: - /** Patch ID */ - std::string id() const; - /** Patch time stamp */ - Date timestamp() const; - /** Patch category (recommended, security,...) */ - std::string category() const; - /** Does the system need to reboot to finish the update process? */ - bool reboot_needed() const; - /** Does the patch affect the package manager itself? */ - bool affects_pkg_manager() const; - /** The list of all atoms building the patch */ - AtomList atoms() const; - /** Is the patch installation interactive? (does it need user input?) */ - bool interactive() const; - - - protected: - /** Ctor */ - Patch( const NVRAD & nvrad_r ); - /** Dtor */ - virtual ~Patch(); - - private: - /** Access implementation */ - virtual Impl & pimpl() = 0; - /** Access implementation */ - virtual const Impl & pimpl() const = 0; -}; +%include <zypp/Patch.h>
\ No newline at end of file diff --git a/swig/Pathname.i b/swig/Pathname.i index 65c6c4b..cfb1488 100644 --- a/swig/Pathname.i +++ b/swig/Pathname.i @@ -1,18 +1 @@ - -namespace zypp -{ - namespace filesystem - { - %rename Pathname::dirname(const Pathname&) dirname1; - %rename Pathname::basename(const Pathname&) basename1; - %rename Pathname::extension(const Pathname&) extension1; - %rename Pathname::absolutename(const Pathname&) absolutename1; - %rename Pathname::relativename(const Pathname&) relativename1; - %rename Pathname::cat(const Pathname&, const Pathname&) cat2; - %rename Pathname::extend(const Pathname&, const std::string&) extend2; - } -} - -// TODO: tell make about dependencies -%include <zypp/Pathname.h> - +%include <zypp/Pathname.h>
\ No newline at end of file diff --git a/swig/Pattern.i b/swig/Pattern.i index 28edfd2..3d88887 100644 --- a/swig/Pattern.i +++ b/swig/Pattern.i @@ -1,43 +1 @@ - 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; - }; +%include <zypp/Pattern.h>
\ No newline at end of file diff --git a/swig/PoolItem.i b/swig/PoolItem.i index d766fb3..3877b29 100644 --- a/swig/PoolItem.i +++ b/swig/PoolItem.i @@ -1,62 +1,8 @@ +%include <zypp/PoolItem.h> -class PoolItem_Ref -{ - - public: - /** Implementation */ - class Impl; - - public: - /** Default ctor for use in std::container. */ - PoolItem_Ref(); - - /** Ctor */ - explicit - PoolItem_Ref( ResObject::constPtr res_r ); - - /** Ctor */ - PoolItem_Ref( ResObject::constPtr res_r, const ResStatus & status_r ); - - /** Dtor */ - ~PoolItem_Ref(); - - public: - /** Returns the current status. */ - ResStatus & status() const; - - /** Reset status (applies autoprotection). */ - ResStatus & statusReset() const; - - /** Returns the ResObject::constPtr. - * \see \ref operator-> - */ - // ResObject::constPtr resolvable() const; - intrusive_ptr<const ResObject> resolvable() const; - - public: - - /** Forward \c -> access to ResObject. */ - ResObject::constPtr operator->() const - { return resolvable(); } - - private: - /** Pointer to implementation */ - RW_pointer<Impl> _pimpl; - - private: - /** \name tmp hack for save/restore state. */ - /** \todo get rid of it. */ - //@{ - friend class PoolItemSaver; - void saveState() const; - void restoreState() const; - bool sameState() const; - //@} -}; - -typedef PoolItem_Ref PoolItem; +typedef PoolItem PoolItem; -%extend PoolItem_Ref +%extend PoolItem { std::string asString() const { diff --git a/swig/Product.i b/swig/Product.i index d6768b8..7922e77 100644 --- a/swig/Product.i +++ b/swig/Product.i @@ -1,68 +1 @@ - 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; - }; +%include <zypp/Product.h>
\ No newline at end of file diff --git a/swig/PublicKey.i b/swig/PublicKey.i index d908f05..3f4341f 100644 --- a/swig/PublicKey.i +++ b/swig/PublicKey.i @@ -1,21 +1 @@ - -class PublicKey -{ - -public: - - PublicKey(); - PublicKey(const zypp::Pathname& file); - ~PublicKey(); - - bool isValid() const; - - std::string asString() const; - std::string armoredData() const; - std::string id() const; - std::string name() const; - std::string fingerprint() const; - zypp::Pathname path() const; - -}; - +%include <zypp/PublicKey.h>
\ No newline at end of file diff --git a/swig/RepoInfo.i b/swig/RepoInfo.i index 5d6d22f..0597835 100644 --- a/swig/RepoInfo.i +++ b/swig/RepoInfo.i @@ -3,135 +3,7 @@ %template(UrlSet) std::set<Url>; #endif -class RepoInfo -{ -public: - RepoInfo(); - ~RepoInfo(); - - /** - * unique identifier for this source. If not specified - * It should be generated from the base url. - * - * Normally, in a .repo file the section name is used - * ( [somerepo] ) - */ - std::string alias() const; - - /** - * Url of a file which contains a list of Urls - * If empty, the base url will be used. - */ - Url mirrorListUrl() const; - - typedef std::set<Url> url_set; - typedef url_set::size_type urls_size_type; - typedef transform_iterator<repo::RepoVariablesUrlReplacer, url_set::const_iterator> urls_const_iterator; - - /** - * iterator that points at begin of repository urls - */ - urls_const_iterator baseUrlsBegin() const; - - /** - * iterator that points at end of repository urls - */ - urls_const_iterator baseUrlsEnd() const; - - /** - * If enabled is false, then this repository must be ignored as if does - * not exists, except when checking for duplicate alias. - */ - bool enabled() const; - - /** - * If true, the repostory must be refreshed before creating resolvables - * from it - */ - bool autorefresh() const; - - /** - * Type of repository, - * - */ - repo::RepoType type() const; - - /** - * \short Repository short label - * - * Short label or description of the repository, to be used on - * the user interface. - * ie: "SUSE Linux 10.2 updates" - */ - std::string name() const; - - /** - * \short File where this repo was read from - * - * \note could be an empty pathname for repo - * infos created in memory. - */ - zypp::Pathname filepath() const; - - /** - * Add a base url. \see baseUrls - * \param url The base url for the repository. - * - * To edit or remove urls, create a new RepoInfo instead. - */ - RepoInfo & addBaseUrl( const zypp::Url &url ); - - /** - * Set mirror list url. \see mirrorListUrl - * \param url The base url for the list - */ - RepoInfo & setMirrorListUrl( const zypp::Url &url ); - - /** - * enable or disable the repository \see enabled - * \param enabled - */ - RepoInfo & setEnabled( bool enabled ); - - /** - * enable or disable autorefresh \see autorefresh - * \param enabled - */ - RepoInfo & setAutorefresh( bool autorefresh ); - - /** - * set the repository alias \see alias - * \param alias - */ - RepoInfo & setAlias( const std::string &alias ); - - /** - * set the repository type \see type - * \param t - */ - RepoInfo & setType( const repo::RepoType &t ); - - /** - * set the repository name \see name - * \param name - */ - RepoInfo & setName( const std::string &name ); - - /** - * \short set the repository filepath - * \param path File path - */ - RepoInfo & setFilepath( const zypp::Pathname &filename ); - - std::ostream & dumpOn( std::ostream & str ) const; - - std::ostream & dumpRepoOn( std::ostream & str ) const; - - class Impl; - private: - /** Pointer to implementation */ - RWCOW_pointer<Impl> _pimpl; -}; +%include <zypp/RepoInfo.h> typedef std::list<RepoInfo> RepoInfoList; %template(RepoInfoList) std::list<RepoInfo>; diff --git a/swig/RepoManager.i b/swig/RepoManager.i index 23410e8..1cc5b60 100644 --- a/swig/RepoManager.i +++ b/swig/RepoManager.i @@ -1,59 +1 @@ - - std::list<RepoInfo> readRepoFile(const Url & repo_file); - - struct RepoManagerOptions - { - RepoManagerOptions(); - - zypp::Pathname repoCachePath; - zypp::Pathname repoRawCachePath; - zypp::Pathname knownReposPath; - }; - - class RepoManager - { - public: - RepoManager( const RepoManagerOptions &options = RepoManagerOptions() ); - ~RepoManager(); - - enum RawMetadataRefreshPolicy - { - RefreshIfNeeded, - RefreshForced - }; - - enum CacheBuildPolicy - { - BuildIfNeeded, - BuildForced - }; - - enum RepoRemovePolicy - { - - }; - - std::list<RepoInfo> knownRepositories() const; - void refreshMetadata( const RepoInfo &info, - RawMetadataRefreshPolicy policy = RefreshIfNeeded, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - void cleanMetadata( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - void buildCache( const RepoInfo &info, - CacheBuildPolicy policy = BuildIfNeeded, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - void cleanCache( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - bool isCached( const RepoInfo &info ) const; - Repository createFromCache( const RepoInfo &info,const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - repo::RepoType probe( const Url &url ); - void addRepository( const RepoInfo &info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - void addRepositories( const Url &url, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - void removeRepository( const RepoInfo & info, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - RepoInfo getRepositoryInfo( const std::string &alias, - const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() ); - - }; +%include <zypp/RepoManager.h>
\ No newline at end of file diff --git a/swig/RepoStatus.i b/swig/RepoStatus.i index 058ddcc..8f89dae 100644 --- a/swig/RepoStatus.i +++ b/swig/RepoStatus.i @@ -1,57 +1 @@ - -class RepoStatus -{ - - public: - - /** - * Checksum of the repository. - * Usually the checksum of the index, but any - * checksum that changes when the repository changes - * in any way is sufficient. - */ - std::string checksum() const; - - /** - * timestamp of the repository. If the repository - * changes, it has to be updated as well with the - * new timestamp. - */ - Date timestamp() const; - - /** - * set the repository checksum \see checksum - * \param checksum - */ - RepoStatus & setChecksum( const std::string &checksum ); - - /** - * set the repository timestamp \see timestamp - * \param timestamp - */ - RepoStatus & setTimestamp( const Date ×tamp ); - - /** Implementation */ - class Impl; - - public: - /** Default ctor */ - RepoStatus(); - - /** - * \short Status from a single file - * As most repository state is represented - * by the status of the index file, you can - * construct the status from a file. - */ - RepoStatus( const Pathname &file ); - - /** Dtor */ - ~RepoStatus(); - - public: - - private: - /** Pointer to implementation */ - RWCOW_pointer<Impl> _pimpl; -}; +%include <zypp/RepoStatus.h>
\ No newline at end of file diff --git a/swig/RepoType.i b/swig/RepoType.i index c1bab9a..d9f1164 100644 --- a/swig/RepoType.i +++ b/swig/RepoType.i @@ -1,26 +1 @@ - -struct RepoType -{ - static const RepoType RPMMD; - static const RepoType YAST2; - //static const RepoType NONE; - - enum Type - { - NONE_e, - RPMMD_e, - YAST2_e - }; - - RepoType(Type type) : _type(type) {} - - explicit RepoType(const std::string & strval_r); - - const Type toEnum() const { return _type; } - - RepoType::Type parse(const std::string & strval_r); - - const std::string & asString() const; - - Type _type; -}; +%include <zypp/repo/RepoType.h>
\ No newline at end of file diff --git a/swig/Repository.i b/swig/Repository.i index 58b7bba..27e8d88 100644 --- a/swig/Repository.i +++ b/swig/Repository.i @@ -1,15 +1,62 @@ -class Repository : private base::SafeBool<Repository> -{ -public: + class Repository : private base::SafeBool<Repository> + { + public: + typedef repo::RepositoryImpl Impl; + typedef repo::RepositoryImpl_Ptr Impl_Ptr; + + public: + + /** + * \short Default ctor: noRepository. + * \see RepoManager::createFromCache. + */ Repository(); + + /** \short Factory ctor taking a RepositoryImpl. + * This is quite low level. You usually want to use RepoManager to + * manage the repositories. + * \see RepoManager + */ + explicit + Repository( const Impl_Ptr & impl_r ); + + /** \short Factory ctor taking a RepositoryImpl. + */ + explicit + Repository( const RepoInfo & info_r ); + + /** + * A dummy Repository (Id \c 0) providing nothing, doing nothing. + */ static const Repository noRepository; + /** Validate Repository in a boolean context. + * \c FALSE iff == noRepository. + */ + //using base::SafeBool<Repository>::operator bool_type; + + public: typedef unsigned long NumericId; + + /** Runtime unique numeric Repository Id. */ NumericId numericId() const; - const ResStore & resolvables(); - const RepoInfo info() const; + + /** + * \short Repository info used to create this repository + */ + const RepoInfo & info() const; + + /** + * \short Patch RPMs the repository provides + */ const std::list<packagedelta::PatchRpm> & patchRpms() const; + + /** + * \short Delta RPMs the repository provides + */ const std::list<packagedelta::DeltaRpm> & deltaRpms() const; -}; + }; + +
\ No newline at end of file diff --git a/swig/ResObject.i b/swig/ResObject.i index 1fa3685..669824c 100644 --- a/swig/ResObject.i +++ b/swig/ResObject.i @@ -1,32 +1,5 @@ -class ResObject : public Resolvable -{ - public: - typedef detail::ResObjectImplIf Impl; - typedef ResObject Self; - typedef ResTraits<Self> TraitsType; - typedef intrusive_ptr<ResObject> Ptr; - typedef TraitsType::constPtrType constPtr; - - public: - Text summary() const; - Text description() const; - Text insnotify() const; - Text delnotify() const; - Text licenseToConfirm() const; - Vendor vendor() const; - zypp::ByteCount size() const; - zypp::ByteCount downloadSize() const; - Repository repository() const; - unsigned mediaNr() const; - bool installOnly() const; - Date buildtime() const; - Date installtime() const; - protected: - ResObject( const Kind & kind_r, - const NVRAD & nvrad_r ); - virtual ~ResObject(); -}; +%include <zypp/ResObject.h> %extend intrusive_ptr<const ResObject> diff --git a/swig/ResPool.i b/swig/ResPool.i index 8deda8d..f929c10 100644 --- a/swig/ResPool.i +++ b/swig/ResPool.i @@ -1,173 +1,315 @@ %apply unsigned { ResPool::size_type }; +%nodefault ResPool; +%ignore ResPool::byKindBegin; +%ignore ResPool::byKindEnd; +%ignore ResPool::byNameBegin; +%ignore ResPool::byNameEnd; + class ResPool -{ - - public: - /** \ref zypp::pool::PoolItem */ - typedef pool::PoolTraits::Item Item; - typedef pool::PoolTraits::size_type size_type; - typedef pool::PoolTraits::const_iterator const_iterator; - typedef pool::PoolTraits::byName_iterator byName_iterator; - typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator; - typedef pool::PoolTraits::AdditionalCapSet AdditionalCapSet; - - public: - /** Default ctor: empty pool */ - ResPool(); - /** Dtor */ - ~ResPool(); - - public: - /** */ - bool empty() const; - /** */ - size_type size() const; - - public: - - /** \name Iterate through all ResObjects (all kinds). */ - //@{ - #ifdef SWIGPERL5 - const_iterator begin() const; - const_iterator end() const; - #endif - //@} - - public: - /** \name Iterate through all ResObjects of a certain kind. */ - //@{ - typedef resfilter::ByKind ByKind; - typedef filter_iterator<ByKind,const_iterator> byKind_iterator; - - /* - byKind_iterator byKindBegin( const ResObject::Kind & kind_r ) const - { return make_filter_begin( ByKind(kind_r), *this ); } - - template<class _Res> - byKind_iterator byKindBegin() const - { return make_filter_begin( resfilter::byKind<_Res>(), *this ); } + { + friend std::ostream & operator<<( std::ostream & str, const ResPool & obj ); + + public: + /** \ref PoolItem */ + typedef PoolItem value_type; + typedef pool::PoolTraits::size_type size_type; + typedef pool::PoolTraits::const_iterator const_iterator; + + typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator; + typedef pool::PoolTraits::AdditionalCapabilities AdditionalCapabilities; + typedef pool::PoolTraits::repository_iterator repository_iterator; + + public: + /** Singleton ctor. */ + static ResPool instance(); + + /** preliminary */ + ResPoolProxy proxy() const; + + public: + /** The pools serial number. Changing whenever the + * whenever the content changes. (Resolvables or + * Dependencies). + */ + const SerialNumber & serial() const; + + public: + /** */ + bool empty() const; + /** */ + size_type size() const; + + /** \name Iterate through all PoolItems (all kinds). */ + //@{ + /** */ + const_iterator begin() const + { return make_filter_begin( pool::ByPoolItem(), store() ); } + /** */ + const_iterator end() const + { return make_filter_end( pool::ByPoolItem(), store() ); } + //@} + + public: + /** Return the corresponding \ref PoolItem. + * Pool and sat pool should be in sync. Returns an empty + * \ref PoolItem if there is no corresponding \ref PoolItem. + * \see \ref PoolItem::satSolvable. + */ + PoolItem find( const sat::Solvable & slv_r ) const; + + public: + /** \name Iterate through all PoolItems matching a \c _Filter. */ + //@{ + template<class _Filter> + filter_iterator<_Filter,const_iterator> filterBegin( const _Filter & filter_r ) const + { return make_filter_begin( filter_r, *this ); } + + template<class _Filter> + filter_iterator<_Filter,const_iterator> filterEnd( const _Filter & filter_r ) const + { return make_filter_end( filter_r, *this ); } + //@} + + public: + /** \name Iterate through all PoolItems of a certain name and kind. */ + //@{ + typedef pool::ByIdent ByIdent; + typedef pool::PoolTraits::byIdent_iterator byIdent_iterator; + + byIdent_iterator byIdentBegin( const ByIdent & ident_r ) const + { + return make_transform_iterator( id2item().equal_range( ident_r.get() ).first, + pool::PoolTraits::Id2ItemValueSelector() ); + } + + byIdent_iterator byIdentBegin( ResKind kind_r, IdString name_r ) const + { return byIdentBegin( ByIdent(kind_r,name_r) ); } + + byIdent_iterator byIdentBegin( ResKind kind_r, const C_Str & name_r ) const + { return byIdentBegin( ByIdent(kind_r,name_r) ); } + + template<class _Res> + byIdent_iterator byIdentBegin( IdString name_r ) const + { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); } + + template<class _Res> + byIdent_iterator byIdentBegin( const C_Str & name_r ) const + { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); } + + /** Derive name and kind from \ref PoolItem. */ + byIdent_iterator byIdentBegin( const PoolItem & pi_r ) const + { return byIdentBegin( ByIdent(pi_r.satSolvable()) ); } + /** Derive name and kind from \ref sat::Solvable. */ + byIdent_iterator byIdentBegin( sat::Solvable slv_r ) const + { return byIdentBegin( ByIdent(slv_r) ); } + /** Takes a \ref sat::Solvable::ident string. */ + byIdent_iterator byIdentBegin( IdString ident_r ) const + { return byIdentBegin( ByIdent(ident_r) ); } + + + byIdent_iterator byIdentEnd( const ByIdent & ident_r ) const + { + return make_transform_iterator( id2item().equal_range( ident_r.get() ).second, + pool::PoolTraits::Id2ItemValueSelector() ); + } + + byIdent_iterator byIdentEnd( ResKind kind_r, IdString name_r ) const + { return byIdentEnd( ByIdent(kind_r,name_r) ); } + + byIdent_iterator byIdentEnd( ResKind kind_r, const C_Str & name_r ) const + { return byIdentEnd( ByIdent(kind_r,name_r) ); } + + template<class _Res> + byIdent_iterator byIdentEnd( IdString name_r ) const + { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); } + template<class _Res> + byIdent_iterator byIdentEnd( const C_Str & name_r ) const + { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); } - byKind_iterator byKindEnd( const ResObject::Kind & kind_r ) const - { return make_filter_end( ByKind(kind_r), *this ); } + /** Derive name and kind from \ref PoolItem. */ + byIdent_iterator byIdentEnd( const PoolItem & pi_r ) const + { return byIdentEnd( ByIdent(pi_r.satSolvable()) ); } + /** Derive name and kind from \ref sat::Solvable. */ + byIdent_iterator byIdentEnd( sat::Solvable slv_r ) const + { return byIdentEnd( ByIdent(slv_r) ); } + /** Takes a \ref sat::Solvable::ident string. */ + byIdent_iterator byIdentEnd( IdString ident_r ) const + { return byIdentEnd( ByIdent(ident_r) ); } + //@} - template<class _Res> - byKind_iterator byKindEnd() const + public: + /** \name Iterate through all ResObjects of a certain kind. */ + //@{ + typedef zypp::resfilter::ByKind ByKind; + typedef filter_iterator<ByKind,const_iterator> byKind_iterator; + + byKind_iterator byKindBegin( const ResKind & kind_r ) const + { return make_filter_begin( ByKind(kind_r), *this ); } + + template<class _Res> + byKind_iterator byKindBegin() const + { return make_filter_begin( resfilter::byKind<_Res>(), *this ); } + + byKind_iterator byKindEnd( const ResKind & kind_r ) const + { return make_filter_end( ByKind(kind_r), *this ); } + + template<class _Res> + byKind_iterator byKindEnd() const { return make_filter_end( resfilter::byKind<_Res>(), *this ); } - //@} - */ - public: - /** \name Iterate through all ResObjects with a certain name (all kinds). */ - /* - //@{ - byName_iterator byNameBegin( const std::string & name_r ) const; - - byName_iterator byNameEnd( const std::string & name_r ) const; - //@} - */ - public: - /** \name Iterate through all ResObjects which have at least - * one Capability with index \a index_r in dependency \a depType_r. - */ - /* - //@{ - byCapabilityIndex_iterator byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const; - - byCapabilityIndex_iterator byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const; - //@} - */ - public: - /** \name Handling addition capabilities in the pool in order for solving it in - * a solver run. This is used for tasks like needing a package with the name "foo". - * The solver has to evaluate a proper package by his own. - * - * CAUTION: This has another semantic in the solver. The required resolvable has - * been set for installation (in the pool) only AFTER a solver run. - */ - - /** - * Handling additional requirement. E.G. need package "foo" and package - * "foo1" which has a greater version than 1.0: - * - * \code - * CapSet capset; - * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); - * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0")); - * - * // The user is setting this capablility - * ResPool::AdditionalCapSet aCapSet; - * aCapSet[ResStatus::USER] = capset; - * - * setAdditionalRequire( aCapSet ); - * \endcode - */ - void setAdditionalRequire( const AdditionalCapSet & capset ) const; - AdditionalCapSet & additionalRequire() const; - - /** - * Handling additional conflicts. E.G. do not install anything which provides "foo": - * - * \code - * CapSet capset; - * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); - * - * // The user is setting this capablility - * ResPool::AdditionalCapSet aCapSet; - * aCapSet[ResStatus::USER] = capset; - * - * setAdditionalConflict( aCapSet ); - * \endcode - */ - void setAdditionalConflict( const AdditionalCapSet & capset ) const; - AdditionalCapSet & additionaConflict() const; - - /** - * Handling additional provides. This is used for ignoring a requirement. - * e.G. Do ignore the requirement "foo": - * - * \code - * CapSet capset; - * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); - * - * // The user is setting this capablility - * ResPool::AdditionalCapSet aCapSet; - * aCapSet[ResStatus::USER] = capset; - * - * setAdditionalProvide( aCapSet ); - * \endcode - */ - void setAdditionalProvide( const AdditionalCapSet & capset ) const; - AdditionalCapSet & additionaProvide() const; - - private: - /** */ - friend class ResPoolManager; - /** Ctor */ - ResPool( pool::PoolTraits::Impl_constPtr impl_r ); - private: - /** Const access to implementation. */ - pool::PoolTraits::Impl_constPtr _pimpl; - -}; + //@} + + public: + /** \name Iterate through all ResObjects with a certain name (all kinds). + * \deprecated Instead of iterating byName and filter byKind use ByIdent iterator. + */ + //@{ + typedef zypp::resfilter::ByName ByName; + typedef filter_iterator<ByName,const_iterator> byName_iterator; + + + + public: + /** \name Iterate through all Repositories that contribute ResObjects. + */ + //@{ + size_type knownRepositoriesSize() const; + + repository_iterator knownRepositoriesBegin() const; + + repository_iterator knownRepositoriesEnd() const; + //@} + + public: + /** \name Iterate through requested/available Locales. + */ + //@{ + /** Set the requested locales. + * Languages to be supported by the system, e.g. language specific + * packages to be installed. + */ + void setRequestedLocales( const LocaleSet & locales_r ); + + /** Add one \ref Locale to the set of requested locales. + * Return \c true if \c locale_r was newly added to the set. + */ + bool addRequestedLocale( const Locale & locale_r ); + + /** Erase one \ref Locale from the set of requested locales. + * Return \c false if \c locale_r was not found in the set. + */ + bool eraseRequestedLocale( const Locale & locale_r ); + + /** Return the requested locales. + * \see \ref setRequestedLocales + */ + const LocaleSet & getRequestedLocales() const; + + /** Wheter this \ref Locale is in the set of requested locales. */ + bool isRequestedLocale( const Locale & locale_r ) const; + + /** Get the set of available locales. + * This is computed from the package data so it actually + * represents all locales packages claim to support. + */ + const LocaleSet & getAvailableLocales() const; + + /** Wheter this \ref Locale is in the set of available locales. */ + bool isAvailableLocale( const Locale & locale_r ) const; + //@} + + public: + /** \name Handling addition capabilities in the pool in order for solving it in + * a solver run. This is used for tasks like needing a package with the name "foo". + * The solver has to evaluate a proper package by his own. + * + * CAUTION: This has another semantic in the solver. The required resolvable has + * been set for installation (in the pool) only AFTER a solver run. + */ + + /** + * Handling additional requirement. E.G. need package "foo" and package + * "foo1" which has a greater version than 1.0: + * + * \code + * Capabilities capset; + * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); + * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0")); + * + * // The user is setting this capablility + * ResPool::AdditionalCapabilities aCapabilities; + * aCapabilities[ResStatus::USER] = capset; + * + * setAdditionalRequire( aCapabilities ); + * \endcode + */ + void setAdditionalRequire( const AdditionalCapabilities & capset ) const; + AdditionalCapabilities & additionalRequire() const; + + /** + * Handling additional conflicts. E.G. do not install anything which provides "foo": + * + * \code75 + * Capabilities capset; + * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); + * + * // The user is setting this capablility + * ResPool::AdditionalCapabilities aCapabilities; + * aCapabilities[ResStatus::USER] = capset; + * + * setAdditionalConflict( aCapabilities ); + * \endcode + */ + void setAdditionalConflict( const AdditionalCapabilities & capset ) const; + AdditionalCapabilities & additionaConflict() const; + + /** + * Handling additional provides. This is used for ignoring a requirement. + * e.G. Do ignore the requirement "foo": + * + * \code + * Capabilities capset; + * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo")); + * + * // The user is setting this capablility + * ResPool::AdditionalCapabilities aCapabilities; + * aCapabilities[ResStatus::USER] = capset; + * + * setAdditionalProvide( aCapabilities ); + * \endcode + */ + void setAdditionalProvide( const AdditionalCapabilities & capset ) const; + AdditionalCapabilities & additionaProvide() const; + + private: + const pool::PoolTraits::ItemContainerT & store() const; + const pool::PoolTraits::Id2ItemT & id2item() const; + + private: + /** Ctor */ + ResPool( pool::PoolTraits::Impl_constPtr impl_r ); + /** Const access to implementation. */ + pool::PoolTraits::Impl_constPtr _pimpl; + }; + #ifdef SWIGPERL5 -iter2(ResPool, PoolItem_Ref); +iter2(ResPool, PoolItem); #endif #ifdef SWIGRUBY -iter3(ResPool, PoolItem_Ref*); +iter3(ResPool, PoolItem*); // %extend ResPool { // void each() // { // ResPool::const_iterator i = self->begin(); // while ( i != self->end() ) { -// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0)); +// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0)); // ++i; // } // } @@ -178,7 +320,7 @@ iter3(ResPool, PoolItem_Ref*); { ResPool::byKind_iterator i = self->byKindBegin( kind_r ); while ( i != self->byKindEnd( kind_r ) ) { - rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0)); + rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem, 0)); ++i; } } @@ -189,7 +331,7 @@ iter3(ResPool, PoolItem_Ref*); { ResPool::byName_iterator i = self->byNameBegin( name ); while ( i != self->byNameEnd( name ) ) { - rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem_Ref), 0)); + rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem), 0)); ++i; } } @@ -198,7 +340,7 @@ iter3(ResPool, PoolItem_Ref*); #endif #ifdef SWIGPYTHON -%template(PoolItemSet) std::set<PoolItem_Ref>; +%template(PoolItemSet) std::set<PoolItem>; %newobject ResPool::const_iterator(PyObject **PYTHON_SELF); %extend ResPool { swig::PySwigIterator* iterator(PyObject **PYTHON_SELF) diff --git a/swig/ResPoolManager.i b/swig/ResPoolManager.i deleted file mode 100644 index 5597f0d..0000000 --- a/swig/ResPoolManager.i +++ /dev/null @@ -1,35 +0,0 @@ - -class ResPoolManager -{ - -public: - typedef pool::PoolTraits::Item Item; - typedef pool::PoolTraits::size_type size_type; - typedef pool::PoolTraits::iterator iterator; - typedef pool::PoolTraits::const_iterator const_iterator; - -public: - - ResPoolManager(); - - ~ResPoolManager(); - - ResPool accessor() const; - - ResPoolProxy proxy() const; - -public: - - void insert(const ResStore& store, bool installed = false); - - void clear(); - -private: - - typedef pool::PoolTraits::ItemContainerT ContainerT; - typedef pool::PoolTraits::Impl Impl; - typedef pool::PoolTraits::Inserter Inserter; - typedef pool::PoolTraits::Deleter Deleter; - -}; - diff --git a/swig/ResStore.i b/swig/ResStore.i deleted file mode 100644 index 2926c80..0000000 --- a/swig/ResStore.i +++ /dev/null @@ -1,42 +0,0 @@ - -class ResStore -{ - typedef ResObject ResT; - typedef std::set<ResT::Ptr> StorageT; - typedef StorageT::size_type size_type; - - public: - ResStore(); - ~ResStore(); - bool empty() const; - size_type size() const; - //iterator insert( const ResT::Ptr & ptr_r ); - //size_type erase( const ResT::Ptr & ptr_r ); - //void erase( iterator pos_r ); - //void erase( iterator first_r, iterator last_r ) - //void erase( const Resolvable::Kind & kind_r ) - void clear(); -}; - -#ifdef SWIGRUBY -iter2(ResStore, ResObject*); -#endif - -#ifdef SWIGPYTHON -%extend ResStore -{ - // just a test - const ResObject* haha() - { - ResStore::iterator i = self->begin(); - const ResObject* tmp = &**i; - return tmp; - } -} -#endif - -#ifdef SWIGPERL5 - -iter(ResStore, ResObject*); - -#endif diff --git a/swig/ResTraits.i b/swig/ResTraits.i index 773ed39..b1803ae 100644 --- a/swig/ResTraits.i +++ b/swig/ResTraits.i @@ -1,13 +1,13 @@ /** Base of ResTraits. Defines the Resolvable::Kind type. */ -struct ResolvableTraits +/*struct ResolvableTraits { typedef KindOf<Resolvable> KindType; -}; +};*/ /** ResTraits. Defines common types and the Kind value. */ template<typename _Res> - struct ResTraits : public ResolvableTraits + struct ResTraits { typedef intrusive_ptr<_Res> PtrType; typedef intrusive_ptr<const _Res> constPtrType; @@ -66,4 +66,3 @@ X##_constPtr asKind##X( const PoolItem & p ); %STUFF(Atom) %STUFF(Script) %STUFF(Message) -%STUFF(Language) diff --git a/swig/Resolvable.i b/swig/Resolvable.i index 1a63349..2fb9c1f 100644 --- a/swig/Resolvable.i +++ b/swig/Resolvable.i @@ -1,6 +1,8 @@ +class Resolvable : protected sat::Solvable, + public base::ReferenceCounted, private base::NonCopyable + { + friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj ); -class Resolvable -{ public: typedef Resolvable Self; typedef ResTraits<Self> TraitsType; @@ -8,27 +10,25 @@ class Resolvable typedef TraitsType::PtrType Ptr; typedef TraitsType::constPtrType constPtr; - const Kind & kind() const; - const std::string & name() const; - const zypp::Edition & edition() const; - const Arch & arch() const; + public: + /** Whether this represents a valid- or no-solvable. */ + + /** \name Dependencies. */ + //@{ + /** Select by Dep. */ + //Capabilities dep( Dep which_r ) const + //{ return operator[]( which_r ); } + + //@} - const CapSet & dep( Dep which_r ) const; - const Dependencies & deps() const; + public: + const sat::Solvable & satSolvable() const { return *this; } protected: - Resolvable( const Kind & kind_r, - const NVRAD & nvrad_r ); + /** Ctor */ + Resolvable( const sat::Solvable & solvable_r ); + /** Dtor */ virtual ~Resolvable(); + /** Helper for stream output */ virtual std::ostream & dumpOn( std::ostream & str ) const; -}; - -int compareByN(const Resolvable::constPtr & lhs, - const Resolvable::constPtr & rhs); - -int compareByNVR(const Resolvable::constPtr & lhs, - const Resolvable::constPtr & rhs); - -int compareByNVRA(const Resolvable::constPtr& lhs, - const Resolvable::constPtr& rhs); - + };
\ No newline at end of file diff --git a/swig/Resolver.i b/swig/Resolver.i index bc756da..16f3b8c 100644 --- a/swig/Resolver.i +++ b/swig/Resolver.i @@ -2,51 +2,7 @@ %template(StringList) std::list<std::string>; #endif -class Resolver -{ - public: - Resolver( const ResPool & pool); - virtual ~Resolver(); - bool verifySystem (); - bool verifySystem (bool considerNewHardware); - bool establishPool (void); - bool freshenPool (void); - bool resolvePool (void); - bool resolvePool (bool tryAllPossibilities); - bool resolveDependencies( void ); - void undo( void ); - solver::detail::ResolverContext_Ptr context (void) const; - void doUpgrade( UpgradeStatistics & opt_stats_r ); - std::list<PoolItem_Ref> problematicUpdateItems( void ) const; - ResolverProblemList problems(); - std::list<std::string> problemDescription( void ) const; - void applySolutions( const ProblemSolutionList & solutions ); - - Arch architecture() const; - void setArchitecture( const Arch & arch); - void setForceResolve (const bool force); - const bool forceResolve(); - void setPreferHighestVersion (const bool highestVersion); - const bool preferHighestVersion(); - bool transactResObject( ResObject::constPtr robj, bool install = true); - //bool transactResKind( Resolvable::Kind kind ); - void transactReset( ResStatus::TransactByValue causer ); - void addRequire (const Capability & capability); - void addConflict (const Capability & capability); - void setTimeout( int seconds ); - int timeout(); - void setMaxSolverPasses (int count); - int maxSolverPasses (); - bool createSolverTestcase (const std::string & dumpPath = "/var/log/YaST2/solverTestcase"); - const solver::detail::ItemCapKindList isInstalledBy (const PoolItem_Ref item); - const std::list<solver::detail::ItemCapKind> installs (const PoolItem_Ref item); - //const solver::detail::ItemCapKindList installs (const PoolItem_Ref item); - - protected: - - private: - solver::detail::Resolver_Ptr _pimpl; -}; +%include <zypp/Resolver.h> typedef intrusive_ptr<Resolver> Resolver_Ptr; %template(Resolver_Ptr) intrusive_ptr<Resolver>; diff --git a/swig/Script.i b/swig/Script.i index e69de29..52e33eb 100644 --- a/swig/Script.i +++ b/swig/Script.i @@ -0,0 +1 @@ +%include <zypp/Script.h>
\ No newline at end of file diff --git a/swig/SrcPackage.i b/swig/SrcPackage.i index c60ccfb..b239fe6 100644 --- a/swig/SrcPackage.i +++ b/swig/SrcPackage.i @@ -1,25 +1 @@ - 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; - }; +%include <zypp/SrcPackage.h>; diff --git a/swig/Target.i b/swig/Target.i index bbff4e6..cf7a1d5 100644 --- a/swig/Target.i +++ b/swig/Target.i @@ -1,60 +1,6 @@ typedef intrusive_ptr<Target> Target_Ptr; -class Target -{ - public: - - typedef std::list<PoolItem_Ref> PoolItemList; - - public: - - /** All resolvables provided by the target. */ - const ResStore & resolvables(); - - /** - * reload the target in future calls if - * needed. - * note the loading can actually be delayed, but - * the next call to resolvables must reflect the - * status of the system. - */ - void reset(); - - /** - * load resolvables of certain kind in the internal store - * and return a iterator - * successive calls will be faster as resolvables are cached- - */ - ResStore::resfilter_const_iterator byKindBegin( const ResObject::Kind & kind_r ) const; - ResStore::resfilter_const_iterator byKindEnd( const ResObject::Kind & kind_r ) const; - - /** Null implementation */ - static Target_Ptr nullimpl(); - - /** Refference to the RPM database */ - //target::rpm::RpmDb & rpmDb(); - - /** If the package is installed and provides the file - Needed to evaluate split provides during Resolver::Upgrade() */ - bool providesFile (const std::string & name_str, const std::string & path_str) const; - - ResObject::constPtr whoOwnsFile (const std::string & path_str) const; - -#ifndef STORAGE_DISABLED - /** enables the storage target */ - bool isStorageEnabled() const; - void enableStorage(const zypp::Pathname &root_r); -#endif - - /** Set the log file for target */ - bool setInstallationLogfile(const zypp::Pathname & path_r); - - /** Return the root set for this target */ - zypp::Pathname root() const; - - /** return the last modification date of the target */ - Date timestamp() const; -}; +%include <zypp/Target.h> %template(Target_Ptr) intrusive_ptr<Target>; diff --git a/swig/TranslatedText.i b/swig/TranslatedText.i index 9ee4e9c..856db5a 100644 --- a/swig/TranslatedText.i +++ b/swig/TranslatedText.i @@ -1,44 +1,2 @@ -class TranslatedText -{ - public: - /** Implementation */ - class Impl; - - public: - /** Default ctor */ - TranslatedText(); - /** Ctor */ - explicit - TranslatedText(const std::string &text, const Locale &lang = Locale()); - /** Ctor. */ - explicit - TranslatedText(const std::list<std::string> &text, const Locale &lang = Locale()); - /** Dtor */ - ~TranslatedText(); - - /** true if the text have no translations for any language */ - bool empty() const ; - - /** static default empty translated text */ - static const TranslatedText notext; - - public: - - /** Synonym for \ref text */ - std::string asString( const Locale &lang = Locale() ) const - { return text(lang); } - - std::string text( const Locale &lang = Locale() ) const; - std::set<Locale> locales() const; - - void setText( const std::string &text, const Locale &lang = Locale()); - void setText( const std::list<std::string> &text, const Locale &lang = Locale()); - - Locale detectLanguage() const; - - private: - /** Pointer to implementation */ - RWCOW_pointer<Impl> _pimpl; - -}; +%include <zypp/TranslatedText.h>
\ No newline at end of file diff --git a/swig/ZYppCommitPolicy.i b/swig/ZYppCommitPolicy.i index fe295f3..23feb3a 100644 --- a/swig/ZYppCommitPolicy.i +++ b/swig/ZYppCommitPolicy.i @@ -5,55 +5,4 @@ %rename("syncPoolAfterCommit=") ZYppCommitPolicy::syncPoolAfterCommit(bool); #endif -class ZYppCommitPolicy -{ - public: - ZYppCommitPolicy() - : _restrictToMedia ( 0 ) - , _dryRun ( false ) - , _rpmNoSignature ( false ) - , _syncPoolAfterCommit( true ) - {} - - public: - unsigned restrictToMedia() const - { return _restrictToMedia; } - - bool dryRun() const - { return _dryRun; } - - bool rpmNoSignature() const - { return _rpmNoSignature; } - - bool syncPoolAfterCommit() const - { return _syncPoolAfterCommit; } - - public: - /** Restrict commit to a certain media number - * \deprecated - */ - ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r ) - { _restrictToMedia = mediaNr_r; return *this; } - - /** Process all media (default) */ - ZYppCommitPolicy & allMedia() - { return restrictToMedia( 0 ); } - - /** Set dry run (default: false) */ - ZYppCommitPolicy & dryRun( bool yesNo_r = true ) - { _dryRun = yesNo_r; return *this; } - - /** Use rpm option --nosignature (default: false) */ - ZYppCommitPolicy & rpmNoSignature( bool yesNo_r = true ) - { _rpmNoSignature = yesNo_r; return *this; } - - /** Kepp pool in sync with the Target databases after commit (default: true) */ - ZYppCommitPolicy & syncPoolAfterCommit( bool yesNo_r = true ) - { _syncPoolAfterCommit = yesNo_r; return *this; } - - private: - unsigned _restrictToMedia; - bool _dryRun; - bool _rpmNoSignature; - bool _syncPoolAfterCommit; -}; +%include <zypp/ZYppCommitPolicy.h>
\ No newline at end of file diff --git a/swig/ZYppCommitResult.i b/swig/ZYppCommitResult.i index 570d3db..8885124 100644 --- a/swig/ZYppCommitResult.i +++ b/swig/ZYppCommitResult.i @@ -1,29 +1,4 @@ -struct ZYppCommitResult - { - ZYppCommitResult() - : _result(0) - {} - - typedef std::list<PoolItem_Ref> PoolItemList; - - /** - * number of committed resolvables - **/ - int _result; - - /** - * list of resolvables with error - **/ - PoolItemList _errors; - /** - * list of resolvables remaining (due to wrong media) - **/ - PoolItemList _remaining; - /** - * list of kind:source resolvables remaining (due to wrong media) - **/ - PoolItemList _srcremaining; - }; +%include <zypp/ZYppCommitResult.h> %extend ZYppCommitResult { diff --git a/swig/ZYppFactory.i b/swig/ZYppFactory.i index 46a8184..971137f 100644 --- a/swig/ZYppFactory.i +++ b/swig/ZYppFactory.i @@ -1,12 +1,4 @@ %template(ZYpp_Ptr) intrusive_ptr<ZYpp>; -class ZYppFactory -{ -public: - static ZYppFactory instance(); - ~ZYppFactory(); - ZYpp::Ptr getZYpp() const; - private: - ZYppFactory(); -}; +%include <zypp/ZYppFactory.h> diff --git a/swig/perl5/CMakeLists.txt b/swig/perl5/CMakeLists.txt index cfed831..2a7f481 100644 --- a/swig/perl5/CMakeLists.txt +++ b/swig/perl5/CMakeLists.txt @@ -18,7 +18,7 @@ SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" ) ADD_CUSTOM_COMMAND ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for perl..." - COMMAND ${SWIG_EXECUTABLE} -c++ -perl5 -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i + COMMAND ${SWIG_EXECUTABLE} -DZYPP_DEPRECATED -c++ -perl5 -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt index cbdb87a..52a66b3 100644 --- a/swig/python/CMakeLists.txt +++ b/swig/python/CMakeLists.txt @@ -16,7 +16,7 @@ SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" ) ADD_CUSTOM_COMMAND ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for python..." - COMMAND ${SWIG_EXECUTABLE} -c++ -python -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i + COMMAND ${SWIG_EXECUTABLE} -DZYPP_DEPRECATED -c++ -python -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i diff --git a/swig/ruby/CMakeLists.txt b/swig/ruby/CMakeLists.txt index 3e144aa..ee7027a 100644 --- a/swig/ruby/CMakeLists.txt +++ b/swig/ruby/CMakeLists.txt @@ -15,7 +15,7 @@ SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" ) ADD_CUSTOM_COMMAND ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for ruby..." - COMMAND ${SWIG_EXECUTABLE} -c++ -ruby -autorename -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i + COMMAND ${SWIG_EXECUTABLE} -DZYPP_DEPRECATED -c++ -ruby -autorename -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i diff --git a/swig/zypp.i b/swig/zypp.i index a0bb995..e3cf4ea 100644 --- a/swig/zypp.i +++ b/swig/zypp.i @@ -16,18 +16,15 @@ #include "zypp/base/PtrTypes.h" #include "zypp/Edition.h" #include "zypp/ResTraits.h" -#include "zypp/ResStore.h" #include "zypp/ZYppFactory.h" #include "zypp/ZYpp.h" #include "zypp/Pathname.h" #include "zypp/base/ReferenceCounted.h" #include "zypp/ResObject.h" -#include "zypp/ResPoolManager.h" #include "zypp/Target.h" #include "zypp/target/TargetImpl.h" #include "zypp/MediaSetAccess.h" #include "zypp/TranslatedText.h" -#include "zypp/CapFactory.h" #include "zypp/Package.h" #include "zypp/Patch.h" #include "zypp/Atom.h" @@ -35,7 +32,6 @@ #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" @@ -53,9 +49,12 @@ using namespace zypp::filesystem; typedef std::set<Url> UrlSet; typedef std::list<std::string> StringList; -typedef std::list<solver::detail::ItemCapKind> ItemCapKindList; %} +%nodefault ByKind; +%define DEFINE_PTR_TYPE(name) +%enddef + %rename("+") "operator+"; %rename("<<") "operator<<"; %rename("!=") "operator!="; @@ -96,13 +95,12 @@ class intrusive_ptr { %include "ResStatus.i" %include "NeedAType.i" %include "Arch.i" -%include "ResStore.i" %include "Edition.i" %include "Kind.i" %include "ResTraits.i" %include "Date.i" %include "Capability.i" -%include "CapSet.i" +%include "Capabilities.i" %include "Dependencies.i" %include "Dep.i" %include "Resolvable.i" @@ -116,10 +114,6 @@ class intrusive_ptr { %include "TranslatedText.i" %include "CheckSum.i" %include "CapMatch.i" -%include "CapFactory.i" -%include "NVR.i" -%include "NVRA.i" -%include "NVRAD.i" %include "Package.i" %include "Patch.i" %include "Atom.i" @@ -127,7 +121,6 @@ class intrusive_ptr { %include "Script.i" %include "Message.i" %include "Pattern.i" -%include "Language.i" %include "Product.i" %include "PublicKey.i" %include "KeyRing.i" @@ -135,17 +128,14 @@ class intrusive_ptr { %include "MediaSetAccess.i" %include "PoolItem.i" %include "ResPool.i" -%include "ResPoolManager.i" %include "ZYppCommitPolicy.i" %include "ZYppCommitResult.i" %include "TmpPath.i" -%include "ItemCapKind.i" %include "Resolver.i" #ifdef SWIGPYTHON %include "python/callbacks.i" #endif - class ZYpp { public: @@ -153,15 +143,10 @@ class ZYpp typedef intrusive_ptr<const ZYpp> constPtr; public: - ResPool pool() const; - ResPoolProxy poolProxy() const; + //ResPool pool() const; + //ResPoolProxy poolProxy() const; /* - SourceFeed_Ref sourceFeed() const; - */ - void addResolvables (const ResStore& store, bool installed = false); - void removeResolvables (const ResStore& store); - /* DiskUsageCounter::MountPointSet diskUsage(); void setPartitions(const DiskUsageCounter::MountPointSet &mp); */ |