Author: mlschroe Date: Mon Sep 22 12:17:28 2008 New Revision: 11115 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11115&view=rev Log: - make solvable creation easier to understand Modified: trunk/sat-solver/tools/repo_content.c Modified: trunk/sat-solver/tools/repo_content.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo_content.c?rev=11115&r1=11114&r2=11115&view=diff ============================================================================== --- trunk/sat-solver/tools/repo_content.c (original) +++ trunk/sat-solver/tools/repo_content.c Mon Sep 22 12:17:28 2008 @@ -202,7 +202,7 @@ Pool *pool = repo->pool; char *line, *linep; int aline; - Solvable *s, *firsts = 0; + Solvable *s; struct parsedata pd; Repodata *data; Id handle = 0; @@ -281,20 +281,27 @@ if ((code10 && istag ("PRODUCT")) || (code11 && istag ("NAME"))) { - /* Finish old solvable, but only if it wasn't created - on demand without seeing a PRODUCT entry. */ - if (!firsts) + if (s && !s->name) { - if (s && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC) + /* this solvable was created without seeing a + PRODUCT entry, just set the name and continue */ + s->name = str2id(pool, join(&pd, "product", ":", value), 1); + continue; + } + if (s) + { + /* finish old solvable */ + if (!s->arch) + s->arch = ARCH_NOARCH; + if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC) s->provides = repo_addid_dep(repo, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0); - if (s && code10) + if (code10) s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, 0); - /* first product. */ - s = pool_id2solvable(pool, repo_add_solvable(repo)); - repodata_extend(data, s - pool->solvables); - handle = repodata_get_handle(data, s - pool->solvables - repo->start); } - firsts = 0; + /* create new solvable */ + s = pool_id2solvable(pool, repo_add_solvable(repo)); + repodata_extend(data, s - pool->solvables); + handle = repodata_get_handle(data, s - pool->solvables - repo->start); s->name = str2id(pool, join(&pd, "product", ":", value), 1); continue; } @@ -303,7 +310,7 @@ from here on. */ if (!s) { - firsts = s = pool_id2solvable(pool, repo_add_solvable(repo)); + s = pool_id2solvable(pool, repo_add_solvable(repo)); repodata_extend(data, s - pool->solvables); handle = repodata_get_handle(data, s - pool->solvables - repo->start); } @@ -398,7 +405,7 @@ fprintf (stderr, "malformed line: %s\n", line); } - if (!s) + if (!s || !s->name) { fprintf(stderr, "No product solvable created !\n"); exit(1); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org