From: Michael Schroeder Date: Fri, 2 Nov 2012 14:27:53 +0000 (+0100) Subject: make pool.setarch() do the right thing X-Git-Tag: BASE-SuSE-Code-12_3-Branch~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f2f1fe6e2f6a27c45b01c2e53970ec25b32e93;p=thirdparty%2Flibsolv.git make pool.setarch() do the right thing --- diff --git a/bindings/solv.i b/bindings/solv.i index 1fbe23ac..f7d6e7c4 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -334,6 +334,7 @@ typedef VALUE AppObjectPtr; #include #include #include +#include #include #include @@ -1038,7 +1039,15 @@ typedef struct { Id id2langid(Id id, const char *lang, bool create=1) { return pool_id2langid($self, id, lang, create); } - void setarch(const char *arch) { + void setarch(const char *arch = 0) { + struct utsname un; + if (!arch) { + if (uname(&un)) { + perror("uname"); + return; + } + arch = un.machine; + } pool_setarch($self, arch); } Repo *add_repo(const char *name) { diff --git a/examples/p5solv b/examples/p5solv index 6cbe5dd2..ebade1d1 100755 --- a/examples/p5solv +++ b/examples/p5solv @@ -539,7 +539,7 @@ for my $reposdir (@reposdirs) { } my $pool = solv::Pool->new(); -$pool->setarch((POSIX::uname())[4]); +$pool->setarch(); $pool->set_loadcallback(\&load_stub); my $sysrepo = Repo::system->new('@System', 'system'); diff --git a/examples/pysolv b/examples/pysolv index d3e7d818..75da2924 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -626,7 +626,7 @@ for reposdir in reposdirs: repos.append(repo) pool = solv.Pool() -pool.setarch(os.uname()[4]) +pool.setarch() pool.set_loadcallback(load_stub) # now load all enabled repos into the pool diff --git a/examples/rbsolv b/examples/rbsolv index 8ac3eca3..eb773955 100755 --- a/examples/rbsolv +++ b/examples/rbsolv @@ -525,9 +525,7 @@ for reposdir in reposdirs do end pool = Solv::Pool.new() -# require 'sys/uname' ; sysarch = Sys::Uname.machine -sysarch = `uname -p`.strip -pool.setarch(sysarch) +pool.setarch() pool.set_loadcallback { |repodata| repo = repodata.repo.appdata