From 2767b0c96a0dbe713bc2d1e346d10f6787556d5b Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Mon, 30 Aug 2021 11:38:56 +0300 Subject: Fix qbsp adding from GUI Qbsp package adding failed using gui if the package with the same name existed in the component tree. Also increased priority to qbsp package so that if the same name and version exists in the component tree then qbsp package is used. Task-number: QTIFW-2312 Change-Id: I732fef1a7ba503d2332f411e15b6873c63dcf630 Reviewed-by: Arttu Tarkiainen --- .../compressedRepository/compressedRepository.7z | Bin 0 -> 542 bytes .../repository/data/repository/A/1.0.2content.7z | Bin 0 -> 165 bytes .../repository/data/repository/Updates.xml | 13 ++++++ tests/auto/installer/repository/repository.pro | 4 ++ tests/auto/installer/repository/settings.qrc | 7 +++ tests/auto/installer/repository/tst_repository.cpp | 49 +++++++++++++++++++++ 6 files changed, 73 insertions(+) create mode 100644 tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z create mode 100644 tests/auto/installer/repository/data/repository/A/1.0.2content.7z create mode 100644 tests/auto/installer/repository/data/repository/Updates.xml create mode 100644 tests/auto/installer/repository/settings.qrc (limited to 'tests') diff --git a/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z b/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z new file mode 100644 index 000000000..fa75f2979 Binary files /dev/null and b/tests/auto/installer/repository/data/compressedRepository/compressedRepository.7z differ diff --git a/tests/auto/installer/repository/data/repository/A/1.0.2content.7z b/tests/auto/installer/repository/data/repository/A/1.0.2content.7z new file mode 100644 index 000000000..5531e9072 Binary files /dev/null and b/tests/auto/installer/repository/data/repository/A/1.0.2content.7z differ diff --git a/tests/auto/installer/repository/data/repository/Updates.xml b/tests/auto/installer/repository/data/repository/Updates.xml new file mode 100644 index 000000000..6fdfec9e5 --- /dev/null +++ b/tests/auto/installer/repository/data/repository/Updates.xml @@ -0,0 +1,13 @@ + + {AnyApplication} + 1.0.0 + + A + A + Example component A + 1.0.2 + 2015-01-01 + true + content.7z + + diff --git a/tests/auto/installer/repository/repository.pro b/tests/auto/installer/repository/repository.pro index 2d192eeaa..39d8df034 100644 --- a/tests/auto/installer/repository/repository.pro +++ b/tests/auto/installer/repository/repository.pro @@ -4,3 +4,7 @@ QT += network QT -= gui SOURCES += tst_repository.cpp + +RESOURCES += \ + settings.qrc \ + ..\shared\config.qrc diff --git a/tests/auto/installer/repository/settings.qrc b/tests/auto/installer/repository/settings.qrc new file mode 100644 index 000000000..ff628b482 --- /dev/null +++ b/tests/auto/installer/repository/settings.qrc @@ -0,0 +1,7 @@ + + + data/repository/Updates.xml + data/repository/A/1.0.2content.7z + data/compressedRepository/compressedRepository.7z + + diff --git a/tests/auto/installer/repository/tst_repository.cpp b/tests/auto/installer/repository/tst_repository.cpp index 7b8405baf..db538ba5d 100644 --- a/tests/auto/installer/repository/tst_repository.cpp +++ b/tests/auto/installer/repository/tst_repository.cpp @@ -1,3 +1,34 @@ +/************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +#include "../shared/packagemanager.h" +#include "../shared/verifyinstaller.h" + #include "repository.h" #include "repositorycategory.h" #include "settings.h" @@ -161,6 +192,24 @@ private slots: update.insert(QLatin1String("replace"), qMakePair(nonMatching, replacement)); QVERIFY(settings.updateRepositoryCategories(update) == Settings::NoUpdatesApplied); } + + void testCompressedRepositoryWithPriority() + { + // Compressed repository has higher priority than normal repository. + // If the versions match, compressed repository is used instead of normal repository. + QString installDir = QInstaller::generateTemporaryFileName(); + QVERIFY(QDir().mkpath(installDir)); + + PackageManagerCore *core = PackageManager::getPackageManagerWithInit(installDir, ":///data/repository"); + core->setTemporaryRepositories(QStringList() + << ":///data/compressedRepository/compressedRepository.7z", false, true); + core->installSelectedComponentsSilently(QStringList() << "A"); + VerifyInstaller::verifyFileExistence(installDir, QStringList() << "components.xml" << "A_from_compressed.txt"); + + QDir dir(installDir); + QVERIFY(dir.removeRecursively()); + core->deleteLater(); + } }; QTEST_MAIN(tst_Repository) -- cgit v1.2.3