summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Andres <ma@suse.de>2013-11-05 17:07:23 +0100
committerMichael Andres <ma@suse.de>2013-11-05 17:07:23 +0100
commit314831f967698ad008fc457254d09b4b8c494570 (patch)
treee898771a3ab3939ec8462ab3e7f6fa2265357021
parent722ff74d89f78ca88eed65bf9799c6ae6b32b5af (diff)
downloadlibzypp-bindings-314831f967698ad008fc457254d09b4b8c494570.tar.gz
libzypp-bindings-314831f967698ad008fc457254d09b4b8c494570.tar.bz2
libzypp-bindings-314831f967698ad008fc457254d09b4b8c494570.zip
Fix no attribute access via PoolItem::resolvable
-rwxr-xr-xexamples/ruby/parse1.rb56
-rw-r--r--swig/ResTraits.i9
2 files changed, 33 insertions, 32 deletions
diff --git a/examples/ruby/parse1.rb b/examples/ruby/parse1.rb
index 90500c9..7d3a776 100755
--- a/examples/ruby/parse1.rb
+++ b/examples/ruby/parse1.rb
@@ -3,51 +3,43 @@
require 'zypp'
include Zypp
-tmp_cache_path = TmpDir.new()
-tmp_raw_cache_path = TmpDir.new()
-tmp_known_repos_path = TmpDir.new()
-
-opts = RepoManagerOptions.new()
-opts.repoCachePath = tmp_cache_path.path()
-opts.repoRawCachePath = tmp_raw_cache_path.path()
-opts.knownReposPath = tmp_known_repos_path.path()
-
+tmp_dir = TmpDir.new()
+opts = RepoManagerOptions.new(tmp_dir.path())
repo_manager = RepoManager.new(opts)
repo_info = RepoInfo.new()
-
-repo_info.set_alias("factorytest")
-repo_info.set_name("Test Repo for Factory.")
-repo_info.set_enabled(true)
-repo_info.set_autorefresh(false)
-# repo_info.add_base_url("ftp://dist.suse.de/install/stable-x86/")
-# repo_info.add_base_url("http://software.opensuse.org/download/home:/Arvin42/openSUSE_Factory/")
-repo_info.add_base_url("file:///suse/aschnell/tmp")
-
-repo_manager.add_repository(repo_info)
-
-z = ZYppFactory::instance.get_zypp
-pool = z.pool()
-
-repos = repo_manager.known_repositories()
+repo_info.setAlias("factorytest")
+repo_info.setName("Test Repo for Factory.")
+repo_info.setEnabled(true)
+repo_info.setAutorefresh(false)
+url = Url.new("http://download.opensuse.org/factory-tested/repo/oss/")
+repo_info.addBaseUrl(url)
+repo_manager.addRepository(repo_info)
+
+
+KeyRing.setDefaultAccept( KeyRing::ACCEPT_UNKNOWNKEY |
+ KeyRing::ACCEPT_VERIFICATION_FAILED | KeyRing::ACCEPT_UNSIGNED_FILE |
+ KeyRing::TRUST_KEY_TEMPORARILY)
+repos = repo_manager.knownRepositories()
repos.each do | repo |
- repo_manager.refresh_metadata(repo)
- repo_manager.build_cache(repo)
- rep = repo_manager.create_from_cache(repo)
- store = rep.resolvables()
- z.add_resolvables(store)
+ repo_manager.refreshMetadata(repo)
+ repo_manager.buildCache(repo)
+ repo_manager.loadFromCache(repo)
end
# puts pool.class
+z = ZYppFactory::instance.getZYpp
+pool = z.pool()
pool.each do | p |
- # puts p.class
+ puts p.class
r = p.resolvable
- # puts r.class
+ puts r.class
puts "#{r.kind} #{r.name} #{r.edition.to_s} #{r.arch.to_s}"
+
puts " Summary: #{r.summary}"
- puts " Size: #{r.size}"
+ puts " DownloadSize: #{r.downloadSize}"
puts " Vendor: #{r.vendor}"
puts " Buildtime: #{r.buildtime}"
diff --git a/swig/ResTraits.i b/swig/ResTraits.i
index 6658bdb..bdd4f2e 100644
--- a/swig/ResTraits.i
+++ b/swig/ResTraits.i
@@ -22,6 +22,15 @@ namespace zypp
}
+namespace zypp::ResObject::TraitsType
+{
+ typedef ::zypp::intrusive_ptr<const zypp::ResObject> constPtrType;
+}
+namespace zypp::Resolvable::TraitsType
+{
+ typedef ::zypp::intrusive_ptr<const zypp::Resolvable> constPtrType;
+}
+
%template(ResTraitsResolvable) zypp::ResTraits<zypp::Resolvable>;
%template(ResTraitsResObject) zypp::ResTraits<zypp::ResObject>;