Skip to content
Snippets Groups Projects
Commit af90d636 authored by Timo Teräs's avatar Timo Teräs
Browse files

index: simplify pruning by origin

parent 753bb52f
No related branches found
No related tags found
No related merge requests found
......@@ -91,15 +91,6 @@ struct index_writer {
unsigned short index_flags;
};
static int mark_origin(struct apk_database *db, struct apk_package *pkg, int mark)
{
struct apk_name *n;
if (pkg->origin == NULL) return 0;
n = apk_db_get_name(db, *pkg->origin);
n->state_int |= mark;
return n->state_int;
}
static int index_write_entry(struct apk_database *db, const char *match, struct apk_package *pkg, void *ctx)
{
struct index_writer *iw = ctx;
......@@ -108,7 +99,10 @@ static int index_write_entry(struct apk_database *db, const char *match, struct
case APK_INDEXF_MERGE:
break;
case APK_INDEXF_MERGE|APK_INDEXF_PRUNE_ORIGIN:
if (mark_origin(db, pkg, 0) && !pkg->marked) return 0;
if (!pkg->marked && pkg->origin) {
struct apk_name *n = apk_db_query_name(db, *pkg->origin);
if (n && n->state_int) return 0;
}
break;
default:
if (!pkg->marked) return 0;
......@@ -164,7 +158,7 @@ static void index_mark_package(struct apk_database *db, struct apk_package *pkg,
{
if (rewrite_arch) pkg->arch = rewrite_arch;
pkg->marked = 1;
mark_origin(db, pkg, 1);
if (pkg->origin) apk_db_get_name(db, *pkg->origin)->state_int = 1;
}
static int index_main(void *ctx, struct apk_ctx *ac, struct apk_string_array *args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment