Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : properly support REPOKEY_TYPE_IDARRAY
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Mon, 15 Jun 2009 14:28:30 +0200
  • Message-id: <E1MGBKn-0006Ju-Bm@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 1c9f64eb49c3abc994a219e6f60086e631addd6d
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Mon Jun 15 14:28:30 2009 +0200

properly support REPOKEY_TYPE_IDARRAY

plus sample usage (for repository:addedfileprovides)

Perl does not work correctly (probably due to my lack of Perl knowledge)
---
bindings/perl/tests/repo.pl | 2 ++
bindings/python/tests/repo.py | 1 +
bindings/ruby/tests/repodata.rb | 6 ++++--
bindings/satsolver.i | 27 +++++++++++----------------
4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/bindings/perl/tests/repo.pl b/bindings/perl/tests/repo.pl
index 6e03c69..cadc480 100644
--- a/bindings/perl/tests/repo.pl
+++ b/bindings/perl/tests/repo.pl
@@ -26,3 +26,5 @@ print "Repo \"" . $repo->name() . "\" size " . $repo->size()
. ", count " . $rep
my $timestamp = $repo->attr("repository:timestamp");

print "Timestamp: " . $timestamp . "\n";
+
+print "Addedfileprovides: " . $repo->attr("repository:addedfileprovides") .
"\n";
diff --git a/bindings/python/tests/repo.py b/bindings/python/tests/repo.py
index 8461da7..c0737ec 100644
--- a/bindings/python/tests/repo.py
+++ b/bindings/python/tests/repo.py
@@ -83,6 +83,7 @@ class TestSequenceFunctions(unittest.TestCase):
assert pool
pool.set_arch("i686")
repo = pool.add_solv( "../../testdata/os11-biarch.solv" )
+ print "Addedfileprovides ", repo.attr("repository:addedfileprovides")
for s in pool.providers("glibc"):
print s, "provides 'glibc'"
assert True
diff --git a/bindings/ruby/tests/repodata.rb b/bindings/ruby/tests/repodata.rb
index cfafb0c..71a15c3 100644
--- a/bindings/ruby/tests/repodata.rb
+++ b/bindings/ruby/tests/repodata.rb
@@ -19,7 +19,7 @@ class RepodataTest < Test::Unit::TestCase
repo.name = "openSUSE 11.0 Beta3 BiArch"
puts "Repo #{repo.name} loaded with #{repo.size} solvables"

- puts "Repo has #{repo.datasize} Repodatas attached"
+# puts "Repo has #{repo.datasize} Repodatas attached"
assert repo.datasize > 0
assert repo.data(-1) == nil
assert repo.data(repo.datasize) == nil
@@ -36,11 +36,13 @@ class RepodataTest < Test::Unit::TestCase
puts " Key '#{k.name}' is #{k.type}[#{k.type_id}] with #{k.size} bytes"
}

+ puts "repository:addedfileprovides:
#{repo.attr('repository:addedfileprovides').inspect}"
+
i = 0
repo.each { |s|
bt = s['solvable:buildtime']
bt = Time.at(bt) if bt.is_a? Fixnum
- puts "Solvable #{s}: group #{s['solvable:group']}, time #{bt},
downloadsize #{s['solvable:downloadsize']}, installsize
#{s['solvable:installsize']}"
+# puts "Solvable #{s}: group #{s['solvable:group']}, time #{bt},
downloadsize #{s['solvable:downloadsize']}, installsize
#{s['solvable:installsize']}"
i += 1
break if i == 10
}
diff --git a/bindings/satsolver.i b/bindings/satsolver.i
index 92178a0..562a94e 100644
--- a/bindings/satsolver.i
+++ b/bindings/satsolver.i
@@ -246,10 +246,17 @@ dataiterator_value( Dataiterator *di )
value = Swig_String( di->kv.str );
break;
case REPOKEY_TYPE_IDARRAY:
- if (di->data && di->data->localpool)
- value = Swig_String(stringpool_id2str( &di->data->spool, di->kv.id ));
- else
- value = Swig_String(id2str( di->repo->pool, di->kv.id ));
+ {
+ Swig_Type result = Swig_Array();
+ do {
+ if (di->data && di->data->localpool)
+ Swig_Append( result, Swig_String(
stringpool_id2str(&di->data->spool, di->kv.id ) ) );
+ else
+ Swig_Append( result, Swig_String( id2str( di->repo->pool, di->kv.id
) ) );
+ }
+ while (dataiterator_step(di));
+ value = result;
+ }
break;
case REPOKEY_TYPE_REL_IDARRAY:
fprintf(stderr, "REPOKEY_TYPE_REL_IDARRAY: unhandled\n");
@@ -288,18 +295,6 @@ dataiterator_value( Dataiterator *di )
fprintf(stderr, "Unhandled type %d\n", di->key->type);
}
return value;
-#if 0
- Swig_Type result = Swig_Array();
- if (di->data && di->data->localpool)
- Swig_Append( result, Swig_String( stringpool_id2str( &di->data->spool,
di->key->name ) ) );
- else
- Swig_Append( result, Swig_String( id2str( di->repo->pool, di->key->name )
) );
- Swig_Append( result, value );
-
- value = Swig_Null;
-
- return result;
-#endif
}


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

< Previous Next >
This Thread
  • No further messages