summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-10-08 16:35:13 +0200
committerMichael Schroeder <mls@suse.de>2012-10-08 16:35:13 +0200
commita9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8 (patch)
treed91e6e906c3927e479ac19fbed8f4c5e1ad41b5d /examples
parentee4fa1bef4127b860cf1c8d142da7e70e08f2a1f (diff)
downloadlibsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.tar.gz
libsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.tar.bz2
libsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.zip
only call add_products if the method exists
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/p5solv4
-rwxr-xr-xexamples/pysolv3
-rwxr-xr-xexamples/rbsolv4
3 files changed, 8 insertions, 3 deletions
diff --git a/examples/p5solv b/examples/p5solv
index 015002e..58cdc9a 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -476,7 +476,9 @@ sub load {
return 1;
}
print "reading\n";
- $self->{'handle'}->add_products("/etc/products.d", $solv::Repo::REPO_NO_INTERNALIZE);
+ if (defined(&solv::Repo::add_products)) {
+ $self->{'handle'}->add_products("/etc/products.d", $solv::Repo::REPO_NO_INTERNALIZE);
+ }
$self->{'handle'}->add_rpmdb(undef, $solv::Repo::REPO_REUSE_REPODATA);
$self->writecachedrepo();
return 1;
diff --git a/examples/pysolv b/examples/pysolv
index fa723a0..af86961 100755
--- a/examples/pysolv
+++ b/examples/pysolv
@@ -550,7 +550,8 @@ class repo_system(repo_generic):
print "cached"
return True
print "reading"
- self.handle.add_products("/etc/products.d", Repo.REPO_NO_INTERNALIZE)
+ if hasattr(self.handle.__class__, 'add_products'):
+ self.handle.add_products("/etc/products.d", Repo.REPO_NO_INTERNALIZE)
self.handle.add_rpmdb(None, Repo.REPO_REUSE_REPODATA)
self.writecachedrepo(None)
return True
diff --git a/examples/rbsolv b/examples/rbsolv
index 90be909..4ff477f 100755
--- a/examples/rbsolv
+++ b/examples/rbsolv
@@ -484,7 +484,9 @@ class Repo_system < Repo_generic
return true
end
puts "reading"
- @handle.add_products("/etc/products.d", Solv::Repo::REPO_NO_INTERNALIZE)
+ if @handle.respond_to? :add_products
+ @handle.add_products("/etc/products.d", Solv::Repo::REPO_NO_INTERNALIZE)
+ end
@handle.add_rpmdb(nil, Solv::Repo::REPO_REUSE_REPODATA)
writecachedrepo(nil)
return true