From: Michael Schroeder Date: Mon, 8 Oct 2012 14:35:13 +0000 (+0200) Subject: only call add_products if the method exists X-Git-Tag: BASE-SuSE-Code-12_3-Branch~228 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8;p=thirdparty%2Flibsolv.git only call add_products if the method exists --- diff --git a/examples/p5solv b/examples/p5solv index 015002ef..58cdc9ab 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 fa723a08..af869614 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 90be909d..4ff477ff 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