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/other_tools/utils/archive_ops.cpp | |
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/other_tools/utils/archive_ops.cpp')
-rw-r--r-- | src/other_tools/utils/archive_ops.cpp | 14 |
1 files changed, 13 insertions, 1 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: |