Mailinglist Archive: zypp-commit (325 mails)

< Previous Next >
[zypp-commit] r7157 - in /trunk/libzypp-bindings: examples/perl/list_target_resolvables.pl examples/perl/test.pl swig/CapSet.i swig/ResPool.i swig/ResStore.i swig/perl5/perl.i swig/zypp.i
  • From: haass@xxxxxxxxxxxxxxxx
  • Date: Mon, 10 Sep 2007 09:07:21 -0000
  • Message-id: <20070910090721.B33CE2B06D@xxxxxxxxxxxxxxxx>
Author: haass
Date: Mon Sep 10 11:07:21 2007
New Revision: 7157

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7157&view=rev
Log:
Changes for perl-bindings and examples

Modified:
    trunk/libzypp-bindings/examples/perl/list_target_resolvables.pl
    trunk/libzypp-bindings/examples/perl/test.pl
    trunk/libzypp-bindings/swig/CapSet.i
    trunk/libzypp-bindings/swig/ResPool.i
    trunk/libzypp-bindings/swig/ResStore.i
    trunk/libzypp-bindings/swig/perl5/perl.i
    trunk/libzypp-bindings/swig/zypp.i

Modified: trunk/libzypp-bindings/examples/perl/list_target_resolvables.pl
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/examples/perl/list_target_resolvables.pl?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/examples/perl/list_target_resolvables.pl (original)
+++ trunk/libzypp-bindings/examples/perl/list_target_resolvables.pl Mon Sep 10 11:07:21 2007
@@ -8,9 +8,9 @@
 $repo = $zypp->target;
 $store = $repo->resolvables;
 
-$it_b = $store->begin;
+$it_b = $store->cBegin;
 
-while ($store->iterator_equal($it_b, $store->end) ne 1){
+while ($store->iterator_equal($it_b, $store->cEnd) ne 1){
    $pkg = $store->iterator_value($it_b);
    print $pkg->kindToS, " ", $pkg->name, " ", $pkg->edition->asString;
    print $pkg->arch->asString, "\n";
@@ -19,4 +19,16 @@
    print "  Vendor: ", $pkg->vendor, "\n";
    print "  BuildTime: ", $pkg->buildtime->asString, "\n";
    $it_b = $store->iterator_incr($it_b);
+
+   $deps = $pkg->dep($zyppc::Dep_PROVIDES);
+
+   $it_b2 = $deps->cBegin;
+
+   while($deps->iterator_equal($it_b2, $deps->cEnd) ne 1){
+      $dep = $deps->iterator_value($it_b2);
+      print "Provides: ", $dep->asString, "\n";
+      $it_b2 = $deps->iterator_incr($it_b2);
+   }
+   print "\n";
+   
 }

Modified: trunk/libzypp-bindings/examples/perl/test.pl
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/examples/perl/test.pl?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/examples/perl/test.pl (original)
+++ trunk/libzypp-bindings/examples/perl/test.pl Mon Sep 10 11:07:21 2007
@@ -9,18 +9,20 @@
 chomp($ipkg);
 print "Importing packages from pdb!\n\n";
 print "This may take a while, please be patient!\n";
-$pdb->readOut;
+if($pdb->readOut ne 1){
+   exit;
+}
 $store = $pdb->getStore;
 $zypp->addResolvables($store);
 
 $pool = $zypp->pool;
-$it_b = $pool->begin;
-$it_e = $pool->end;
+$it_b = $pool->cBegin;
+$it_e = $pool->cEnd;
 
 $checker = 0;
 
 print "Looking for package...!\n";
-while ($pool->iterator_equal($it_b, $pool->end) ne 1){
+while ($pool->iterator_equal($it_b, $pool->cEnd) ne 1){
    $pkg = $pool->iterator_value($it_b);
    $test = $pkg->resolvable;
    $it_b = $pool->iterator_incr($it_b);
@@ -40,7 +42,7 @@
 
 $resolver = zypp::Resolver->new($pool);
 
-$it_b = $pool->begin;
+$it_b = $pool->cBegin;
 if($resolver->resolvePool ne 1){
    print "Unable to solve the pool!!!\n";
    print "Problem Description: ";
@@ -51,7 +53,7 @@
 }else{
    print "These packages has to be installed: \n";
 #   while ($it_b ne $pool->end){
-   while ($pool->iterator_equal($it_b, $pool->end) ne 1){
+   while ($pool->iterator_equal($it_b, $pool->cEnd) ne 1){
       $pkg = $pool->iterator_value($it_b);
       $it_b = $pool->iterator_incr($it_b);
       $test = $pkg->resolvable;

Modified: trunk/libzypp-bindings/swig/CapSet.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/CapSet.i?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/CapSet.i (original)
+++ trunk/libzypp-bindings/swig/CapSet.i Mon Sep 10 11:07:21 2007
@@ -31,3 +31,7 @@
     }
 }
 #endif
+
+#ifdef SWIGPERL5
+iter2(CapSet, Capability);
+#endif

Modified: trunk/libzypp-bindings/swig/ResPool.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResPool.i?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResPool.i (original)
+++ trunk/libzypp-bindings/swig/ResPool.i Mon Sep 10 11:07:21 2007
@@ -152,23 +152,7 @@
 
 #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);
-   }
-};
+iter2(ResPool, PoolItem_Ref);
 
 #endif
 

Modified: trunk/libzypp-bindings/swig/ResStore.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResStore.i?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResStore.i (original)
+++ trunk/libzypp-bindings/swig/ResStore.i Mon Sep 10 11:07:21 2007
@@ -37,24 +37,6 @@
 
 #ifdef SWIGPERL5
 
-%extend ResStore {
-   
-   ResStore::iterator begin() {
-      return self->begin();
-   }
-   ResStore::iterator end() {
-      return self->end();
-   }
-   ResStore::iterator iterator_incr(ResStore::iterator *it) {
-      (*it)++;
-      return *it;
-   }
-   const ResObject* iterator_value(ResStore::iterator it) {
-      return (&**it);
-   }
-   bool iterator_equal(ResStore::iterator it1, ResStore::iterator it2) {
-      return (it1 == it2);
-   }
-};
+iter(ResStore, ResObject*);
 
 #endif

Modified: trunk/libzypp-bindings/swig/perl5/perl.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/perl5/perl.i?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/perl5/perl.i (original)
+++ trunk/libzypp-bindings/swig/perl5/perl.i Mon Sep 10 11:07:21 2007
@@ -0,0 +1,49 @@
+%define iter(cls, storetype)
+%extend cls {
+   cls::const_iterator iterator_incr(cls::const_iterator *it){
+      (*it)++;
+      return *it;
+   }
+   cls::const_iterator iterator_decr(cls::const_iterator *it){
+      (*it)--;
+      return *it;
+   }
+   bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+      return (it1 == it2);
+   }
+   storetype iterator_value(cls::const_iterator it) {
+      return (&**it);
+   }
+   cls::const_iterator cBegin() {
+      return self->begin();
+   }
+   cls::const_iterator cEnd() {
+      return self->end();
+   }
+};
+%enddef
+
+%define iter2(cls, storetype)
+%extend cls {
+   cls::const_iterator iterator_incr(cls::const_iterator *it){
+      (*it)++;
+      return *it;
+   }
+   cls::const_iterator iterator_decr(cls::const_iterator *it){
+      (*it)--;
+      return *it;
+   }
+   bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+      return (it1 == it2);
+   }
+   storetype iterator_value(cls::const_iterator it) {
+      return (*it);
+   }
+   cls::const_iterator cBegin() {
+      return self->begin();
+   }
+   cls::const_iterator cEnd() {
+      return self->end();
+   }
+};
+%enddef

Modified: trunk/libzypp-bindings/swig/zypp.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/zypp.i?rev=7157&r1=7156&r2=7157&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/zypp.i (original)
+++ trunk/libzypp-bindings/swig/zypp.i Mon Sep 10 11:07:21 2007
@@ -77,6 +77,7 @@
 
 #ifdef SWIGPERL5
 %include "std_list.i"
+%include "perl5/perl.i"
 #endif
 
 %include "Pathname.i"

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

< Previous Next >
This Thread
  • No further messages