]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Add flag to skip conda v2 packages when parsing conda repos
authorThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Mon, 1 Mar 2021 15:48:03 +0000 (09:48 -0600)
committerThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Mon, 1 Mar 2021 15:48:03 +0000 (09:48 -0600)
ext/repo_conda.c
ext/repo_conda.h

index 6e9a96376963d9a8bb5f4c99c6f37a4627504833..c35dc621fc1f49c15a4b7556feac6a567629a938 100644 (file)
@@ -258,7 +258,7 @@ parse_packages2(struct parsedata *pd, struct solv_jsonparser *jp)
 }
 
 static int
-parse_main(struct parsedata *pd, struct solv_jsonparser *jp)
+parse_main(struct parsedata *pd, struct solv_jsonparser *jp, int flags)
 {
   int type = JP_OBJECT;
   while (type > 0 && (type = jsonparser_parse(jp)) > 0 && type != JP_OBJECT_END)
@@ -267,9 +267,9 @@ parse_main(struct parsedata *pd, struct solv_jsonparser *jp)
        type = parse_packages(pd, jp);
       else if (type == JP_ARRAY && !strcmp("packages", jp->key))
        type = parse_packages2(pd, jp);
-      else if (type == JP_OBJECT && !strcmp("packages.conda", jp->key))
+      else if (type == JP_OBJECT && !strcmp("packages.conda", jp->key) && !(flags & CONDA_ADD_USE_ONLY_TAR_BZ2))
        type = parse_packages(pd, jp);
-      else if (type == JP_ARRAY && !strcmp("packages.conda", jp->key))
+      else if (type == JP_ARRAY && !strcmp("packages.conda", jp->key) && !(flags & CONDA_ADD_USE_ONLY_TAR_BZ2))
        type = parse_packages2(pd, jp);
       else
        type = jsonparser_skip(jp, type);
@@ -298,7 +298,7 @@ repo_add_conda(Repo *repo, FILE *fp, int flags)
   jsonparser_init(&jp, fp);
   if ((type = jsonparser_parse(&jp)) != JP_OBJECT)
     ret = pool_error(pool, -1, "repository does not start with an object");
-  else if ((type = parse_main(&pd, &jp)) != JP_OBJECT_END)
+  else if ((type = parse_main(&pd, &jp, flags)) != JP_OBJECT_END)
     ret = pool_error(pool, -1, "parse error line %d", jp.line);
   jsonparser_free(&jp);
 
index 7e90a3d0b90aa34e3c7057421f32eea5cdfdf72c..da08d4526d543d721d7a7dd3ede508219db223e5 100644 (file)
@@ -5,4 +5,6 @@
  * for further information
  */
 
+#define CONDA_ADD_USE_ONLY_TAR_BZ2  (1 << 0)
+
 extern int repo_add_conda(Repo *repo, FILE *fp, int flags);