From c2959803ee1df2abc861f15059321aec468b9669 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Mon, 16 Sep 2024 15:35:17 +0200 Subject: [PATCH] Support orderwithrequires dependencies in testcases --- ext/repo_testcase.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ext/repo_testcase.c b/ext/repo_testcase.c index cbdd42a3..e87938a1 100644 --- a/ext/repo_testcase.c +++ b/ext/repo_testcase.c @@ -400,6 +400,19 @@ writedeps(Repo *repo, FILE *fp, const char *tag, Id key, Solvable *s, Offset off fprintf(fp, "-%s\n", tag); } +static void +writedeps_q(Repo *repo, FILE *fp, const char *tag, Id key, Solvable *s, Queue *q) +{ + Pool *pool = repo->pool; + int i; + if (!solvable_lookup_idarray(s, key, q) || !q->count) + return; + fprintf(fp, "+%s\n", tag); + for (i = 0; i < q->count; i++) + fprintf(fp, "%s\n", testcase_dep2str(pool, q->elements[i])); + fprintf(fp, "-%s\n", tag); +} + static void writefilelist(Repo *repo, FILE *fp, const char *tag, Solvable *s) { @@ -459,22 +472,9 @@ testcase_write_testtags(Repo *repo, FILE *fp) writedeps(repo, fp, "Sup:", SOLVABLE_SUPPLEMENTS, s, s->supplements); writedeps(repo, fp, "Sug:", SOLVABLE_SUGGESTS, s, s->suggests); writedeps(repo, fp, "Enh:", SOLVABLE_ENHANCES, s, s->enhances); - if (solvable_lookup_idarray(s, SOLVABLE_PREREQ_IGNOREINST, &q)) - { - int i; - fprintf(fp, "+Ipr:\n"); - for (i = 0; i < q.count; i++) - fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i])); - fprintf(fp, "-Ipr:\n"); - } - if (solvable_lookup_idarray(s, SOLVABLE_CONSTRAINS, &q)) - { - int i; - fprintf(fp, "+Cns:\n"); - for (i = 0; i < q.count; i++) - fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i])); - fprintf(fp, "-Cns:\n"); - } + writedeps_q(repo, fp, "Ipr:", SOLVABLE_PREREQ_IGNOREINST, s, &q); + writedeps_q(repo, fp, "Cns:", SOLVABLE_CONSTRAINS, s, &q); + writedeps_q(repo, fp, "Owr:", SOLVABLE_ORDERWITHREQUIRES, s, &q); if (s->vendor) fprintf(fp, "=Vnd: %s\n", pool_id2str(pool, s->vendor)); if (solvable_lookup_idarray(s, SOLVABLE_BUILDFLAVOR, &q)) @@ -721,6 +721,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags) case 'C' << 16 | 'n' << 8 | 's': repodata_add_idarray(data, s - pool->solvables, SOLVABLE_CONSTRAINS, testcase_str2dep(pool, line + 6)); break; + case 'O' << 16 | 'w' << 8 | 'r': + repodata_add_idarray(data, s - pool->solvables, SOLVABLE_ORDERWITHREQUIRES, testcase_str2dep(pool, line + 6)); + break; case 'F' << 16 | 'l' << 8 | 'v': repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_BUILDFLAVOR, line + 6); break; -- 2.47.2