]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Stop parsing filelist during extraction
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 May 2021 18:57:44 +0000 (18:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 20 May 2021 18:57:44 +0000 (18:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/archive.c

index c34246baafc020c4dd20b0749459c230c89b1037..5d451d50c2e75a185a1f4245ec91888091d7133e 100644 (file)
@@ -852,7 +852,6 @@ static int pakfire_archive_extraction_path(PakfireArchive archive,
 struct pakfire_archive_extractor {
        struct archive* writer;
        const char* path;
-       PakfireFilelist filelist;
        struct pakfire_progressbar* progressbar;
 };
 
@@ -894,7 +893,6 @@ static int pakfire_archive_extract_entry(PakfireArchive archive,
                struct archive* a, struct archive_entry* entry, void* data) {
        struct pakfire_archive_extractor* extractor = (struct pakfire_archive_extractor*)data;
 
-       PakfireFile file = NULL;
        char buffer[PATH_MAX];
        int r = 1;
 
@@ -905,23 +903,6 @@ static int pakfire_archive_extract_entry(PakfireArchive archive,
        if (extractor->progressbar)
                pakfire_progressbar_update(extractor->progressbar, bytes_read);
 
-       // Create a new file object if there is a filelist
-       if (extractor->filelist) {
-               r = pakfire_file_create(&file, archive->pakfire);
-               if (r)
-                       goto ERROR;
-
-               // Import attributes
-               r = pakfire_file_copy_archive_entry(file, entry);
-               if (r)
-                       goto ERROR;
-
-               // Append it to the filelist
-               r = pakfire_filelist_append(extractor->filelist, file);
-               if (r)
-                       goto ERROR;
-       }
-
        // Fetch the paths
        const char* path = archive_entry_pathname(entry);
 
@@ -929,7 +910,7 @@ static int pakfire_archive_extract_entry(PakfireArchive archive,
        if (extractor->path && *extractor->path) {
                r = pakfire_path_join(buffer, extractor->path, path);
                if (r < 0)
-                       goto ERROR;
+                       return r;
 
                archive_entry_set_pathname(entry, buffer);
 
@@ -938,7 +919,7 @@ static int pakfire_archive_extract_entry(PakfireArchive archive,
                if (link) {
                        r = pakfire_path_join(buffer, extractor->path, link);
                        if (r < 0)
-                               goto ERROR;
+                               return r;
 
                        archive_entry_set_hardlink(entry, buffer);
                }
@@ -961,14 +942,10 @@ static int pakfire_archive_extract_entry(PakfireArchive archive,
                case ARCHIVE_FATAL:
                        ERROR(archive->pakfire, "Could not extract file %s: %s\n",
                                path, archive_error_string(extractor->writer));
-                       goto ERROR;
+                       return 1;
        }
 
-ERROR:
-       if (file)
-               pakfire_file_unref(file);
-
-       return r;
+       return 0;
 }
 
 PAKFIRE_EXPORT int pakfire_archive_extract(PakfireArchive archive, const char* prefix) {
@@ -985,13 +962,6 @@ PAKFIRE_EXPORT int pakfire_archive_extract(PakfireArchive archive, const char* p
 
        DEBUG(archive->pakfire, "Extracting %s to %s\n", archive->path, path);
 
-       // Create a filelist
-       if (!archive->filelist) {
-               r = pakfire_filelist_create(&archive->filelist, archive->pakfire);
-               if (r)
-                       goto ERROR;
-       }
-
        // Create a progressbar
        r = pakfire_archive_extract_progressbar(archive, &progressbar);
        if (r)
@@ -1010,7 +980,6 @@ PAKFIRE_EXPORT int pakfire_archive_extract(PakfireArchive archive, const char* p
        struct pakfire_archive_extractor extractor = {
                .writer      = writer,
                .path        = path,
-               .filelist    = archive->filelist,
                .progressbar = progressbar,
        };
 
@@ -1028,12 +997,6 @@ ERROR:
        if (progressbar)
                pakfire_progressbar_finish(progressbar);
 
-       // Destroy the filelist on error
-       if (r) {
-               pakfire_filelist_unref(archive->filelist);
-               archive->filelist = NULL;
-       }
-
        if (progressbar)
                pakfire_progressbar_unref(progressbar);
        if (writer)