]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
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 015002ef03b77e971b451ef42fc81188900872a3..58cdc9abc3048ccec3730fc5ae71a38b61dc8cb6 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 fa723a089a669cc1a42c2c7c75e206fa92b3f5e2..af8696146bf9e5d112ae05d5a2695d1cadbf5b6b 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 90be909dd40ef9fde56952e67fb806ff6abd2d2f..4ff477ffdb08b4b5a8b1735f1f6a287ed1489401 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