diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-03-02 12:21:18 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-09-14 14:25:18 +0300 |
commit | 50292e14683727e6da81799cedd4ee352c3e0497 (patch) | |
tree | aa4bce967dee16e69aafef653f3c3f9ba1849d6c /tests/auto | |
parent | 2076b1384754301ba409b6fe65551eaf55cce401 (diff) |
Add support for handling archive files with libarchive
libarchive is a multi-format archive and compression library
written in C and licensed under the new BSD license. Usage of
libarchive brings in support for additional archive formats
(in addition to 7z) with the installer framework, like zip and
tar, with several available compression methods like gzip, bzip2
and xz.
libarchive will coexist as a supported archive format handler
with the LZMA SDK currently used in the framework, which will
continue to be used for handling the 7-Zip file format.
This change introduces classes for handling archive operations
using both libraries, removes most calls to the old Lib7z facade
and migrates the code base to use the new handling methods.
Task-number: QTIFW-2255
Change-Id: I8d77110ded503060495a3d6fdfdbc26281df9453
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests/auto')
3 files changed, 9 insertions, 8 deletions
diff --git a/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp b/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp index baaf58da2..cbbc1a1c7 100644 --- a/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp +++ b/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp @@ -84,8 +84,7 @@ private slots: QVERIFY(op.undoOperation()); QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::UserDefinedError); - QCOMPARE(op.errorString(), QString("Error while extracting archive \":///data/invalid.7z\": " - "Cannot open archive \":///data/invalid.7z\".")); + QCOMPARE(op.errorString(), QString("Cannot open archive \":///data/invalid.7z\" for reading: ")); } void testExtractArchiveFromXML() diff --git a/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp b/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp index ffc5b330a..4175bdf40 100644 --- a/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp +++ b/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -46,7 +46,7 @@ private slots: Lib7z::initSevenZ(); m_file.path = "valid"; - m_file.permissions = 0; + m_file.permissions_enum = 0; m_file.compressedSize = 836; m_file.uncompressedSize = 5242880; m_file.isDirectory = false; diff --git a/tests/auto/tools/repotest/tst_repotest.cpp b/tests/auto/tools/repotest/tst_repotest.cpp index 02594f400..9b8df947a 100644 --- a/tests/auto/tools/repotest/tst_repotest.cpp +++ b/tests/auto/tools/repotest/tst_repotest.cpp @@ -30,6 +30,8 @@ #include <repositorygen.h> #include <repositorygen.cpp> #include <init.h> +#include <lib7z_facade.h> +#include <lib7zarchive.h> #include <QFile> #include <QTest> @@ -63,7 +65,7 @@ private: tmp.setAutoRemove(false); const QString tmpMetaDir = tmp.path(); QInstallerTools::createRepository(m_repoInfo, &m_packages, tmpMetaDir, createSplitMetadata, - createUnifiedMetadata); + createUnifiedMetadata, QLatin1String("7z")); QInstaller::removeDirectory(tmpMetaDir, true); } @@ -95,12 +97,12 @@ private: QString existingUniteMeta7z = QInstallerTools::existingUniteMeta7z(m_repoInfo.repositoryDir); QCOMPARE(2, matches.count()); QCOMPARE(existingUniteMeta7z, matches.at(1)); - QFile file(m_repoInfo.repositoryDir + QDir::separator() + matches.at(1)); + Lib7zArchive file(m_repoInfo.repositoryDir + QDir::separator() + matches.at(1)); QVERIFY(file.open(QIODevice::ReadOnly)); //We have script<version>.qs for package A in the unite metadata - QVector<Lib7z::File>::const_iterator fileIt; - const QVector<Lib7z::File> files = Lib7z::listArchive(&file); + QVector<ArchiveEntry>::const_iterator fileIt; + const QVector<ArchiveEntry> files = file.list(); for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) { if (fileIt->isDirectory) continue; |