From a9f02505f780e84c0c99770682c5e3db94c3a0a1 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Wed, 10 Mar 2021 12:04:38 +0200 Subject: CLI: improvements to 'search' and 'install' command output Previously subcomponents of a virtual component were shown on search results, and trying to install these would print a bit vague message: 'Component not found'. As the sub-branches of virtual component nodes are hidden on GUI, we should also hide them when using CLI search, and give a more appropriate error message why the component cannot be explicitly selected for installation, if the user still tries to do so. Also some minor refactoring to the handling of supplemental information about binary type of the running installer/mt. This change does not fix the possible case of an install script changing the 'virtual'-state of a component, as it would require downloading and evaluating the full metadata for repositories (or components), which would impose a performance penalty to search. Task-number: QTIFW-2168 Change-Id: Ibacaca23c38f5ea98967955d91849cefc1f11f61 Reviewed-by: Katja Marttila --- .../cliinterface/data/repository/Updates.xml | 21 +++++++++++++++++++++ .../uninstallableComponentsRepository/Updates.xml | 10 ++++++++++ .../installer/cliinterface/tst_cliinterface.cpp | 16 +++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/installer/cliinterface/data/repository/Updates.xml b/tests/auto/installer/cliinterface/data/repository/Updates.xml index c7b11dc03..e5bc4f8af 100644 --- a/tests/auto/installer/cliinterface/data/repository/Updates.xml +++ b/tests/auto/installer/cliinterface/data/repository/Updates.xml @@ -34,6 +34,27 @@ content.7z 5b3939da1af492382c68388fc796837e4c36b876 + + + C.virt + Virtual subcomponent of C + Example virtual component + 1.0.0-1 + 2015-01-01 + true + + content.7z + 5b3939da1af492382c68388fc796837e4c36b876 + + + C.virt.subcomponent + Subcomponent of virtual component + Example subcomponent of virtual component + 1.0.0-1 + 2015-01-01 + + content.7z + 5b3939da1af492382c68388fc796837e4c36b876 AB diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml index e0aedffdd..f0c724db8 100644 --- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml +++ b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml @@ -37,4 +37,14 @@ cfa136fa1d7a4196896c90af72d510727ba799ae true + + B.subcomponent + Subcomponent of B + Example non-virtual subcomponent of B + 2.0.0 + 2015-01-01 + + content.7z + cfa136fa1d7a4196896c90af72d510727ba799ae + diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp index 550f45da2..98ea99133 100644 --- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp +++ b/tests/auto/installer/cliinterface/tst_cliinterface.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2020 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. @@ -89,6 +89,15 @@ private slots: " \n" "\n"); core->listAvailablePackages(QLatin1String("^C")); + + // Need to change rules here to catch messages + QLoggingCategory::setFilterRules("ifw.* = true\n"); + + QTest::ignoreMessage(QtDebugMsg, "No matching packages found."); + core->listAvailablePackages(QLatin1String("C.virt")); + + QTest::ignoreMessage(QtDebugMsg, "No matching packages found."); + core->listAvailablePackages(QLatin1String("C.virt.subcomponent")); } void testInstallPackageFails() @@ -116,6 +125,11 @@ private slots: QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList() << QLatin1String("B"))); + QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download..."); + QTest::ignoreMessage(QtDebugMsg, "Cannot install B.subcomponent. Component is descendant of a virtual component B.\n"); + QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList() + << QLatin1String("B.subcomponent"))); + QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download..."); QTest::ignoreMessage(QtDebugMsg, "Cannot install MissingComponent. Component not found.\n"); QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList() -- cgit v1.2.3