summaryrefslogtreecommitdiff
path: root/src/app_manifest.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-10-09 12:44:32 +0300
committerTimo Teräs <timo.teras@iki.fi>2020-10-09 16:09:19 +0300
commita627ab8eb8387ebf5735cf525ae72bfa159aa39a (patch)
tree6c11a133c2743d03c4b4bc8be0f9cb42819aaee7 /src/app_manifest.c
parent354713d2f746c197eed6a1feb4c6af3420af6c15 (diff)
downloadapk-tools-a627ab8eb8387ebf5735cf525ae72bfa159aa39a.tar.gz
apk-tools-a627ab8eb8387ebf5735cf525ae72bfa159aa39a.tar.bz2
apk-tools-a627ab8eb8387ebf5735cf525ae72bfa159aa39a.tar.xz
apk-tools-a627ab8eb8387ebf5735cf525ae72bfa159aa39a.zip
make apk_database optional for applets that don't need it
The new v3 applets don't use it, and eventually all applets will use the new formats only. This prepares the code for this, and moves trust, id_cache, and root_fd to apk_ctx which is enough for v3 applets at this time. The generic code is made to not initialize apk_database if it's not needed.
Diffstat (limited to 'src/app_manifest.c')
-rw-r--r--src/app_manifest.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/app_manifest.c b/src/app_manifest.c
index 9b9a2db..19d02f4 100644
--- a/src/app_manifest.c
+++ b/src/app_manifest.c
@@ -94,6 +94,7 @@ static int read_file_entry(void *ctx, const struct apk_file_info *ae, struct apk
static void process_file(struct apk_database *db, const char *match)
{
+ struct apk_id_cache *idc = apk_ctx_get_id_cache(db->ctx);
struct apk_out *out = &db->ctx->out;
struct apk_sign_ctx sctx;
struct manifest_file_ctx ctx = {
@@ -112,7 +113,7 @@ static void process_file(struct apk_database *db, const char *match)
apk_sign_ctx_init(&sctx, APK_SIGN_VERIFY, NULL, db->keys_fd, db->ctx->flags & APK_ALLOW_UNTRUSTED);
r = apk_tar_parse(
apk_istream_gunzip_mpart(apk_istream_from_file(AT_FDCWD, match), apk_sign_ctx_mpart_cb, &sctx),
- read_file_entry, &ctx, &db->id_cache);
+ read_file_entry, &ctx, idc);
apk_sign_ctx_free(&sctx);
if (r < 0) apk_err(out, "%s: %s", match, apk_error_str(r));
}
@@ -130,9 +131,9 @@ static void process_match(struct apk_database *db, const char *match, struct apk
process_package(db, p->pkg);
}
-static int manifest_main(void *applet_ctx, struct apk_database *db, struct apk_string_array *args)
+static int manifest_main(void *applet_ctx, struct apk_ctx *ac, struct apk_string_array *args)
{
- apk_name_foreach_matching(db, args, apk_foreach_genid(), process_match, NULL);
+ apk_name_foreach_matching(ac->db, args, apk_foreach_genid(), process_match, NULL);
return 0;
}