]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Implement extracting archives in a transaction
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Jun 2019 03:47:14 +0000 (04:47 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Jun 2019 03:47:14 +0000 (04:47 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/step.c

index b8d228f5cbd2401d1d000255cbbb17437463a4a7..e0ad40fa24168d492dd75184d17abe0819f4102c 100644 (file)
@@ -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) {