Author: haass
Date: Thu Sep 6 16:15:14 2007
New Revision: 7127
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7127&view=rev
Log:
first running version of perl-bindings
Added:
trunk/libzypp-bindings/swig/ItemCapKind.i
trunk/libzypp-bindings/swig/Resolver.i
trunk/libzypp-bindings/swig/perl5/
trunk/libzypp-bindings/swig/perl5/CMakeLists.txt
trunk/libzypp-bindings/swig/perl5/perl.i
Modified:
trunk/libzypp-bindings/swig/CMakeLists.txt
trunk/libzypp-bindings/swig/RepoInfo.i
trunk/libzypp-bindings/swig/ResPool.i
trunk/libzypp-bindings/swig/ResStatus.i
trunk/libzypp-bindings/swig/zypp.i
Modified: trunk/libzypp-bindings/swig/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/CMakeLists.txt?rev=7127&r1=7126&r2=7127&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/CMakeLists.txt (original)
+++ trunk/libzypp-bindings/swig/CMakeLists.txt Thu Sep 6 16:15:14 2007
@@ -3,3 +3,5 @@
ADD_SUBDIRECTORY(python)
+ADD_SUBDIRECTORY(perl5)
+
Added: trunk/libzypp-bindings/swig/ItemCapKind.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ItemCapKind.i?rev=7127&view=auto
==============================================================================
--- trunk/libzypp-bindings/swig/ItemCapKind.i (added)
+++ trunk/libzypp-bindings/swig/ItemCapKind.i Thu Sep 6 16:15:14 2007
@@ -0,0 +1,59 @@
+/*%{
+
+struct solver::detail::ItemCapKind
+{
+ public:
+ Capability cap; //Capability which has triggerd this selection
+ Dep capKind; //Kind of that capability
+ PoolItem_Ref item; //Item which has triggered this selection
+ bool initialInstallation; //This item has triggered the installation
+ //Not already fullfilled requierement only.
+
+ ItemCapKind( PoolItem i, Capability c, Dep k, bool initial)
+ : cap( c )
+ , capKind( k )
+ , item( i )
+ , initialInstallation( initial )
+ { }
+};
+//typedef std::listsolver::detail::ItemCapKind solver::detail::ItemCapKindList;
+%}
+*/
+
+namespace zypp
+{
+ 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 )
+ { }
+ };
+ }
+ }
+}
+typedef std::listsolver::detail::ItemCapKind solver::detail::ItemCapKindList;
+%template(ItemCapKindList) std::listsolver::detail::ItemCapKind;
+
+#ifdef SWIGRUBY
+ auto_iterator(std::listsolver::detail::ItemCapKind, solver::detail::ItemCapKind);
+#endif
+
Modified: trunk/libzypp-bindings/swig/RepoInfo.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/RepoInfo.i?rev=7127&r1=7126&r2=7127&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/RepoInfo.i (original)
+++ trunk/libzypp-bindings/swig/RepoInfo.i Thu Sep 6 16:15:14 2007
@@ -1,5 +1,7 @@
-
-%template(UrlSet) std::set<Url>;
+#ifdef SWIGPERL5
+#else
+ %template(UrlSet) std::set<Url>;
+#endif
class RepoInfo
{
Modified: trunk/libzypp-bindings/swig/ResPool.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResPool.i?rev=7127&r1=7126&r2=7127&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResPool.i (original)
+++ trunk/libzypp-bindings/swig/ResPool.i Thu Sep 6 16:15:14 2007
@@ -27,10 +27,10 @@
/** \name Iterate through all ResObjects (all kinds). */
//@{
- /**
+ #ifdef SWIGPERL5
const_iterator begin() const;
const_iterator end() const;
- */
+ #endif
//@}
public:
@@ -150,6 +150,27 @@
};
+#ifdef SWIGPERL5
+
+%extend ResPool {
+
+ pool::PoolTraits::const_iterator iterator_incr(pool::PoolTraits::const_iterator *it ) {
+ (*it)++;
+ return *it;
+ }
+ pool::PoolTraits::const_iterator iterator_decr(pool::PoolTraits::const_iterator it) {
+ (it)--;
+ return it;
+ }
+ bool iterator_equal(pool::PoolTraits::const_iterator it1, pool::PoolTraits::const_iterator it2) {
+ return (it1 == it2);
+ }
+ PoolItem_Ref iterator_value(pool::PoolTraits::const_iterator it) {
+ return (*it);
+ }
+};
+
+#endif
#ifdef SWIGRUBY
Modified: trunk/libzypp-bindings/swig/ResStatus.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResStatus.i?rev=7127&r1=7126&r2=7127&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResStatus.i (original)
+++ trunk/libzypp-bindings/swig/ResStatus.i Thu Sep 6 16:15:14 2007
@@ -1,6 +1,16 @@
class ResStatus
{
+ public:
+
+ /** Default ctor. */
+ ResStatus();
+
+ /** Ctor setting the initial . */
+ ResStatus( bool isInstalled_r );
+
+ /** Dtor. */
+ ~ResStatus();
public:
/** \name BitField range definitions.
@@ -78,9 +88,9 @@
};
enum SolverStateValue
{
- NORMAL = bit::RangeValue::value, // default, notthing special
- SEEN = bit::RangeValue::value, // already seen during ResolverUpgrade
- IMPOSSIBLE = bit::RangeValue::value // impossible to install
+ NORMAL = bit::RangeValue::value, // default, notthing special
+ SEEN = bit::RangeValue::value, // already seen during ResolverUpgrade
+ IMPOSSIBLE = bit::RangeValue::value // impossible to install
};
enum LicenceConfirmedValue
@@ -92,15 +102,6 @@
public:
- /** Default ctor. */
- ResStatus();
-
- /** Ctor setting the initial . */
- ResStatus( bool isInstalled_r );
-
- /** Dtor. */
- ~ResStatus();
-
/** Debug helper returning the bitfield.
* It's save to expose the bitfield, as it can't be used to
* recreate a ResStatus. So it is not possible to bypass
@@ -369,3 +370,14 @@
private:
BitFieldType _bitfield;
};
+
+#ifdef SWIGPERL5
+
+ %extend ResStatus {
+
+ bool setToBeInstalledUser()
+ {
+ return self->setToBeInstalled(ResStatus::USER);
+ }
+ };
+#endif
Added: trunk/libzypp-bindings/swig/Resolver.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/Resolver.i?rev=7127&view=auto
==============================================================================
--- trunk/libzypp-bindings/swig/Resolver.i (added)
+++ trunk/libzypp-bindings/swig/Resolver.i Thu Sep 6 16:15:14 2007
@@ -0,0 +1,50 @@
+#ifdef SWIGPERL5
+ %template(StringList) std::liststd::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 problematicUpdateItems( void ) const;
+ ResolverProblemList problems();
+ std::liststd::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::listsolver::detail::ItemCapKind installs (const PoolItem_Ref item);
+ //const solver::detail::ItemCapKindList installs (const PoolItem_Ref item);
+
+ protected:
+
+ private:
+ solver::detail::Resolver_Ptr _pimpl;
+};
+
Added: trunk/libzypp-bindings/swig/perl5/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/perl5/CMakeLists.txt?rev=7127&view=auto
==============================================================================
--- trunk/libzypp-bindings/swig/perl5/CMakeLists.txt (added)
+++ trunk/libzypp-bindings/swig/perl5/CMakeLists.txt Thu Sep 6 16:15:14 2007
@@ -0,0 +1,41 @@
+FIND_PACKAGE(Perl REQUIRED)
+
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{cppflags}" OUTPUT_VARIABLE PERL_CXX_FLAGS)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PERL_CXX_FLAGS}")
+
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{archlibexp}" OUTPUT_VARIABLE PERL_LIB_PATH)
+SET( PERL_INS_PATH "${PERL_LIB_PATH}" )
+SET( PERL_LIB_PATH "${PERL_LIB_PATH}/CORE" )
+
+MESSAGE(STATUS "Perl executable: ${PERL_EXECUTABLE}")
+MESSAGE(STATUS "Perl cpp-flags: ${PERL_CXX_FLAGS}")
+MESSAGE(STATUS "Perl lib path: ${PERL_LIB_PATH}")
+
+SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
+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 ${CMAKE_COMMAND} -E echo "Done."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+)
+
+ADD_CUSTOM_TARGET( glue
+ DEPENDS ${SWIG_OUTPUT}
+)
+
+ADD_LIBRARY( zypp SHARED "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
+SET_TARGET_PROPERTIES( zypp PROPERTIES PREFIX "" )
+ADD_DEPENDENCIES( zypp glue )
+
+INCLUDE_DIRECTORIES( ${PERL_LIB_PATH} )
+INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+TARGET_LINK_LIBRARIES( zypp ${ZYPP_LIBRARY} )
+
+INSTALL(TARGETS zypp LIBRARY DESTINATION ${PERL_INS_PATH})
+INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/zypp.pm DESTINATION ${PERL_INS_PATH})
+
Added: trunk/libzypp-bindings/swig/perl5/perl.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/perl5/perl.i?rev=7127&view=auto
==============================================================================
(empty)
Modified: trunk/libzypp-bindings/swig/zypp.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/zypp.i?rev=7127&r1=7126&r2=7127&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/zypp.i (original)
+++ trunk/libzypp-bindings/swig/zypp.i Thu Sep 6 16:15:14 2007
@@ -1,11 +1,17 @@
%module zypp
+#ifdef SWIGPERL5
+%{
+ #define SWIGPERLHACK
+ #undef NORMAL
+%}
+#endif
+
%{
/* Includes the header in the wrapper code */
#include "zypp/base/PtrTypes.h"
#include
#include
-#include
#include
#include
#include
@@ -14,7 +20,10 @@
#include "zypp/ResObject.h"
#include "zypp/ResPoolManager.h"
#include "zypp/Target.h"
-#include "zypp/target/TargetImpl.h"
+#ifndef SWIGPERLHACK
+ #include "zypp/target/TargetImpl.h"
+ #include "zypp/MediaSetAccess.h"
+#endif
#include "zypp/TranslatedText.h"
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
@@ -23,8 +32,8 @@
#include "zypp/Repository.h"
#include "zypp/RepoManager.h"
#include "zypp/repo/RepoType.h"
-#include "zypp/MediaSetAccess.h"
#include "zypp/TmpPath.h"
+#include "zypp/Resolver.h"
using namespace boost;
using namespace zypp;
@@ -33,6 +42,7 @@
using namespace zypp::filesystem;
typedef std::set<Url> UrlSet;
+typedef std::liststd::string StringList;
%}
%rename("+") "operator+";
@@ -65,9 +75,13 @@
%include "python/python.i"
#endif
+#ifdef SWIGPERL5
+%include "std_list.i"
+#endif
%include "Pathname.i"
%include "Url.i"
+%include "ResStatus.i"
%include "NeedAType.i"
%include "Arch.i"
%include "ResStore.i"
@@ -96,15 +110,18 @@
%include "Package.i"
%include "PublicKey.i"
%include "KeyRing.i"
-%include "Target.i"
-%include "ResStatus.i"
+#ifndef SWIGPERL5
+ %include "Target.i"
+ %include "MediaSetAccess.i"
+#endif
%include "PoolItem.i"
%include "ResPool.i"
%include "ResPoolManager.i"
%include "ZYppCommitPolicy.i"
%include "ZYppCommitResult.i"
-%include "MediaSetAccess.i"
%include "TmpPath.i"
+%include "Resolver.i"
+%include "ItemCapKind.i"
class ZYpp
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org