X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsolvable.c;h=b3e73a62f2b51ed8e8d85e154c8468d1d5877f15;hb=ce7051b1905dbe50d8983d4aba43176277ae5984;hp=bfe25ceb460fd0747ccd4a1fa60efbd13d14244d;hpb=75941c2115f0e8ec9696de2a22198a1969aaef77;p=platform%2Fupstream%2Flibsolv.git diff --git a/src/solvable.c b/src/solvable.c index bfe25ce..b3e73a6 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -23,6 +23,7 @@ #include "policy.h" #include "poolvendor.h" #include "chksum.h" +#include "linkedpkg.h" const char * pool_solvable2str(Pool *pool, Solvable *s) @@ -50,6 +51,7 @@ pool_solvable2str(Pool *pool, Solvable *s) { p[nl++] = '-'; strncpy(p + nl, e, el); + p[nl + el] = 0; } if (al) { @@ -134,7 +136,7 @@ solvable_lookup_str_base(Solvable *s, Id keyname, Id basekeyname, int usebase) { Pool *pool; const char *str, *basestr; - Id p, pp; + Id p, pp, name; Solvable *s2; int pass; @@ -151,13 +153,14 @@ solvable_lookup_str_base(Solvable *s, Id keyname, Id basekeyname, int usebase) * translation */ if (!pool->whatprovides) return usebase ? basestr : 0; + name = s->name; /* 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) + FOR_PROVIDES(p, pp, name) { s2 = pool->solvables + p; - if (s2->name != s->name) + if (s2->name != name) continue; if ((s->vendor == s2->vendor) != (pass == 0)) continue; @@ -168,6 +171,20 @@ solvable_lookup_str_base(Solvable *s, Id keyname, Id basekeyname, int usebase) if (str) return str; } +#ifdef ENABLE_LINKED_PKGS + /* autopattern/product translation magic */ + if (pass) + { + const char *n = pool_id2str(pool, name); + if (*n == 'p') + { + if (!strncmp("pattern:", n, 8) && (name = find_autopattern_name(pool, s)) != 0) + pass = -1; + if (!strncmp("product:", n, 8) && (name = find_autoproduct_name(pool, s)) != 0) + pass = -1; + } + } +#endif } return usebase ? basestr : 0; } @@ -385,7 +402,7 @@ solvable_lookup_sourcepkg(Solvable *s) str = pool_tmpappend(pool, str, ".", pool_id2str(pool, archid)); return pool_tmpappend(pool, str, ".rpm", 0); } - else + else return name; /* FIXME */ } @@ -396,20 +413,20 @@ static inline Id dep2name(Pool *pool, Id dep) { while (ISRELDEP(dep)) { - Reldep *rd = rd = GETRELDEP(pool, dep); + Reldep *rd = GETRELDEP(pool, dep); dep = rd->name; } return dep; } -static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id con) +static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id con) { Id p, pp; - Solvable *sn = pool->solvables + n; + Solvable *sn = pool->solvables + n; FOR_PROVIDES(p, pp, sn->name) - { - Solvable *s = pool->solvables + p; + { + Solvable *s = pool->solvables + p; if (s->name != sn->name || s->arch != sn->arch) continue; if (!MAPTST(installed, p)) @@ -417,7 +434,7 @@ static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id if (pool_match_nevr(pool, pool->solvables + p, con)) continue; return 1; /* found installed package that doesn't conflict */ - } + } return 0; } @@ -609,7 +626,7 @@ solvable_trivial_installable_repo(Solvable *s, Repo *installed, Map *multiversio static int pool_illegal_vendorchange(Pool *pool, Solvable *s1, Solvable *s2) { - Id v1, v2; + Id v1, v2; Id vendormask1, vendormask2; if (pool->custom_vendorcheck) @@ -617,7 +634,7 @@ pool_illegal_vendorchange(Pool *pool, Solvable *s1, Solvable *s2) /* treat a missing vendor as empty string */ v1 = s1->vendor ? s1->vendor : ID_EMPTY; v2 = s2->vendor ? s2->vendor : ID_EMPTY; - if (v1 == v2) + if (v1 == v2) return 0; vendormask1 = pool_vendor2mask(pool, v1); if (!vendormask1) @@ -688,7 +705,7 @@ solvable_is_irrelevant_patch(Solvable *s, Map *installedmap) /* * Create maps containing the state of each solvable. Input is a "installed" queue, * it contains all solvable ids that are considered to be installed. - * + * * The created maps can be used for solvable_trivial_installable_map(), * pool_calc_duchanges(), pool_calc_installsizechange(). * @@ -728,19 +745,27 @@ pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *con /* Tests if two solvables have identical content. Currently * both solvables need to come from the same pool */ + +#warning HOTFIX [Bug 881493] New: zypper dup does always update sles-release +inline int isProduct(const char *name) +{ return name && strncmp(name, "product:", 8) == 0; } + int solvable_identical(Solvable *s1, Solvable *s2) { unsigned int bt1, bt2; Id rq1, rq2; Id *reqp; - if (s1->name != s2->name) return 0; if (s1->arch != s2->arch) return 0; if (s1->evr != s2->evr) return 0; + + if (isProduct(pool_id2str(s1->repo->pool, s1->name))) // HOTFIX [Bug 881493] end check for products here + return 1; + /* map missing vendor to empty string */ if ((s1->vendor ? s1->vendor : 1) != (s2->vendor ? s2->vendor : 1)) return 0;