diff options
author | Michael Schroeder <mls@suse.de> | 2009-09-22 18:49:30 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-09-22 18:49:30 +0200 |
commit | 2809498f0ceebc98709443afcbfdd799d5bb35b1 (patch) | |
tree | 40455aefe0d90f640456fed149545a9099e349e9 /src/solvable.c | |
parent | a415136ab9806fd4bb83743ba974c6288b3a1a1a (diff) | |
download | libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.tar.gz libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.tar.bz2 libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.zip |
- get missing translations from other solvables
- fix solvable_lookup_str_poollang bug
- add support for REPOKEY_TYPE_BINARY
- do not add provides when extending susetags solvables
- fix susetags language handling in demo application
Diffstat (limited to 'src/solvable.c')
-rw-r--r-- | src/solvable.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/src/solvable.c b/src/solvable.c index dfe8ce1..26caf77 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -74,6 +74,49 @@ solvable_lookup_str(Solvable *s, Id keyname) } const char * +solvable_lookup_str_base(Solvable *s, Id keyname, Id basekeyname) +{ + Pool *pool; + const char *str, *basestr; + Id p, pp; + Solvable *s2; + int pass; + + if (!s->repo) + return 0; + pool = s->repo->pool; + str = solvable_lookup_str(s, keyname); + if (str || keyname == basekeyname) + return str; + basestr = solvable_lookup_str(s, basekeyname); + if (!basestr) + return 0; + /* search for a solvable with same name and same base that has the + * translation */ + if (!pool->whatprovides) + return 0; + /* we do this in two passes, first same vendor, then all other vendors */ + for (pass = 0; pass < 2; pass++) + { + FOR_PROVIDES(p, pp, s->name) + { + s2 = pool->solvables + p; + if (s2->name != s->name) + continue; + if ((s->vendor == s2->vendor) != (pass == 0)) + continue; + str = solvable_lookup_str(s2, basekeyname); + if (!str || strcmp(str, basestr)) + continue; + str = solvable_lookup_str(s2, keyname); + if (str) + return str; + } + } + return 0; +} + +const char * solvable_lookup_str_poollang(Solvable *s, Id keyname) { Pool *pool; @@ -101,8 +144,8 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) if (i >= pool->languagecacheother) { pool->languagecache = sat_realloc2(pool->languagecache, pool->languagecacheother + 1, cols * sizeof(Id)); - pool->languagecacheother++; row = pool->languagecache + cols * (ID_NUM_INTERNAL + pool->languagecacheother++); + *row = keyname; } } else @@ -121,7 +164,7 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) *row = str2id(pool, p, 1); sat_free(p); } - str = solvable_lookup_str(s, *row); + str = solvable_lookup_str_base(s, *row, keyname); if (str) return str; } @@ -135,7 +178,7 @@ solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang) { const char *str; Id id = pool_id2langid(s->repo->pool, keyname, lang, 0); - if (id && (str = solvable_lookup_str(s, id)) != 0) + if (id && (str = solvable_lookup_str_base(s, id, keyname)) != 0) return str; } return solvable_lookup_str(s, keyname); |