only call add_products if the method exists
authorMichael Schroeder <mls@suse.de>
Mon, 8 Oct 2012 14:35:13 +0000 (16:35 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 8 Oct 2012 14:35:13 +0000 (16:35 +0200)
examples/p5solv
examples/pysolv
examples/rbsolv

index 015002e..58cdc9a 100755 (executable)
@@ -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;
index fa723a0..af86961 100755 (executable)
@@ -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
index 90be909..4ff477f 100755 (executable)
@@ -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