2 * Copyright (c) 2012, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
19 #include "poolvendor.h"
21 #include "repo_solv.h"
23 #include "solverdebug.h"
26 #include "solv_xfopen.h"
29 #include "tools_util.h"
31 static struct job2str {
35 { SOLVER_NOOP, "noop" },
36 { SOLVER_INSTALL, "install" },
37 { SOLVER_ERASE, "erase" },
38 { SOLVER_UPDATE, "update" },
39 { SOLVER_WEAKENDEPS, "weakendeps" },
40 { SOLVER_NOOBSOLETES, "noobsoletes" },
41 { SOLVER_LOCK, "lock" },
42 { SOLVER_DISTUPGRADE, "distupgrade" },
43 { SOLVER_VERIFY, "verify" },
44 { SOLVER_DROP_ORPHANED, "droporphaned" },
45 { SOLVER_USERINSTALLED, "userinstalled" },
49 static struct jobflags2str {
53 { SOLVER_WEAK, "weak" },
54 { SOLVER_ESSENTIAL, "essential" },
55 { SOLVER_CLEANDEPS, "cleandeps" },
56 { SOLVER_SETEV, "setev" },
57 { SOLVER_SETEVR, "setevr" },
58 { SOLVER_SETARCH, "setarch" },
59 { SOLVER_SETVENDOR, "setvendor" },
60 { SOLVER_SETREPO, "setrepo" },
61 { SOLVER_NOAUTOSET, "noautoset" },
65 static struct resultflags2str {
68 } resultflags2str[] = {
69 { TESTCASE_RESULT_TRANSACTION, "transaction" },
70 { TESTCASE_RESULT_PROBLEMS, "problems" },
71 { TESTCASE_RESULT_ORPHANED, "orphaned" },
72 { TESTCASE_RESULT_RECOMMENDED, "recommended" },
73 { TESTCASE_RESULT_UNNEEDED, "unneeded" },
77 static struct solverflags2str {
81 } solverflags2str[] = {
82 { SOLVER_FLAG_ALLOW_DOWNGRADE, "allowdowngrade", 0 },
83 { SOLVER_FLAG_ALLOW_NAMECHANGE, "allownamechange", 1 },
84 { SOLVER_FLAG_ALLOW_ARCHCHANGE, "allowarchchange", 0 },
85 { SOLVER_FLAG_ALLOW_VENDORCHANGE, "allowvendorchange", 0 },
86 { SOLVER_FLAG_ALLOW_UNINSTALL, "allowuninstall", 0 },
87 { SOLVER_FLAG_NO_UPDATEPROVIDE, "noupdateprovide", 0 },
88 { SOLVER_FLAG_SPLITPROVIDES, "splitprovides", 0 },
89 { SOLVER_FLAG_IGNORE_RECOMMENDED, "ignorerecommended", 0 },
90 { SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, "addalreadyrecommended", 0 },
91 { SOLVER_FLAG_NO_INFARCHCHECK, "noinfarchcheck", 0 },
92 { SOLVER_FLAG_KEEP_EXPLICIT_OBSOLETES, "keepexplicitobsoletes", 0 },
96 static struct poolflags2str {
100 } poolflags2str[] = {
101 { POOL_FLAG_PROMOTEEPOCH, "promoteepoch", 0 },
102 { POOL_FLAG_FORBIDSELFCONFLICTS, "forbidselfconflicts", 0 },
103 { POOL_FLAG_OBSOLETEUSESPROVIDES, "obsoleteusesprovides", 0 },
104 { POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES, "implicitobsoleteusesprovides", 0 },
105 { POOL_FLAG_OBSOLETEUSESCOLORS, "obsoleteusescolors", 0 },
106 { POOL_FLAG_NOINSTALLEDOBSOLETES, "noinstalledobsoletes", 0 },
107 { POOL_FLAG_HAVEDISTEPOCH, "havedistepoch", 0 },
112 typedef struct strqueue {
117 #define STRQUEUE_BLOCK 63
120 strqueue_init(Strqueue *q)
127 strqueue_free(Strqueue *q)
130 for (i = 0; i < q->nstr; i++)
131 solv_free(q->str[i]);
132 q->str = solv_free(q->str);
137 strqueue_push(Strqueue *q, const char *s)
139 q->str = solv_extend(q->str, q->nstr, 1, sizeof(*q->str), STRQUEUE_BLOCK);
140 q->str[q->nstr++] = solv_strdup(s);
144 strqueue_pushjoin(Strqueue *q, const char *s1, const char *s2, const char *s3)
146 q->str = solv_extend(q->str, q->nstr, 1, sizeof(*q->str), STRQUEUE_BLOCK);
147 q->str[q->nstr++] = solv_dupjoin(s1, s2, s3);
151 strqueue_sort_cmp(const void *ap, const void *bp, void *dp)
153 const char *a = *(const char **)ap;
154 const char *b = *(const char **)bp;
155 return strcmp(a ? a : "", b ? b : "");
159 strqueue_sort(Strqueue *q)
162 solv_sort(q->str, q->nstr, sizeof(*q->str), strqueue_sort_cmp, 0);
166 strqueue_sort_u(Strqueue *q)
170 for (i = j = 0; i < q->nstr; i++)
171 if (!j || strqueue_sort_cmp(q->str + i, q->str + j - 1, 0) != 0)
172 q->str[j++] = q->str[i];
177 strqueue_join(Strqueue *q)
181 for (i = 0; i < q->nstr; i++)
183 l += strlen(q->str[i]) + 1;
184 l++; /* trailing \0 */
187 for (i = 0; i < q->nstr; i++)
190 strcpy(rp, q->str[i]);
199 strqueue_split(Strqueue *q, const char *s)
204 while ((p = strchr(s, '\n')) != 0)
206 q->str = solv_extend(q->str, q->nstr, 1, sizeof(*q->str), STRQUEUE_BLOCK);
207 q->str[q->nstr] = solv_malloc(p - s + 1);
209 memcpy(q->str[q->nstr], s, p - s);
210 q->str[q->nstr][p - s] = 0;
219 strqueue_diff(Strqueue *sq1, Strqueue *sq2, Strqueue *osq)
222 while (i < sq1->nstr && j < sq2->nstr)
224 int r = strqueue_sort_cmp(sq1->str + i, sq2->str + j, 0);
228 strqueue_pushjoin(osq, "-", sq1->str[i++], 0);
230 strqueue_pushjoin(osq, "+", sq2->str[j++], 0);
232 while (i < sq1->nstr)
233 strqueue_pushjoin(osq, "-", sq1->str[i++], 0);
234 while (j < sq2->nstr)
235 strqueue_pushjoin(osq, "+", sq2->str[j++], 0);
239 pool_isknownarch(Pool *pool, Id id)
241 if (!id || id == ID_EMPTY)
243 if (id == ARCH_SRC || id == ARCH_NOSRC || id == ARCH_NOARCH)
245 if (!pool->id2arch || (id > pool->lastarch || !pool->id2arch[id]))
251 testcase_str2dep(Pool *pool, char *s)
257 if ((n = strchr(s, '|')) != 0)
259 id = testcase_str2dep(pool, n + 1);
261 id = pool_rel2id(pool, testcase_str2dep(pool, s), id, REL_OR, 1);
265 while (*s == ' ' || *s == '\t')
268 while (*s && *s != ' ' && *s != '\t' && *s != '<' && *s != '=' && *s != '>')
272 while (*s && *s != ')')
278 if ((a = strchr(n, '.')) != 0 && a + 1 < s && s[-1] != ')')
280 Id archid = pool_strn2id(pool, a + 1, s - (a + 1), 0);
281 if (pool_isknownarch(pool, archid))
283 id = pool_strn2id(pool, n, a - n, 1);
284 id = pool_rel2id(pool, id, archid, REL_ARCH, 1);
287 id = pool_strn2id(pool, n, s - n, 1);
290 id = pool_strn2id(pool, n, s - n, 1);
293 while (*s == ' ' || *s == '\t')
309 while (*s == ' ' || *s == '\t')
312 while (*s && *s != ' ' && *s != '\t')
314 return pool_rel2id(pool, id, pool_strn2id(pool, n, s - n, 1), flags, 1);
318 testcase_repoid2str(Pool *pool, Id repoid)
320 Repo *repo = pool_id2repo(pool, repoid);
323 char *r = pool_tmpjoin(pool, repo->name, 0, 0);
325 for (rp = r; *rp; rp++)
326 if (*rp == ' ' || *rp == '\t')
333 sprintf(buf, "#%d", repoid);
334 return pool_tmpjoin(pool, buf, 0, 0);
339 testcase_solvid2str(Pool *pool, Id p)
341 Solvable *s = pool->solvables + p;
342 const char *n, *e, *a;
345 if (p == SYSTEMSOLVABLE)
347 n = pool_id2str(pool, s->name);
348 e = pool_id2str(pool, s->evr);
349 a = pool_id2str(pool, s->arch);
350 str = pool_alloctmpspace(pool, strlen(n) + strlen(e) + strlen(a) + 3);
351 sprintf(str, "%s-%s.%s", n, e, a);
353 return pool_tmpappend(pool, str, "@", 0);
357 char *str2 = pool_tmpappend(pool, str, "@", s->repo->name);
359 if (str2[l] == ' ' || str2[l] == '\t')
363 sprintf(buf, "@#%d", s->repo->repoid);
364 return pool_tmpappend(pool, str, buf, 0);
368 testcase_str2repo(Pool *pool, const char *str)
372 if (str[0] == '#' && (str[1] >= '0' && str[1] <= '9'))
376 for (j = 1; str[j] >= '0' && str[j] <= '9'; j++)
377 repoid = repoid * 10 + (str[j] - '0');
378 if (!str[j] && repoid > 0 && repoid < pool->nrepos)
379 repo = pool_id2repo(pool, repoid);
383 FOR_REPOS(repoid, repo)
388 l = strlen(repo->name);
389 for (i = 0; i < l; i++)
391 int c = repo->name[i];
392 if (c == ' ' || c == '\t')
397 if (i == l && !str[l])
400 if (repoid >= pool->nrepos)
407 testcase_str2solvid(Pool *pool, const char *str)
409 int i, l = strlen(str);
416 if (*str == '@' && !strcmp(str, "@SYSTEM"))
417 return SYSTEMSOLVABLE;
419 for (i = l - 1; i >= 0; i--)
420 if (str[i] == '@' && (repo = testcase_str2repo(pool, str + i + 1)) != 0)
425 /* now find the arch (if present) */
427 for (i = repostart - 1; i > 0; i--)
430 arch = pool_strn2id(pool, str + i + 1, repostart - (i + 1), 0);
435 /* now find the name */
436 for (i = repostart - 1; i > 0; i--)
440 Id nid, evrid, p, pp;
441 nid = pool_strn2id(pool, str, i, 0);
444 evrid = pool_strn2id(pool, str + i + 1, repostart - (i + 1), 0);
447 FOR_PROVIDES(p, pp, nid)
449 Solvable *s = pool->solvables + p;
450 if (s->name != nid || s->evr != evrid)
452 if (repo && s->repo != repo)
454 if (arch && s->arch != arch)
464 testcase_job2str(Pool *pool, Id how, Id what)
471 Id select = how & SOLVER_SELECTMASK;
473 for (i = 0; job2str[i].str; i++)
474 if ((how & SOLVER_JOBMASK) == job2str[i].job)
476 jobstr = job2str[i].str ? job2str[i].str : "unknown";
477 if (select == SOLVER_SOLVABLE)
480 pkgstr = testcase_solvid2str(pool, what);
482 else if (select == SOLVER_SOLVABLE_NAME)
485 pkgstr = pool_dep2str(pool, what);
487 else if (select == SOLVER_SOLVABLE_PROVIDES)
489 selstr = " provides ";
490 pkgstr = pool_dep2str(pool, what);
492 else if (select == SOLVER_SOLVABLE_ONE_OF)
497 while ((p = pool->whatprovidesdata[what++]) != 0)
499 const char *s = testcase_solvid2str(pool, p);
502 pkgstr = pool_tmpappend(pool, pkgstr, " ", s);
503 pool_freetmpspace(pool, s);
511 else if (select == SOLVER_SOLVABLE_REPO)
513 Repo *repo = pool_id2repo(pool, what);
518 sprintf(buf, "#%d", repo->repoid);
519 pkgstr = pool_tmpjoin(pool, buf, 0, 0);
522 pkgstr = pool_tmpjoin(pool, repo->name, 0, 0);
524 else if (select == SOLVER_SOLVABLE_ALL)
531 selstr = " unknown ";
534 ret = pool_tmpjoin(pool, jobstr, selstr, pkgstr);
536 ret = pool_tmpappend(pool, ret, " ", 0);
537 for (i = 0; jobflags2str[i].str; i++)
538 if ((how & jobflags2str[i].flag) != 0)
539 ret = pool_tmpappend(pool, ret, ",", jobflags2str[i].str);
545 ret = pool_tmpappend(pool, ret, "]", 0);
551 testcase_str2job(Pool *pool, const char *str, Id *whatp)
561 /* so we can patch it */
562 s = pool_tmpjoin(pool, str, 0, 0);
563 /* split it in pieces */
566 while (*s == ' ' || *s == '\t')
570 pieces = solv_extend(pieces, npieces, 1, sizeof(*pieces), 7);
571 pieces[npieces++] = s;
572 while (*s && *s != ' ' && *s != '\t')
579 pool_debug(pool, SOLV_ERROR, "str2job: bad line '%s'\n", str);
584 for (i = 0; job2str[i].str; i++)
585 if (!strcmp(pieces[0], job2str[i].str))
589 pool_debug(pool, SOLV_ERROR, "str2job: unknown job '%s'\n", str);
593 job = job2str[i].job;
596 char *flags = pieces[npieces - 1];
598 if (*flags == '[' && flags[strlen(flags) - 1] == ']')
602 flags[strlen(flags) - 1] = ',';
605 for (nf = flags; *nf != ','; nf++)
608 for (i = 0; jobflags2str[i].str; i++)
609 if (!strcmp(flags, jobflags2str[i].str))
611 if (!jobflags2str[i].str)
613 pool_debug(pool, SOLV_ERROR, "str2job: unknown jobflags in '%s'\n", str);
617 job |= jobflags2str[i].flag;
622 if (!strcmp(pieces[1], "pkg"))
626 pool_debug(pool, SOLV_ERROR, "str2job: bad pkg selector in '%s'\n", str);
630 job |= SOLVER_SOLVABLE;
631 what = testcase_str2solvid(pool, pieces[2]);
634 pool_debug(pool, SOLV_ERROR, "str2job: unknown package '%s'\n", pieces[2]);
639 else if (!strcmp(pieces[1], "name") || !strcmp(pieces[1], "provides"))
641 /* join em again for dep2str... */
643 for (sp = pieces[2]; sp < pieces[npieces - 1]; sp++)
646 what = testcase_str2dep(pool, pieces[2]);
647 if (pieces[1][0] == 'n')
648 job |= SOLVER_SOLVABLE_NAME;
650 job |= SOLVER_SOLVABLE_PROVIDES;
652 else if (!strcmp(pieces[1], "oneof"))
655 job |= SOLVER_SOLVABLE_ONE_OF;
657 if (npieces > 3 && strcmp(pieces[2], "nothing") != 0)
659 for (i = 2; i < npieces; i++)
661 Id p = testcase_str2solvid(pool, pieces[i]);
664 pool_debug(pool, SOLV_ERROR, "str2job: unknown package '%s'\n", pieces[i]);
672 what = pool_queuetowhatprovides(pool, &q);
675 else if (!strcmp(pieces[1], "repo"))
680 pool_debug(pool, SOLV_ERROR, "str2job: bad line '%s'\n", str);
684 repo = testcase_str2repo(pool, pieces[2]);
687 pool_debug(pool, SOLV_ERROR, "str2job: unknown repo '%s'\n", pieces[2]);
691 job |= SOLVER_SOLVABLE_REPO;
694 else if (!strcmp(pieces[1], "all"))
696 if (npieces != 3 && strcmp(pieces[2], "packages") != 0)
698 pool_debug(pool, SOLV_ERROR, "str2job: bad line '%s'\n", str);
702 job |= SOLVER_SOLVABLE_ALL;
707 pool_debug(pool, SOLV_ERROR, "str2job: unknown selection in '%s'\n", str);
717 writedeps(Repo *repo, FILE *fp, const char *tag, Id key, Solvable *s, Offset off)
719 Pool *pool = repo->pool;
726 dp = repo->idarraydata + off;
728 while ((id = *dp++) != 0)
730 if (key == SOLVABLE_REQUIRES && id == SOLVABLE_PREREQMARKER)
733 fprintf(fp, "-%s\n", tag);
738 if (key == SOLVABLE_PROVIDES && id == SOLVABLE_FILEMARKER)
743 idstr = pool_dep2str(pool, id);
746 Reldep *rd = GETRELDEP(pool, id);
747 if (key == SOLVABLE_CONFLICTS && rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_OTHERPROVIDERS)
749 if (!strncmp(idstr, "namespace:", 10))
752 if (key == SOLVABLE_SUPPLEMENTS)
754 if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_FILESYSTEM)
756 if (!strncmp(idstr, "namespace:", 10))
759 else if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_MODALIAS)
761 if (!strncmp(idstr, "namespace:", 10))
764 else if (rd->flags == REL_AND)
766 /* either packageand chain or modalias */
768 if (ISRELDEP(rd->evr))
770 Reldep *mrd = GETRELDEP(pool, rd->evr);
771 if (mrd->flags == REL_NAMESPACE && mrd->name == NAMESPACE_MODALIAS)
773 idstr = pool_tmpjoin(pool, "modalias(", pool_dep2str(pool, rd->name), ":");
774 idstr = pool_tmpappend(pool, idstr, pool_dep2str(pool, mrd->evr), ")");
776 else if (mrd->flags >= 8)
781 /* must be and chain */
782 idstr = pool_dep2str(pool, rd->evr);
788 rd = GETRELDEP(pool, id);
789 if (rd->flags != REL_AND)
791 idstr = pool_tmpjoin(pool, pool_dep2str(pool, rd->evr), ":", idstr);
793 idstr = pool_tmpjoin(pool, pool_dep2str(pool, id), ":", idstr);
794 idstr = pool_tmpjoin(pool, "packageand(", idstr, ")");
797 else if (rd->flags >= 8)
803 fprintf(fp, "+%s\n", tag);
806 fprintf(fp, "%s\n", idstr);
808 if (key == SOLVABLE_PROVIDES)
810 /* add the filelist */
812 dataiterator_init(&di, pool, repo, s - pool->solvables, SOLVABLE_FILELIST, 0, 0);
813 while (dataiterator_step(&di))
815 const char *s = repodata_dir2str(di.data, di.kv.id, di.kv.str);
818 Id id = pool_str2id(pool, s, 0);
821 for (dp = prvdp; *dp; dp++)
825 continue; /* already included */
830 fprintf(fp, "+%s", tag);
833 fprintf(fp, "%s\n", s);
837 fprintf(fp, "-%s\n", tag);
841 testcase_write_testtags(Repo *repo, FILE *fp)
843 Pool *pool = repo->pool;
853 fprintf(fp, "=Ver: 2.0\n");
854 FOR_REPO_SOLVABLES(repo, p, s)
856 name = pool_id2str(pool, s->name);
857 evr = pool_id2str(pool, s->evr);
858 arch = pool_id2str(pool, s->arch);
859 release = strrchr(evr, '-');
861 release = evr + strlen(evr);
862 fprintf(fp, "=Pkg: %s %.*s %s %s\n", name, (int)(release - evr), evr, *release && release[1] ? release + 1 : "-", arch);
863 tmp = solvable_lookup_str(s, SOLVABLE_SUMMARY);
865 fprintf(fp, "=Sum: %s\n", tmp);
866 writedeps(repo, fp, "Req:", SOLVABLE_REQUIRES, s, s->requires);
867 writedeps(repo, fp, "Prv:", SOLVABLE_PROVIDES, s, s->provides);
868 writedeps(repo, fp, "Obs:", SOLVABLE_OBSOLETES, s, s->obsoletes);
869 writedeps(repo, fp, "Con:", SOLVABLE_CONFLICTS, s, s->conflicts);
870 writedeps(repo, fp, "Rec:", SOLVABLE_RECOMMENDS, s, s->recommends);
871 writedeps(repo, fp, "Sup:", SOLVABLE_SUPPLEMENTS, s, s->supplements);
872 writedeps(repo, fp, "Sug:", SOLVABLE_SUGGESTS, s, s->suggests);
873 writedeps(repo, fp, "Enh:", SOLVABLE_ENHANCES, s, s->enhances);
875 fprintf(fp, "=Vnd: %s\n", pool_id2str(pool, s->vendor));
876 ti = solvable_lookup_num(s, SOLVABLE_BUILDTIME, 0);
878 fprintf(fp, "=Tim: %u\n", ti);
884 adddep(Repo *repo, Offset olddeps, char *str, Id marker)
886 Id id = *str == '/' ? pool_str2id(repo->pool, str, 1) : testcase_str2dep(repo->pool, str);
887 return repo_addid_dep(repo, olddeps, id, marker);
891 finish_solvable(Pool *pool, Repodata *data, Solvable *s, char *filelist, int nfilelist)
897 for (l = 0; l < nfilelist; l += strlen(filelist + l) + 1)
899 char *p = strrchr(filelist + l, '/');
903 did = repodata_str2dir(data, filelist + l, 1);
906 did = repodata_str2dir(data, "/", 1);
907 repodata_add_dirstr(data, s - pool->solvables, SOLVABLE_FILELIST, did, p);
910 if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
911 s->provides = repo_addid_dep(s->repo, s->provides, pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
912 s->supplements = repo_fix_supplements(s->repo, s->provides, s->supplements, 0);
913 s->conflicts = repo_fix_conflicts(s->repo, s->conflicts);
916 /* stripped down version of susetags parser used for testcases */
918 testcase_add_testtags(Repo *repo, FILE *fp, int flags)
920 Pool *pool = repo->pool;
933 data = repo_add_repodata(repo, flags);
938 line = solv_malloc(aline);
942 if (linep - line + 16 > aline)
944 aline = linep - line;
945 line = solv_realloc(line, aline + 512);
946 linep = line + aline;
949 if (!fgets(linep, aline - (linep - line), fp))
951 linep += strlen(linep);
952 if (linep == line || linep[-1] != '\n')
955 linep = line + intag;
958 if (line[intag] == '-' && !strncmp(line + 1, line + intag + 1, intag - 2))
965 else if (line[0] == '+' && line[1] && line[1] != ':')
967 char *tagend = strchr(line, ':');
972 intag = tagend + 2 - line;
973 linep = line + intag;
976 if (*line != '=' || !line[1] || !line[2] || !line[3] || line[4] != ':')
978 tag = line[1] << 16 | line[2] << 8 | line[3];
981 case 'P' << 16 | 'k' << 8 | 'g':
983 finish_solvable(pool, data, s, filelist, nfilelist);
985 if (split(line + 5, sp, 5) != 4)
987 s = pool_id2solvable(pool, repo_add_solvable(repo));
988 s->name = pool_str2id(pool, sp[0], 1);
989 /* join back version and release */
990 if (sp[2] && !(sp[2][0] == '-' && !sp[2][1]))
992 s->evr = makeevr(pool, sp[1]);
993 s->arch = pool_str2id(pool, sp[3], 1);
995 case 'S' << 16 | 'u' << 8 | 'm':
996 repodata_set_str(data, s - pool->solvables, SOLVABLE_SUMMARY, line + 6);
998 case 'V' << 16 | 'n' << 8 | 'd':
999 s->vendor = pool_str2id(pool, line + 6, 1);
1001 case 'T' << 16 | 'i' << 8 | 'm':
1004 repodata_set_num(data, s - pool->solvables, SOLVABLE_BUILDTIME, t);
1006 case 'R' << 16 | 'e' << 8 | 'q':
1007 s->requires = adddep(repo, s->requires, line + 6, -SOLVABLE_PREREQMARKER);
1009 case 'P' << 16 | 'r' << 8 | 'q':
1010 s->requires = adddep(repo, s->requires, line + 6, SOLVABLE_PREREQMARKER);
1012 case 'P' << 16 | 'r' << 8 | 'v':
1015 int l = strlen(line + 6) + 1;
1016 if (nfilelist + l > afilelist)
1018 afilelist = nfilelist + l + 512;
1019 filelist = solv_realloc(filelist, afilelist);
1021 memcpy(filelist + nfilelist, line + 6, l);
1028 for (l = 0; l < nfilelist; l += strlen(filelist + l) + 1)
1029 s->provides = repo_addid_dep(repo, s->provides, pool_str2id(pool, filelist + l, 1), 0);
1032 s->provides = adddep(repo, s->provides, line + 6, 0);
1034 case 'O' << 16 | 'b' << 8 | 's':
1035 s->obsoletes = adddep(repo, s->obsoletes, line + 6, 0);
1037 case 'C' << 16 | 'o' << 8 | 'n':
1038 s->conflicts = adddep(repo, s->conflicts, line + 6, 0);
1040 case 'R' << 16 | 'e' << 8 | 'c':
1041 s->recommends = adddep(repo, s->recommends, line + 6, 0);
1043 case 'S' << 16 | 'u' << 8 | 'p':
1044 s->supplements = adddep(repo, s->supplements, line + 6, 0);
1046 case 'S' << 16 | 'u' << 8 | 'g':
1047 s->suggests = adddep(repo, s->suggests, line + 6, 0);
1049 case 'E' << 16 | 'n' << 8 | 'h':
1050 s->enhances = adddep(repo, s->enhances, line + 6, 0);
1057 finish_solvable(pool, data, s, filelist, nfilelist);
1059 solv_free(filelist);
1060 repodata_free_dircache(data);
1061 if (!(flags & REPO_NO_INTERNALIZE))
1062 repodata_internalize(data);
1067 testcase_getpoolflags(Pool *pool)
1069 const char *str = 0;
1071 for (i = 0; poolflags2str[i].str; i++)
1073 v = pool_get_flag(pool, poolflags2str[i].flag);
1074 if (v == poolflags2str[i].def)
1076 str = pool_tmpappend(pool, str, v ? " " : " !", poolflags2str[i].str);
1078 return str ? str + 1 : "";
1082 testcase_setpoolflags(Pool *pool, const char *str)
1084 const char *p = str, *s;
1088 while (*p == ' ' || *p == '\t' || *p == ',')
1099 while (*p && *p != ' ' && *p != '\t' && *p != ',')
1101 for (i = 0; poolflags2str[i].str; i++)
1102 if (!strncmp(poolflags2str[i].str, s, p - s) && poolflags2str[i].str[p - s] == 0)
1104 if (!poolflags2str[i].str)
1106 pool_debug(pool, SOLV_ERROR, "setpoolflags: unknown flag '%.*s'\n", (int)(p - s), s);
1109 pool_set_flag(pool, poolflags2str[i].flag, v);
1115 testcase_resetpoolflags(Pool *pool)
1118 for (i = 0; poolflags2str[i].str; i++)
1119 pool_set_flag(pool, poolflags2str[i].flag, poolflags2str[i].def);
1123 testcase_getsolverflags(Solver *solv)
1125 Pool *pool = solv->pool;
1126 const char *str = 0;
1128 for (i = 0; solverflags2str[i].str; i++)
1130 v = solver_get_flag(solv, solverflags2str[i].flag);
1131 if (v == solverflags2str[i].def)
1133 str = pool_tmpappend(pool, str, v ? " " : " !", solverflags2str[i].str);
1135 return str ? str + 1 : "";
1139 testcase_setsolverflags(Solver *solv, const char *str)
1141 const char *p = str, *s;
1145 while (*p == ' ' || *p == '\t' || *p == ',')
1156 while (*p && *p != ' ' && *p != '\t' && *p != ',')
1158 for (i = 0; solverflags2str[i].str; i++)
1159 if (!strncmp(solverflags2str[i].str, s, p - s) && solverflags2str[i].str[p - s] == 0)
1161 if (!solverflags2str[i].str)
1163 pool_debug(solv->pool, SOLV_ERROR, "setsolverflags: unknown flag '%.*s'\n", (int)(p - s), s);
1166 solver_set_flag(solv, solverflags2str[i].flag, v);
1172 testcase_resetsolverflags(Solver *solv)
1175 for (i = 0; solverflags2str[i].str; i++)
1176 solver_set_flag(solv, solverflags2str[i].flag, solverflags2str[i].def);
1180 testcase_ruleid(Solver *solv, Id rid)
1186 const unsigned char *md5;
1192 solver_ruleliterals(solv, rid, &q);
1193 for (i = 0; i < q.count; i++)
1195 Id p = q.elements[i];
1196 s = testcase_solvid2str(solv->pool, p > 0 ? p : -p);
1198 s = pool_tmpjoin(solv->pool, "!", s, 0);
1199 strqueue_push(&sq, s);
1202 strqueue_sort_u(&sq);
1203 chk = solv_chksum_create(REPOKEY_TYPE_MD5);
1204 for (i = 0; i < sq.nstr; i++)
1205 solv_chksum_add(chk, sq.str[i], strlen(sq.str[i]) + 1);
1206 md5 = solv_chksum_get(chk, &md5l);
1207 s = pool_bin2hex(solv->pool, md5, md5l);
1208 chk = solv_chksum_free(chk, 0);
1214 testcase_problemid(Solver *solv, Id problem)
1219 const unsigned char *md5;
1223 /* we build a hash of all rules that define the problem */
1226 solver_findallproblemrules(solv, problem, &q);
1227 for (i = 0; i < q.count; i++)
1228 strqueue_push(&sq, testcase_ruleid(solv, q.elements[i]));
1230 strqueue_sort_u(&sq);
1231 chk = solv_chksum_create(REPOKEY_TYPE_MD5);
1232 for (i = 0; i < sq.nstr; i++)
1233 solv_chksum_add(chk, sq.str[i], strlen(sq.str[i]) + 1);
1234 md5 = solv_chksum_get(chk, &md5l);
1235 s = pool_bin2hex(solv->pool, md5, 4);
1236 chk = solv_chksum_free(chk, 0);
1242 testcase_solutionid(Solver *solv, Id problem, Id solution)
1246 const unsigned char *md5;
1250 intid = solver_solutionelement_internalid(solv, problem, solution);
1251 /* internal stuff! handle with care! */
1255 s = testcase_job2str(solv->pool, solv->job.elements[-intid - 1], solv->job.elements[-intid]);
1260 s = testcase_ruleid(solv, intid);
1262 chk = solv_chksum_create(REPOKEY_TYPE_MD5);
1263 solv_chksum_add(chk, s, strlen(s) + 1);
1264 md5 = solv_chksum_get(chk, &md5l);
1265 s = pool_bin2hex(solv->pool, md5, 4);
1266 chk = solv_chksum_free(chk, 0);
1270 static struct class2str {
1274 { SOLVER_TRANSACTION_ERASE, "erase" },
1275 { SOLVER_TRANSACTION_INSTALL, "install" },
1276 { SOLVER_TRANSACTION_REINSTALLED, "reinstall" },
1277 { SOLVER_TRANSACTION_DOWNGRADED, "downgrade" },
1278 { SOLVER_TRANSACTION_CHANGED, "change" },
1279 { SOLVER_TRANSACTION_UPGRADED, "upgrade" },
1280 { SOLVER_TRANSACTION_OBSOLETED, "obsolete" },
1281 { SOLVER_TRANSACTION_MULTIINSTALL, "multiinstall" },
1282 { SOLVER_TRANSACTION_MULTIREINSTALL, "multireinstall" },
1287 testcase_solverresult(Solver *solv, int resultflags)
1289 Pool *pool = solv->pool;
1297 if ((resultflags & TESTCASE_RESULT_TRANSACTION) != 0)
1299 Transaction *trans = solver_create_transaction(solv);
1303 for (i = 0; class2str[i].str; i++)
1306 transaction_classify_pkgs(trans, SOLVER_TRANSACTION_KEEP_PSEUDO, class2str[i].class, 0, 0, &q);
1307 for (j = 0; j < q.count; j++)
1311 if (pool->installed && pool->solvables[p].repo == pool->installed)
1312 op = transaction_obs_pkg(trans, p);
1313 s = pool_tmpjoin(pool, class2str[i].str, " ", testcase_solvid2str(pool, p));
1315 s = pool_tmpjoin(pool, s, " ", testcase_solvid2str(pool, op));
1316 strqueue_push(&sq, s);
1320 transaction_free(trans);
1322 if ((resultflags & TESTCASE_RESULT_PROBLEMS) != 0)
1324 char *probprefix, *solprefix;
1325 int problem, solution, element;
1328 pcnt = solver_problem_count(solv);
1329 for (problem = 1; problem <= pcnt; problem++)
1331 Id rid, from, to, dep;
1332 SolverRuleinfo rinfo;
1333 rid = solver_findproblemrule(solv, problem);
1334 s = testcase_problemid(solv, problem);
1335 probprefix = solv_dupjoin("problem ", s, 0);
1336 rinfo = solver_ruleinfo(solv, rid, &from, &to, &dep);
1337 s = pool_tmpjoin(pool, probprefix, " info ", solver_problemruleinfo2str(solv, rinfo, from, to, dep));
1338 strqueue_push(&sq, s);
1339 scnt = solver_solution_count(solv, problem);
1340 for (solution = 1; solution <= scnt; solution++)
1342 s = testcase_solutionid(solv, problem, solution);
1343 solprefix = solv_dupjoin(probprefix, " solution ", s);
1345 while ((element = solver_next_solutionelement(solv, problem, solution, element, &p, &op)) != 0)
1347 if (p == SOLVER_SOLUTION_JOB)
1348 s = pool_tmpjoin(pool, solprefix, " deljob ", testcase_job2str(pool, solv->job.elements[op - 1], solv->job.elements[op]));
1349 else if (p > 0 && op == 0)
1350 s = pool_tmpjoin(pool, solprefix, " erase ", testcase_solvid2str(pool, p));
1351 else if (p > 0 && op > 0)
1353 s = pool_tmpjoin(pool, solprefix, " replace ", testcase_solvid2str(pool, p));
1354 s = pool_tmpappend(pool, s, " ", testcase_solvid2str(pool, op));
1356 else if (p < 0 && op > 0)
1357 s = pool_tmpjoin(pool, solprefix, " allow ", testcase_solvid2str(pool, op));
1359 s = pool_tmpjoin(pool, solprefix, " unknown", 0);
1360 strqueue_push(&sq, s);
1362 solv_free(solprefix);
1364 solv_free(probprefix);
1368 if ((resultflags & TESTCASE_RESULT_ORPHANED) != 0)
1373 solver_get_orphaned(solv, &q);
1374 for (i = 0; i < q.count; i++)
1376 s = pool_tmpjoin(pool, "orphaned ", testcase_solvid2str(pool, q.elements[i]), 0);
1377 strqueue_push(&sq, s);
1382 if ((resultflags & TESTCASE_RESULT_RECOMMENDED) != 0)
1388 solver_get_recommendations(solv, &qr, &qs, 0);
1389 for (i = 0; i < qr.count; i++)
1391 s = pool_tmpjoin(pool, "recommended ", testcase_solvid2str(pool, qr.elements[i]), 0);
1392 strqueue_push(&sq, s);
1394 for (i = 0; i < qs.count; i++)
1396 s = pool_tmpjoin(pool, "suggested ", testcase_solvid2str(pool, qs.elements[i]), 0);
1397 strqueue_push(&sq, s);
1403 if ((resultflags & TESTCASE_RESULT_UNNEEDED) != 0)
1408 solver_get_unneeded(solv, &q, 0);
1409 for (i = 0; i < q.count; i++)
1411 s = pool_tmpjoin(pool, "unneeded ", testcase_solvid2str(pool, q.elements[i]), 0);
1412 strqueue_push(&sq, s);
1418 result = strqueue_join(&sq);
1425 testcase_write(Solver *solv, char *dir, int resultflags, const char *testcasename, const char *resultname)
1427 Pool *pool = solv->pool;
1438 testcasename = "testcase.t";
1440 resultname = "solver.result";
1442 if (mkdir(dir, 0777) && errno != EEXIST)
1444 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: could not create directory '%s'\n", dir);
1448 FOR_REPOS(repoid, repo)
1450 const char *name = testcase_repoid2str(pool, repoid);
1452 if (repo->subpriority)
1453 sprintf(priobuf, "%d.%d", repo->priority, repo->subpriority);
1455 sprintf(priobuf, "%d", repo->priority);
1456 out = pool_tmpjoin(pool, name, ".repo", ".gz");
1457 cmd = pool_tmpjoin(pool, "repo ", name, " ");
1458 cmd = pool_tmpappend(pool, cmd, priobuf, " ");
1459 cmd = pool_tmpappend(pool, cmd, "testtags ", out);
1460 strqueue_push(&sq, cmd);
1461 out = pool_tmpjoin(pool, dir, "/", out);
1462 if (!(fp = solv_xfopen(out, "w")))
1464 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: could not open '%s' for writing\n", out);
1468 testcase_write_testtags(repo, fp);
1471 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: write error\n");
1476 /* hmm, this is not optimal... we currently search for the lowest score */
1479 for (i = 0; i < pool->lastarch; i++)
1481 if (pool->id2arch[i] == 1 && !lowscore)
1483 if (pool->id2arch[i] > 0x10000 && (!lowscore || pool->id2arch[i] < lowscore))
1486 lowscore = pool->id2arch[i];
1489 cmd = pool_tmpjoin(pool, "system ", pool_id2str(pool, arch), pool->disttype == DISTTYPE_DEB ? " deb" : " rpm");
1490 if (pool->installed)
1491 cmd = pool_tmpappend(pool, cmd, " ", testcase_repoid2str(pool, pool->installed->repoid));
1492 strqueue_push(&sq, cmd);
1493 s = testcase_getpoolflags(solv->pool);
1496 cmd = pool_tmpjoin(pool, "poolflags ", s, 0);
1497 strqueue_push(&sq, cmd);
1500 if (pool->vendorclasses)
1503 for (i = 0; pool->vendorclasses[i]; i++)
1505 cmd = pool_tmpappend(pool, cmd ? cmd : "vendorclass", " ", pool->vendorclasses[i]);
1506 if (!pool->vendorclasses[i + 1])
1508 strqueue_push(&sq, cmd);
1515 s = testcase_getsolverflags(solv);
1518 cmd = pool_tmpjoin(pool, "solverflags ", s, 0);
1519 strqueue_push(&sq, cmd);
1522 /* now dump all the ns callback values we know */
1523 if (pool->nscallback)
1527 for (rid = 1; rid < pool->nrels; rid++)
1529 Reldep *rd = pool->rels + rid;
1530 if (rd->flags != REL_NAMESPACE || rd->name == NAMESPACE_OTHERPROVIDERS)
1532 /* check if we evaluated it, also skip empty results */
1533 if (!(d = pool->whatprovides_rel[rid]) || !pool->whatprovidesdata[d])
1535 cmd = pool_tmpjoin(pool, "namespace ", pool_id2str(pool, rd->name), "(");
1536 cmd = pool_tmpappend(pool, cmd, pool_id2str(pool, rd->evr), ")");
1537 for (; pool->whatprovidesdata[d]; d++)
1538 cmd = pool_tmpappend(pool, cmd, " ", testcase_solvid2str(pool, pool->whatprovidesdata[d]));
1539 strqueue_push(&sq, cmd);
1543 for (i = 0; i < solv->job.count; i += 2)
1545 cmd = (char *)testcase_job2str(pool, solv->job.elements[i], solv->job.elements[i + 1]);
1546 cmd = pool_tmpjoin(pool, "job ", cmd, 0);
1547 strqueue_push(&sq, cmd);
1554 for (i = 0; resultflags2str[i].str; i++)
1555 if ((resultflags & resultflags2str[i].flag) != 0)
1556 cmd = pool_tmpappend(pool, cmd, cmd ? "," : 0, resultflags2str[i].str);
1557 cmd = pool_tmpjoin(pool, "result ", cmd ? cmd : "?", 0);
1558 cmd = pool_tmpappend(pool, cmd, " ", resultname);
1559 strqueue_push(&sq, cmd);
1560 result = testcase_solverresult(solv, resultflags);
1561 if (!strcmp(resultname, "<inline>"))
1565 strqueue_init(&rsq);
1566 strqueue_split(&rsq, result);
1567 for (i = 0; i < rsq.nstr; i++)
1569 cmd = pool_tmpjoin(pool, "#>", rsq.str[i], 0);
1570 strqueue_push(&sq, cmd);
1572 strqueue_free(&rsq);
1576 out = pool_tmpjoin(pool, dir, "/", resultname);
1577 if (!(fp = fopen(out, "w")))
1579 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: could not open '%s' for writing\n", out);
1584 if (result && *result && fwrite(result, strlen(result), 1, fp) != 1)
1586 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: write error\n");
1593 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: write error\n");
1601 cmd = strqueue_join(&sq);
1602 out = pool_tmpjoin(pool, dir, "/", testcasename);
1603 if (!(fp = fopen(out, "w")))
1605 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: could not open '%s' for writing\n", out);
1609 if (*cmd && fwrite(cmd, strlen(cmd), 1, fp) != 1)
1611 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: write error\n");
1617 pool_debug(solv->pool, SOLV_ERROR, "testcase_write: write error\n");
1627 read_inline_file(FILE *fp, char **bufp, char **bufpp, int *buflp)
1629 char *result = solv_malloc(1024);
1636 if (rp - result + 256 >= resultl)
1638 resultl = rp - result;
1639 result = solv_realloc(result, resultl + 1024);
1640 rp = result + resultl;
1643 if (!fgets(rp, resultl - (rp - result), fp))
1646 if (rl && (rp == result || rp[-1] == '\n'))
1648 if (rl > 1 && rp[0] == '#' && rp[1] == '>')
1650 memmove(rp, rp + 2, rl - 2);
1655 while (rl + 16 > *buflp)
1657 *bufp = solv_realloc(*bufp, *buflp + 512);
1660 memmove(*bufp, rp, rl);
1661 if ((*bufp)[rl - 1] == '\n')
1667 (*bufpp) = *bufp + rl;
1684 char *result = solv_malloc(1024);
1691 if (rp - result + 256 >= resultl)
1693 resultl = rp - result;
1694 result = solv_realloc(result, resultl + 1024);
1695 rp = result + resultl;
1698 rl = fread(rp, 1, resultl - (rp - result), fp);
1710 testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, int *resultflagsp)
1715 char *testcasedir, *s;
1721 int poolflagsreset = 0;
1723 if (!fp && !(fp = fopen(testcase, "r")))
1725 pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", testcase);
1728 testcasedir = solv_strdup(testcase);
1729 if ((s = strrchr(testcasedir, '/')) != 0)
1734 buf = solv_malloc(bufl);
1739 if (bufp - buf + 16 > bufl)
1742 buf = solv_realloc(buf, bufl + 512);
1746 if (!fgets(bufp, bufl - (bufp - buf), fp))
1750 if (!l || buf[l - 1] != '\n')
1757 while (*s && (*s == ' ' || *s == '\t'))
1759 if (!*s || *s == '#')
1762 /* split it in pieces */
1765 while (*s == ' ' || *s == '\t')
1769 pieces = solv_extend(pieces, npieces, 1, sizeof(*pieces), 7);
1770 pieces[npieces++] = s;
1771 while (*s && *s != ' ' && *s != '\t')
1776 pieces = solv_extend(pieces, npieces, 1, sizeof(*pieces), 7);
1777 pieces[npieces] = 0;
1778 if (!strcmp(pieces[0], "repo") && npieces >= 4)
1780 Repo *repo = repo_create(pool, pieces[1]);
1786 if (!poolflagsreset)
1789 testcase_resetpoolflags(pool); /* hmm */
1791 if (sscanf(pieces[2], "%d.%d", &prio, &subprio) != 2)
1794 prio = atoi(pieces[2]);
1796 repo->priority = prio;
1797 repo->subpriority = subprio;
1798 if (strcmp(pieces[3], "empty") != 0)
1800 const char *repotype = pool_tmpjoin(pool, pieces[3], 0, 0); /* gets overwritten in <inline> case */
1801 if (!strcmp(pieces[4], "<inline>"))
1803 char *idata = read_inline_file(fp, &buf, &bufp, &bufl);
1805 rfp = solv_xfopen_buf(rdata, &idata, 0, "rf");
1809 rdata = pool_tmpjoin(pool, testcasedir, pieces[4], 0);
1810 rfp = solv_xfopen(rdata, "r");
1814 pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", rdata);
1816 else if (!strcmp(repotype, "testtags"))
1818 testcase_add_testtags(repo, rfp, 0);
1821 else if (!strcmp(repotype, "solv"))
1823 repo_add_solv(repo, rfp, 0);
1829 pool_debug(pool, SOLV_ERROR, "testcase_read: unknown repo type for repo '%s'\n", repo->name);
1833 else if (!strcmp(pieces[0], "system") && npieces >= 3)
1836 pool_setarch(pool, pieces[1]);
1839 Repo *repo = testcase_str2repo(pool, pieces[3]);
1841 pool_debug(pool, SOLV_ERROR, "testcase_read: system: unknown repo '%s'\n", pieces[3]);
1843 pool_set_installed(pool, repo);
1846 else if (!strcmp(pieces[0], "job") && npieces > 1)
1852 pool_addfileprovides(pool);
1853 pool_createwhatprovides(pool);
1857 for (sp = pieces[1]; sp < pieces[npieces - 1]; sp++)
1860 how = testcase_str2job(pool, pieces[1], &what);
1861 if (how >= 0 && job)
1862 queue_push2(job, how, what);
1864 else if (!strcmp(pieces[0], "vendorclass") && npieces > 1)
1866 pool_addvendorclass(pool, (const char **)(pieces + 1));
1868 else if (!strcmp(pieces[0], "namespace") && npieces > 1)
1870 int i = strlen(pieces[1]);
1871 s = strchr(pieces[1], '(');
1872 if (!s && pieces[1][i - 1] != ')')
1874 pool_debug(pool, SOLV_ERROR, "testcase_read: bad namespace '%s'\n", pieces[1]);
1882 pieces[1][i - 1] = 0;
1883 name = pool_str2id(pool, pieces[1], 1);
1884 evr = pool_str2id(pool, s + 1, 1);
1886 pieces[1][i - 1] = ')';
1887 id = pool_rel2id(pool, name, evr, REL_NAMESPACE, 1);
1888 for (i = 2; i < npieces; i++)
1889 queue_push(&q, testcase_str2solvid(pool, pieces[i]));
1890 /* now do the callback */
1893 pool_addfileprovides(pool);
1894 pool_createwhatprovides(pool);
1897 pool->whatprovides_rel[GETRELID(id)] = pool_queuetowhatprovides(pool, &q);
1901 else if (!strcmp(pieces[0], "poolflags"))
1904 if (!poolflagsreset)
1907 testcase_resetpoolflags(pool); /* hmm */
1909 for (i = 1; i < npieces; i++)
1910 testcase_setpoolflags(pool, pieces[i]);
1912 else if (!strcmp(pieces[0], "solverflags") && npieces > 1)
1917 solv = solver_create(pool);
1918 testcase_resetsolverflags(solv);
1920 for (i = 1; i < npieces; i++)
1921 testcase_setsolverflags(solv, pieces[i]);
1923 else if (!strcmp(pieces[0], "result") && npieces > 2)
1927 int resultflags = 0;
1928 char *s = pieces[1];
1932 char *se = strchr(s, ',');
1935 for (i = 0; resultflags2str[i].str; i++)
1936 if (!strcmp(s, resultflags2str[i].str))
1938 resultflags |= resultflags2str[i].flag;
1941 if (!resultflags2str[i].str)
1942 pool_debug(pool, SOLV_ERROR, "result: unknown flag '%s'\n", s);
1946 rdata = pool_tmpjoin(pool, testcasedir, pieces[2], 0);
1947 if (!strcmp(pieces[2], "<inline>"))
1948 result = read_inline_file(fp, &buf, &bufp, &bufl);
1951 FILE *rfp = fopen(rdata, "r");
1953 pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", rdata);
1956 result = read_file(rfp);
1965 *resultflagsp = resultflags;
1967 else if (!strcmp(pieces[0], "nextjob") && npieces == 1)
1973 pool_debug(pool, SOLV_ERROR, "testcase_read: cannot parse command '%s'\n", pieces[0]);
1976 buf = solv_free(buf);
1977 pieces = solv_free(pieces);
1978 solv_free(testcasedir);
1981 pool_addfileprovides(pool);
1982 pool_createwhatprovides(pool);
1986 solv = solver_create(pool);
1987 testcase_resetsolverflags(solv);
1995 testcase_resultdiff(char *result1, char *result2)
1997 Strqueue sq1, sq2, osq;
1999 strqueue_init(&sq1);
2000 strqueue_init(&sq2);
2001 strqueue_init(&osq);
2002 strqueue_split(&sq1, result1);
2003 strqueue_split(&sq2, result2);
2004 strqueue_sort(&sq1);
2005 strqueue_sort(&sq2);
2006 strqueue_diff(&sq1, &sq2, &osq);
2007 r = osq.nstr ? strqueue_join(&osq) : 0;
2008 strqueue_free(&sq1);
2009 strqueue_free(&sq2);
2010 strqueue_free(&osq);