Skip to content

Commit ba171f1

Browse files
authored
Merge pull request #434 from tl-hbk/use_only_tar_bz2
Add flag to skip conda v2 packages when parsing conda repos
2 parents 4bc791c + ed6fb6a commit ba171f1

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

ext/repo_conda.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ parse_packages2(struct parsedata *pd, struct solv_jsonparser *jp)
258258
}
259259

260260
static int
261-
parse_main(struct parsedata *pd, struct solv_jsonparser *jp)
261+
parse_main(struct parsedata *pd, struct solv_jsonparser *jp, int flags)
262262
{
263263
int type = JP_OBJECT;
264264
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)
267267
type = parse_packages(pd, jp);
268268
else if (type == JP_ARRAY && !strcmp("packages", jp->key))
269269
type = parse_packages2(pd, jp);
270-
else if (type == JP_OBJECT && !strcmp("packages.conda", jp->key))
270+
else if (type == JP_OBJECT && !strcmp("packages.conda", jp->key) && !(flags & CONDA_ADD_USE_ONLY_TAR_BZ2))
271271
type = parse_packages(pd, jp);
272-
else if (type == JP_ARRAY && !strcmp("packages.conda", jp->key))
272+
else if (type == JP_ARRAY && !strcmp("packages.conda", jp->key) && !(flags & CONDA_ADD_USE_ONLY_TAR_BZ2))
273273
type = parse_packages2(pd, jp);
274274
else
275275
type = jsonparser_skip(jp, type);
@@ -298,7 +298,7 @@ repo_add_conda(Repo *repo, FILE *fp, int flags)
298298
jsonparser_init(&jp, fp);
299299
if ((type = jsonparser_parse(&jp)) != JP_OBJECT)
300300
ret = pool_error(pool, -1, "repository does not start with an object");
301-
else if ((type = parse_main(&pd, &jp)) != JP_OBJECT_END)
301+
else if ((type = parse_main(&pd, &jp, flags)) != JP_OBJECT_END)
302302
ret = pool_error(pool, -1, "parse error line %d", jp.line);
303303
jsonparser_free(&jp);
304304

ext/repo_conda.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
* for further information
66
*/
77

8+
#define CONDA_ADD_USE_ONLY_TAR_BZ2 (1 << 8)
9+
810
extern int repo_add_conda(Repo *repo, FILE *fp, int flags);

0 commit comments

Comments
 (0)