summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-27 14:58:05 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-27 14:58:05 +0900
commitf458102388250c8a1cbbfa8f18d27baa204c696c (patch)
tree447d75c1ae4449828e094d36a2f97f9b46b455ef /ext
parent8fcc0d8e03716077d1f2c2ca79fc622880a32196 (diff)
downloadlibsolv-f458102388250c8a1cbbfa8f18d27baa204c696c.tar.gz
libsolv-f458102388250c8a1cbbfa8f18d27baa204c696c.tar.bz2
libsolv-f458102388250c8a1cbbfa8f18d27baa204c696c.zip
Imported Upstream version 0.6.23upstream/0.6.23
Change-Id: Idc1e282dc113b7350d8e123283f1a36097b76857 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'ext')
-rw-r--r--ext/repo_appdata.c19
-rw-r--r--ext/repo_autopattern.c7
-rw-r--r--ext/repo_content.c4
-rw-r--r--ext/repo_helix.c3
-rw-r--r--ext/repo_products.c8
-rw-r--r--ext/repo_rpmdb.c3
-rw-r--r--ext/repo_rpmmd.c3
-rw-r--r--ext/repo_susetags.c8
-rw-r--r--ext/testcase.c123
9 files changed, 109 insertions, 69 deletions
diff --git a/ext/repo_appdata.c b/ext/repo_appdata.c
index cbc42e4..2b9844e 100644
--- a/ext/repo_appdata.c
+++ b/ext/repo_appdata.c
@@ -178,12 +178,18 @@ startElement(void *userData, const char *name, const char **atts)
switch(pd->state)
{
case STATE_APPLICATION:
- s = pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->repo));
- pd->handle = s - pool->solvables;
- pd->havesummary = 0;
type = find_attr("type", atts);
if (!type || !*type)
type = "desktop";
+ if (strcmp(type, "desktop") != 0)
+ {
+ /* ignore for now */
+ pd->solvable = 0;
+ break;
+ }
+ s = pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->repo));
+ pd->handle = s - pool->solvables;
+ pd->havesummary = 0;
repodata_set_poolstr(pd->data, pd->handle, SOLVABLE_CATEGORY, type);
break;
case STATE_DESCRIPTION:
@@ -373,6 +379,13 @@ endElement(void *userData, const char *name)
}
pd->skip_depth = 0;
+ if (!s)
+ {
+ pd->state = pd->sbtab[pd->state];
+ pd->docontent = 0;
+ return;
+ }
+
switch (pd->state)
{
case STATE_APPLICATION:
diff --git a/ext/repo_autopattern.c b/ext/repo_autopattern.c
index 4c767e1..f6e1004 100644
--- a/ext/repo_autopattern.c
+++ b/ext/repo_autopattern.c
@@ -396,11 +396,10 @@ repo_add_autopattern(Repo *repo, int flags)
repodata_set_str(data, h, PRODUCT_UPDATES_REPOID, newname);
repodata_add_flexarray(data, s2 - pool->solvables, PRODUCT_UPDATES, h);
}
- else if (!strcmp(pn, "product-endoflife()") && evr)
+ else if (!strcmp(pn, "product-endoflife()"))
{
- time_t t = datestr2timestamp(newname);
- if (t)
- repodata_set_num(data, s2 - pool->solvables, PRODUCT_ENDOFLIFE, t);
+ /* FATE#320699: Support tri-state product-endoflife (tag absent, present but nodate(0), present + date) */
+ repodata_set_num(data, s2 - pool->solvables, PRODUCT_ENDOFLIFE,(evr ? datestr2timestamp(newname) : 0) );
}
else if (!strncmp(pn, "product-url(", 12) && evr && pn[12] && pn[13] && strlen(pn + 12) < 32)
{
diff --git a/ext/repo_content.c b/ext/repo_content.c
index 0cd1293..b12c4cd 100644
--- a/ext/repo_content.c
+++ b/ext/repo_content.c
@@ -404,7 +404,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags)
if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
s->provides = repo_addid_dep(repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
if (code10)
- s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, 0);
+ repo_rewrite_suse_deps(s, 0);
}
/* create new solvable */
s = pool_id2solvable(pool, repo_add_solvable(repo));
@@ -538,7 +538,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags)
if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
s->provides = repo_addid_dep(repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
if (code10)
- s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, 0);
+ repo_rewrite_suse_deps(s, 0);
/* now for every other arch, clone the product except the architecture */
for (i = 0; i < numotherarchs; ++i)
diff --git a/ext/repo_helix.c b/ext/repo_helix.c
index f495be7..6358f72 100644
--- a/ext/repo_helix.c
+++ b/ext/repo_helix.c
@@ -636,8 +636,7 @@ endElement(void *userData, const char *name)
/* ensure self-provides */
if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
s->provides = repo_addid_dep(pd->repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- s->supplements = repo_fix_supplements(pd->repo, s->provides, s->supplements, pd->freshens);
- s->conflicts = repo_fix_conflicts(pd->repo, s->conflicts);
+ repo_rewrite_suse_deps(s, pd->freshens);
pd->freshens = 0;
/* see bugzilla bnc#190163 */
diff --git a/ext/repo_products.c b/ext/repo_products.c
index cb69c49..326f8fd 100644
--- a/ext/repo_products.c
+++ b/ext/repo_products.c
@@ -376,12 +376,8 @@ endElement(void *userData, const char *name)
repodata_set_str(pd->data, pd->handle, SOLVABLE_CPEID, pd->content);
break;
case STATE_ENDOFLIFE:
- if (*pd->content)
- {
- time_t t = datestr2timestamp(pd->content);
- if (t)
- repodata_set_num(pd->data, pd->handle, PRODUCT_ENDOFLIFE, (unsigned long long)t);
- }
+ /* FATE#320699: Support tri-state product-endoflife (tag absent, present but nodate(0), present + date) */
+ repodata_set_num(pd->data, pd->handle, PRODUCT_ENDOFLIFE, (*pd->content ? datestr2timestamp(pd->content) : 0));
break;
default:
break;
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index 9445023..95756c0 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -990,8 +990,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead,
s->supplements = makedeps(pool, repo, rpmhead, TAG_SUPPLEMENTNAME, TAG_SUPPLEMENTVERSION, TAG_SUPPLEMENTFLAGS, 0, 0);
s->enhances = makedeps(pool, repo, rpmhead, TAG_ENHANCENAME, TAG_ENHANCEVERSION, TAG_ENHANCEFLAGS, 0, 0);
- s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, 0);
- s->conflicts = repo_fix_conflicts(repo, s->conflicts);
+ repo_rewrite_suse_deps(s, 0);
if (data && ignq.count)
repodata_set_idarray(data, s - pool->solvables, SOLVABLE_PREREQ_IGNOREINST, &ignq);
diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c
index 729f4f7..8854bca 100644
--- a/ext/repo_rpmmd.c
+++ b/ext/repo_rpmmd.c
@@ -1119,8 +1119,7 @@ endElement(void *userData, const char *name)
s->evr = ID_EMPTY; /* some patterns have this */
if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
s->provides = repo_addid_dep(repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, pd->freshens);
- s->conflicts = repo_fix_conflicts(repo, s->conflicts);
+ repo_rewrite_suse_deps(s, pd->freshens);
pd->freshens = 0;
pd->kind = 0;
pd->solvable = 0;
diff --git a/ext/repo_susetags.c b/ext/repo_susetags.c
index a96ba97..be73a7f 100644
--- a/ext/repo_susetags.c
+++ b/ext/repo_susetags.c
@@ -388,12 +388,8 @@ finish_solvable(struct parsedata *pd, Solvable *s, Offset freshens)
/* A self provide, except for source packages. This is harmless
to do twice (in case we see the same package twice). */
if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- s->provides = repo_addid_dep(pd->repo, s->provides,
- pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- /* XXX This uses repo_addid_dep internally, so should also be
- harmless to do twice. */
- s->supplements = repo_fix_supplements(pd->repo, s->provides, s->supplements, freshens);
- s->conflicts = repo_fix_conflicts(pd->repo, s->conflicts);
+ s->provides = repo_addid_dep(pd->repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ repo_rewrite_suse_deps(s, freshens);
if (pd->ndirs)
commit_diskusage(pd, handle);
}
diff --git a/ext/testcase.c b/ext/testcase.c
index 6e2b574..52c139f 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -1264,8 +1264,7 @@ finish_v2_solvable(Pool *pool, Repodata *data, Solvable *s, char *filelist, int
repodata_add_dirstr(data, s - pool->solvables, SOLVABLE_FILELIST, did, p);
}
}
- s->supplements = repo_fix_supplements(s->repo, s->provides, s->supplements, 0);
- s->conflicts = repo_fix_conflicts(s->repo, s->conflicts);
+ repo_rewrite_suse_deps(s, 0);
}
/* stripped down version of susetags parser used for testcases */
@@ -1737,6 +1736,33 @@ testcase_reason2str(Id reason)
return "?";
}
+static struct rclass2str {
+ Id rclass;
+ const char *str;
+} rclass2str[] = {
+ { SOLVER_RULE_PKG, "pkg" },
+ { SOLVER_RULE_UPDATE, "update" },
+ { SOLVER_RULE_FEATURE, "feature" },
+ { SOLVER_RULE_JOB, "job" },
+ { SOLVER_RULE_DISTUPGRADE, "distupgrade" },
+ { SOLVER_RULE_INFARCH, "infarch" },
+ { SOLVER_RULE_CHOICE, "choice" },
+ { SOLVER_RULE_LEARNT, "learnt" },
+ { SOLVER_RULE_BEST, "best" },
+ { SOLVER_RULE_YUMOBS, "yumobs" },
+ { 0, 0 }
+};
+
+static const char *
+testcase_rclass2str(Id rclass)
+{
+ int i;
+ for (i = 0; rclass2str[i].str; i++)
+ if (rclass == rclass2str[i].rclass)
+ return rclass2str[i].str;
+ return "unknown";
+}
+
static int
dump_genid(Pool *pool, Strqueue *sq, Id id, int cnt)
{
@@ -1981,44 +2007,8 @@ testcase_solverresult(Solver *solv, int resultflags)
queue_init(&q);
for (rid = 1; (rclass = solver_ruleclass(solv, rid)) != SOLVER_RULE_UNKNOWN; rid++)
{
- char *prefix;
- switch (rclass)
- {
- case SOLVER_RULE_PKG:
- prefix = "pkg ";
- break;
- case SOLVER_RULE_UPDATE:
- prefix = "update ";
- break;
- case SOLVER_RULE_FEATURE:
- prefix = "feature ";
- break;
- case SOLVER_RULE_JOB:
- prefix = "job ";
- break;
- case SOLVER_RULE_DISTUPGRADE:
- prefix = "distupgrade ";
- break;
- case SOLVER_RULE_INFARCH:
- prefix = "infarch ";
- break;
- case SOLVER_RULE_CHOICE:
- prefix = "choice ";
- break;
- case SOLVER_RULE_LEARNT:
- prefix = "learnt ";
- break;
- case SOLVER_RULE_BEST:
- prefix = "best ";
- break;
- case SOLVER_RULE_YUMOBS:
- prefix = "yumobs ";
- break;
- default:
- prefix = "unknown ";
- break;
- }
- prefix = solv_dupjoin("rule ", prefix, testcase_ruleid(solv, rid));
+ char *prefix = solv_dupjoin("rule ", testcase_rclass2str(rclass), " ");
+ prefix = solv_dupappend(prefix, testcase_ruleid(solv, rid), 0);
solver_ruleliterals(solv, rid, &q);
if (rclass == SOLVER_RULE_FEATURE && q.count == 1 && q.elements[0] == -SYSTEMSOLVABLE)
continue;
@@ -2099,8 +2089,8 @@ testcase_solverresult(Solver *solv, int resultflags)
}
-int
-testcase_write(Solver *solv, const char *dir, int resultflags, const char *testcasename, const char *resultname)
+static int
+testcase_write_mangled(Solver *solv, const char *dir, int resultflags, const char *testcasename, const char *resultname)
{
Pool *pool = solv->pool;
Repo *repo;
@@ -2132,6 +2122,9 @@ testcase_write(Solver *solv, const char *dir, int resultflags, const char *testc
else
sprintf(priobuf, "%d", repo->priority);
out = pool_tmpjoin(pool, name, ".repo", ".gz");
+ for (i = 0; out[i]; i++)
+ if (out[i] == '/')
+ out[i] = '_';
cmd = pool_tmpjoin(pool, "repo ", name, " ");
cmd = pool_tmpappend(pool, cmd, priobuf, " ");
cmd = pool_tmpappend(pool, cmd, "testtags ", out);
@@ -2320,6 +2313,52 @@ testcase_write(Solver *solv, const char *dir, int resultflags, const char *testc
return 1;
}
+int
+testcase_write(Solver *solv, const char *dir, int resultflags, const char *testcasename, const char *resultname)
+{
+ Pool *pool = solv->pool;
+ int i, r, repoid;
+ int mangle = 1;
+ const char **orignames;
+
+ /* mangle repo names so that there are no conflicts */
+ orignames = solv_calloc(pool->nrepos, sizeof(char *));
+ for (repoid = 1; repoid < pool->nrepos; repoid++)
+ {
+ Repo *repo = pool_id2repo(pool, repoid);
+ char *buf = solv_malloc((repo->name ? strlen(repo->name) : 0) + 40);
+ char *mp;
+ orignames[i] = repo->name;
+ if (!repo->name || !repo->name[0])
+ sprintf(buf, "#%d", repoid);
+ else
+ strcpy(buf, repo->name);
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == ' ' || buf[i] == '\t' || buf[i] == '/')
+ buf[i] = '_';
+ mp = buf + strlen(buf);
+ for (;;)
+ {
+ for (i = 1; i < repoid; i++)
+ if (!strcmp(buf, pool_id2repo(pool, i)->name))
+ break;
+ if (i == repoid)
+ break;
+ sprintf(mp, "_%d", mangle++);
+ }
+ repo->name = buf;
+ }
+ r = testcase_write_mangled(solv, dir, resultflags, testcasename, resultname);
+ for (repoid = 1; repoid < pool->nrepos; repoid++)
+ {
+ Repo *repo = pool_id2repo(pool, repoid);
+ solv_free((void *)repo->name);
+ repo->name = orignames[i];
+ }
+ solv_free(orignames);
+ return r;
+}
+
static char *
read_inline_file(FILE *fp, char **bufp, char **bufpp, int *buflp)
{