summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2014-04-03 16:20:28 +0200
committerMichael Schroeder <mls@suse.de>2014-04-03 16:20:28 +0200
commitb8d3888fdcb2c625f9c025db9ca858ec8199d562 (patch)
treefa8ff2966a3689ab0ba75b677aaa888b5286c521 /examples
parentb2ef9eb3b18a0b543f7011ed33165b7ff6e7f425 (diff)
downloadlibsolv-b8d3888fdcb2c625f9c025db9ca858ec8199d562.tar.gz
libsolv-b8d3888fdcb2c625f9c025db9ca858ec8199d562.tar.bz2
libsolv-b8d3888fdcb2c625f9c025db9ca858ec8199d562.zip
INCOMPATIBLE bindings change: modernize Dataiterator/Datamatch classes
Use attributes instead of methods to access the matched data (except for Datapos constructors). Also, while we're breaking the API, drop the solvid argument from the Dataiterator constructors. Add different constructors for the special cases. Also fix and document Datamatcher's 'binary' attribute.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/p5solv8
-rwxr-xr-xexamples/pysolv10
-rwxr-xr-xexamples/rbsolv8
3 files changed, 13 insertions, 13 deletions
diff --git a/examples/p5solv b/examples/p5solv
index 77d580a..330ec63 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -197,7 +197,7 @@ our @ISA = ('Repo::generic');
sub find {
my ($self, $what) = @_;
- my $di = $self->{handle}->Dataiterator($solv::SOLVID_META, $solv::REPOSITORY_REPOMD_TYPE, $what, $solv::Dataiterator::SEARCH_STRING);
+ my $di = $self->{handle}->Dataiterator_meta($solv::REPOSITORY_REPOMD_TYPE, $what, $solv::Dataiterator::SEARCH_STRING);
$di->prepend_keyname($solv::REPOSITORY_REPOMD);
for my $d (@$di) {
my $dp = $d->parentpos();
@@ -318,7 +318,7 @@ our @ISA = ('Repo::generic');
sub find {
my ($self, $what) = @_;
- my $di = $self->{handle}->Dataiterator($solv::SOLVID_META, $solv::SUSETAGS_FILE_NAME, $what, $solv::Dataiterator::SEARCH_STRING);
+ my $di = $self->{handle}->Dataiterator_meta($solv::SUSETAGS_FILE_NAME, $what, $solv::Dataiterator::SEARCH_STRING);
$di->prepend_keyname($solv::SUSETAGS_FILE);
for my $d (@$di) {
my $dp = $d->parentpos();
@@ -364,7 +364,7 @@ sub add_ext {
sub add_exts {
my ($self) = @_;
my $repodata = $self->{handle}->add_repodata(0);
- my $di = $self->{handle}->Dataiterator($solv::SOLVID_META, $solv::SUSETAGS_FILE_NAME, undef, 0);
+ my $di = $self->{handle}->Dataiterator_meta($solv::SUSETAGS_FILE_NAME, undef, 0);
$di->prepend_keyname($solv::SUSETAGS_FILE);
for my $d (@$di) {
my $filename = $d->str();
@@ -551,7 +551,7 @@ for my $repo (@repos) {
if ($cmd eq 'search') {
$pool->createwhatprovides();
my $sel = $pool->Selection();
- my $di = $pool->Dataiterator(0, $solv::SOLVABLE_NAME, $ARGV[0], $solv::Dataiterator::SEARCH_SUBSTRING | $solv::Dataiterator::SEARCH_NOCASE);
+ my $di = $pool->Dataiterator($solv::SOLVABLE_NAME, $ARGV[0], $solv::Dataiterator::SEARCH_SUBSTRING | $solv::Dataiterator::SEARCH_NOCASE);
for my $d (@$di) {
$sel->add_raw($solv::Job::SOLVER_SOLVABLE, $d->{solvid});
}
diff --git a/examples/pysolv b/examples/pysolv
index ef1672d..22ae209 100755
--- a/examples/pysolv
+++ b/examples/pysolv
@@ -344,7 +344,7 @@ class repo_repomd(repo_generic):
return True
def find(self, what):
- di = self.handle.Dataiterator(solv.SOLVID_META, solv.REPOSITORY_REPOMD_TYPE, what, solv.Dataiterator.SEARCH_STRING)
+ di = self.handle.Dataiterator_meta(solv.REPOSITORY_REPOMD_TYPE, what, solv.Dataiterator.SEARCH_STRING)
di.prepend_keyname(solv.REPOSITORY_REPOMD)
for d in di:
dp = d.parentpos()
@@ -453,7 +453,7 @@ class repo_susetags(repo_generic):
return True
def find(self, what):
- di = self.handle.Dataiterator(solv.SOLVID_META, solv.SUSETAGS_FILE_NAME, what, solv.Dataiterator.SEARCH_STRING)
+ di = self.handle.Dataiterator_meta(solv.SUSETAGS_FILE_NAME, what, solv.Dataiterator.SEARCH_STRING)
di.prepend_keyname(solv.SUSETAGS_FILE)
for d in di:
dp = d.parentpos()
@@ -490,10 +490,10 @@ class repo_susetags(repo_generic):
def add_exts(self):
repodata = self.handle.add_repodata(0)
- di = self.handle.Dataiterator(solv.SOLVID_META, solv.SUSETAGS_FILE_NAME, None, 0)
+ di = self.handle.Dataiterator_meta(solv.SUSETAGS_FILE_NAME, None, 0)
di.prepend_keyname(solv.SUSETAGS_FILE)
for d in di:
- filename = d.str()
+ filename = d.str
if not filename:
continue
if filename[0:9] != "packages.":
@@ -658,7 +658,7 @@ if options.repos:
if cmd == 'search':
pool.createwhatprovides()
sel = pool.Selection()
- di = pool.Dataiterator(0, solv.SOLVABLE_NAME, args[0], solv.Dataiterator.SEARCH_SUBSTRING|solv.Dataiterator.SEARCH_NOCASE)
+ di = pool.Dataiterator(solv.SOLVABLE_NAME, args[0], solv.Dataiterator.SEARCH_SUBSTRING|solv.Dataiterator.SEARCH_NOCASE)
for d in di:
sel.add_raw(solv.Job.SOLVER_SOLVABLE, d.solvid)
if repofilter:
diff --git a/examples/rbsolv b/examples/rbsolv
index c67a4c4..470438d 100755
--- a/examples/rbsolv
+++ b/examples/rbsolv
@@ -219,7 +219,7 @@ end
class Repo_rpmmd < Repo_generic
def find(what)
- di = @handle.Dataiterator(Solv::SOLVID_META, Solv::REPOSITORY_REPOMD_TYPE, what, Solv::Dataiterator::SEARCH_STRING)
+ di = @handle.Dataiterator_meta(Solv::REPOSITORY_REPOMD_TYPE, what, Solv::Dataiterator::SEARCH_STRING)
di.prepend_keyname(Solv::REPOSITORY_REPOMD)
for d in di
dp = d.parentpos()
@@ -337,7 +337,7 @@ end
class Repo_susetags < Repo_generic
def find(what)
- di = @handle.Dataiterator(Solv::SOLVID_META, Solv::SUSETAGS_FILE_NAME, what, Solv::Dataiterator::SEARCH_STRING)
+ di = @handle.Dataiterator_meta(Solv::SUSETAGS_FILE_NAME, what, Solv::Dataiterator::SEARCH_STRING)
di.prepend_keyname(Solv::SUSETAGS_FILE)
for d in di
dp = d.parentpos()
@@ -428,7 +428,7 @@ class Repo_susetags < Repo_generic
def add_exts
repodata = @handle.add_repodata(0)
- di = @handle.Dataiterator(Solv::SOLVID_META, Solv::SUSETAGS_FILE_NAME, nil, 0)
+ di = @handle.Dataiterator_meta(Solv::SUSETAGS_FILE_NAME, nil, 0)
di.prepend_keyname(Solv::SUSETAGS_FILE)
for d in di
filename = d.str
@@ -560,7 +560,7 @@ end
if cmd == 'search'
pool.createwhatprovides()
sel = pool.Selection
- for di in pool.Dataiterator(0, Solv::SOLVABLE_NAME, args[0], Solv::Dataiterator::SEARCH_SUBSTRING | Solv::Dataiterator::SEARCH_NOCASE)
+ for di in pool.Dataiterator(Solv::SOLVABLE_NAME, args[0], Solv::Dataiterator::SEARCH_SUBSTRING | Solv::Dataiterator::SEARCH_NOCASE)
sel.add_raw(Solv::Job::SOLVER_SOLVABLE, di.solvid)
end
for s in sel.solvables