diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-04-12 10:14:09 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-12 10:14:09 +0300 |
commit | af90d636cc0bcc42c38cb953aae4ab4b973ed6a3 (patch) | |
tree | 7adf2ef059d9530df7e589cd21b5596259019983 | |
parent | 753bb52f36ce978c28db0cd02191b5832eaab38c (diff) | |
download | apk-tools-af90d636cc0bcc42c38cb953aae4ab4b973ed6a3.tar.gz apk-tools-af90d636cc0bcc42c38cb953aae4ab4b973ed6a3.tar.bz2 apk-tools-af90d636cc0bcc42c38cb953aae4ab4b973ed6a3.tar.xz apk-tools-af90d636cc0bcc42c38cb953aae4ab4b973ed6a3.zip |
index: simplify pruning by origin
-rw-r--r-- | src/app_index.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/app_index.c b/src/app_index.c index 7fbf38a..02fe30d 100644 --- a/src/app_index.c +++ b/src/app_index.c @@ -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) |