diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-08-10 17:46:49 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-08-14 15:09:11 +0200 |
commit | 65886ff172190648c1114a9953c154f3f4821119 (patch) | |
tree | 17bd97db9fd30d58d8ea5864f66734dae98510a7 /src | |
parent | 149b74e00eb0937231087251d7644be0aa478929 (diff) | |
download | justbuild-65886ff172190648c1114a9953c154f3f4821119.tar.gz |
ArchiveOps: Add handling of 7zip archives
Also updates the archive usage tests accordingly.
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/utils/archive_ops.cpp | 14 | ||||
-rw-r--r-- | src/other_tools/utils/archive_ops.hpp | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/other_tools/utils/archive_ops.cpp b/src/other_tools/utils/archive_ops.cpp index dd291036..a0804abc 100644 --- a/src/other_tools/utils/archive_ops.cpp +++ b/src/other_tools/utils/archive_ops.cpp @@ -71,7 +71,7 @@ auto enable_write_filter(archive* aw, ArchiveType type) -> bool { auto enable_read_filter(archive* ar, ArchiveType type) -> bool { switch (type) { case ArchiveType::Tar: - return true; // no compression filter + return true; // no outside compression filter case ArchiveType::TarGz: return (archive_read_support_filter_gzip(ar) == ARCHIVE_OK); case ArchiveType::TarBz2: @@ -142,6 +142,12 @@ auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type) std::string(archive_error_string(aw)); } } break; + case ArchiveType::_7Zip: { + if (archive_write_set_format_7zip(aw) != ARCHIVE_OK) { + return std::string("ArchiveOps: ") + + std::string(archive_error_string(aw)); + } + } break; case ArchiveType::Tar: case ArchiveType::TarGz: case ArchiveType::TarBz2: @@ -170,6 +176,12 @@ auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type) std::string(archive_error_string(ar)); } } break; + case ArchiveType::_7Zip: { + if (archive_read_support_format_7zip(ar) != ARCHIVE_OK) { + return std::string("ArchiveOps: ") + + std::string(archive_error_string(ar)); + } + } break; case ArchiveType::TarAuto: case ArchiveType::Tar: case ArchiveType::TarGz: diff --git a/src/other_tools/utils/archive_ops.hpp b/src/other_tools/utils/archive_ops.hpp index 91595867..94013f30 100644 --- a/src/other_tools/utils/archive_ops.hpp +++ b/src/other_tools/utils/archive_ops.hpp @@ -27,13 +27,14 @@ using archive_entry = struct archive_entry; enum class ArchiveType : size_t { Zip, + _7Zip, Tar, // uncompressed TarGz, TarBz2, TarXz, TarLz, TarLzma, - TarAuto, // autodetect tarball-type archives + TarAuto // autodetect tarball-type archives }; /// \brief Class handling archiving and unarchiving operations via libarchive |