From: Michael Tremer Date: Tue, 11 Jun 2019 03:47:14 +0000 (+0100) Subject: libpakfire: Implement extracting archives in a transaction X-Git-Tag: 0.9.28~1285^2~933 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=622a6c0b8b01c1e7bdd03a5f3c9b454e222722da;p=pakfire.git libpakfire: Implement extracting archives in a transaction Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/step.c b/src/libpakfire/step.c index b8d228f5c..e0ad40fa2 100644 --- a/src/libpakfire/step.c +++ b/src/libpakfire/step.c @@ -255,7 +255,20 @@ static int pakfire_step_run_script(PakfireStep step, pakfire_script_type script) } static int pakfire_step_extract(PakfireStep step) { - return 0; // TODO + if (!step->archive) { + ERROR(step->pakfire, "Archive was not opened\n"); + return -1; + } + + // Extract payload to the root of the Pakfire instance + int r = pakfire_archive_extract(step->archive, NULL, PAKFIRE_ARCHIVE_USE_PAYLOAD); + if (r) { + char* nevra = pakfire_package_get_nevra(step->package); + ERROR(step->pakfire, "Could not extract package %s: %d\n", nevra, r); + pakfire_free(nevra); + } + + return r; } static int pakfire_step_erase(PakfireStep step) {