]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Support orderwithrequires dependencies in testcases
authorMichael Schroeder <mls@suse.de>
Mon, 16 Sep 2024 13:35:17 +0000 (15:35 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 16 Sep 2024 13:35:17 +0000 (15:35 +0200)
ext/repo_testcase.c

index cbdd42a3ddb40121ef0e7f3bcbbe9f122448c743..e87938a151e51e6ba37ff3895e8c14c6c46bc4c5 100644 (file)
@@ -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;