summaryrefslogtreecommitdiff
path: root/src/app_add.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-07-26 16:25:03 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-07-27 14:09:38 +0300
commit9c843e4ecdfee916ec835b5d35c10b3818aba9e3 (patch)
treed2c703035bbdaa1f21ce0e8ed0cf121b7388f656 /src/app_add.c
parent2d4e88aeb1690220ce57420e8d1d9de327ae901d (diff)
downloadapk-tools-9c843e4ecdfee916ec835b5d35c10b3818aba9e3.tar.gz
apk-tools-9c843e4ecdfee916ec835b5d35c10b3818aba9e3.tar.bz2
apk-tools-9c843e4ecdfee916ec835b5d35c10b3818aba9e3.tar.xz
apk-tools-9c843e4ecdfee916ec835b5d35c10b3818aba9e3.zip
Refactor .apk extraction code
This moves and isolates the tar code to tar.c. And the actual file extraction to disk is moved to extract.c. A new API is introduced and used for v2 file extraction. This essentially moves and isolates the apk_sign_ctx_* beast into extract_v2.c and offers a saner interface to handling packages. A place holder is added for v3 extraction.
Diffstat (limited to 'src/app_add.c')
-rw-r--r--src/app_add.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/app_add.c b/src/app_add.c
index b4fb356..345fd7a 100644
--- a/src/app_add.c
+++ b/src/app_add.c
@@ -14,6 +14,7 @@
#include "apk_database.h"
#include "apk_print.h"
#include "apk_solver.h"
+#include "apk_extract.h"
struct add_ctx {
const char *virtpkg;
@@ -153,15 +154,11 @@ static int add_main(void *ctx, struct apk_ctx *ac, struct apk_string_array *args
if (strstr(*parg, ".apk") != NULL) {
struct apk_package *pkg = NULL;
- struct apk_sign_ctx sctx;
if (non_repository_check(db))
return -1;
- apk_sign_ctx_init(&sctx, APK_SIGN_VERIFY_AND_GENERATE,
- NULL, apk_ctx_get_trust(ac));
- r = apk_pkg_read(db, *parg, &sctx, &pkg);
- apk_sign_ctx_free(&sctx);
+ r = apk_pkg_read(db, *parg, &pkg);
if (r != 0) {
apk_err(out, "%s: %s", *parg, apk_error_str(r));
return -1;