summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-11-16 11:45:41 +0200
committerKatja Marttila <katja.marttila@qt.io>2020-11-25 12:02:39 +0200
commitf053b9a627921b03529b4f797a97b582675fbe71 (patch)
tree1b7d42edbf7c22bfdf3eca3938fd27eee3414be5 /src
parent79011733f7a00da988d482dde443418c9df38784 (diff)
Print package information in xml format
Also removed logging categories for package information, the full package information can be printed by increasing the verbosity level. Task-number: QTIFW-1950 Change-Id: I4bce019a63ba1fbf48e3bb0ca45511e42d4974c9 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/globals.cpp192
-rw-r--r--src/libs/installer/globals.h24
-rw-r--r--src/libs/installer/init.cpp7
-rw-r--r--src/libs/installer/installer.pro6
-rw-r--r--src/libs/installer/packagemanagercore.cpp20
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp45
-rw-r--r--src/libs/installer/packagemanagercore_p.h4
-rw-r--r--src/libs/installer/printoutput.cpp122
-rw-r--r--src/libs/installer/printoutput.h42
-rw-r--r--src/sdk/commandlineinterface.cpp22
-rw-r--r--src/sdk/sdkapp.h9
11 files changed, 198 insertions, 295 deletions
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp
index 66de2fec6..0da4bc3b6 100644
--- a/src/libs/installer/globals.cpp
+++ b/src/libs/installer/globals.cpp
@@ -31,32 +31,9 @@
#include "globals.h"
const char IFW_SERVER[] = "ifw.server";
-
-const char IFW_PACKAGE_DISPLAYNAME[] = "ifw.package.displayname";
-const char IFW_PACKAGE_DESCRIPTION[] = "ifw.package.description";
-const char IFW_PACKAGE_VERSION[] = "ifw.package.version";
-const char IFW_PACKAGE_INSTALLEDVERSION[] = "ifw.package.installedversion";
-const char IFW_PACKAGE_RELEASEDATE[] = "ifw.package.releasedate";
-const char IFW_PACKAGE_INSTALLDATE[] = "ifw.package.installdate";
-const char IFW_PACKAGE_UPDATEDATE[] = "ifw.package.updatedate";
-const char IFW_PACKAGE_NAME[] = "ifw.package.name";
-const char IFW_PACKAGE_DEPENDENCIES[] = "ifw.package.dependencies";
-const char IFW_PACKAGE_AUTODEPENDON[] = "ifw.package.autodependon";
-const char IFW_PACKAGE_VIRTUAL[] = "ifw.package.virtual";
-const char IFW_PACKAGE_SORTINGPRIORITY[] = "ifw.package.sortingpriority";
-const char IFW_PACKAGE_SCRIPT[] = "ifw.package.script";
-const char IFW_PACKAGE_DEFAULT[] = "ifw.package.default";
-const char IFW_PACKAGE_ESSETIAL[] = "ifw.package.essential";
-const char IFW_PACKAGE_FORCEDINSTALLATION[] = "ifw.package.forcedinstallation";
-const char IFW_PACKAGE_REPLACES[] = "ifw.package.replaces";
-const char IFW_PACKAGE_DOWNLOADABLEARCHIVES[] = "ifw.package.downloadablearchives";
-const char IFW_PACKAGE_REQUIRESADMINRIGHTS[] = "ifw.package.requiresadminrights";
-const char IFW_PACKAGE_CHECKABLE[] = "ifw.package.checkable";
-const char IFW_PACKAGE_LICENSES[] = "ifw.package.licenses";
-const char IFW_PACKAGE_COMPRESSEDSIZE[] = "ifw.package.compressedsize";
-const char IFW_PACKAGE_UNCOMPRESSEDSIZE[] = "ifw.package.uncompressedsize";
const char IFW_INSTALLER_INSTALLLOG[] = "ifw.installer.installlog";
const char IFW_DEVELOPER_BUILD[] = "ifw.developer.build";
+const char IFW_PACKAGE_INFO[] = "ifw.package.info";
// Internal-only, hidden in --help text
const char IFW_PROGRESS_INDICATOR[] = "ifw.progress.indicator";
@@ -70,164 +47,30 @@ namespace QInstaller
*/
/*!
- \fn QInstaller::lcPackageDisplayname()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageDescription()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageVersion()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageInstalledVersion()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageReleasedate()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageInstallDate()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageUpdateDate()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageName()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageDependencies()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageAutodependon()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageVirtual()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageSortingpriority()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageScript()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageDefault()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageEssential()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageForcedinstallation()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageReplaces()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageDownloadableArchives()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageRequiresAdminRights()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageCheckable()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageLicenses()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageUncompressedSize()
- \internal
-*/
-
-/*!
- \fn QInstaller::lcPackageCompressedSize()
+ \fn QInstaller::lcInstallerInstallLog()
\internal
*/
/*!
- \fn QInstaller::lcInstallerInstallLog()
+ \fn QInstaller::lcProgressIndicator()
\internal
*/
/*!
- \fn QInstaller::lcProgressIndicator()
+ \fn QInstaller::lcDeveloperBuild()
\internal
*/
/*!
- \fn QInstaller::lcDeveloperBuild()
+ \fn QInstaller::lcPackageInfo()
\internal
*/
Q_LOGGING_CATEGORY(lcServer, IFW_SERVER)
-
-Q_LOGGING_CATEGORY(lcPackageDisplayname, IFW_PACKAGE_DISPLAYNAME);
-Q_LOGGING_CATEGORY(lcPackageDescription, IFW_PACKAGE_DESCRIPTION)
-Q_LOGGING_CATEGORY(lcPackageVersion, IFW_PACKAGE_VERSION)
-Q_LOGGING_CATEGORY(lcPackageInstalledVersion, IFW_PACKAGE_INSTALLEDVERSION)
-Q_LOGGING_CATEGORY(lcPackageReleasedate, IFW_PACKAGE_RELEASEDATE)
-Q_LOGGING_CATEGORY(lcPackageInstallDate, IFW_PACKAGE_INSTALLDATE)
-Q_LOGGING_CATEGORY(lcPackageUpdateDate, IFW_PACKAGE_UPDATEDATE)
-Q_LOGGING_CATEGORY(lcPackageName, IFW_PACKAGE_NAME)
-Q_LOGGING_CATEGORY(lcPackageDependencies, IFW_PACKAGE_DEPENDENCIES)
-Q_LOGGING_CATEGORY(lcPackageAutodependon, IFW_PACKAGE_AUTODEPENDON)
-Q_LOGGING_CATEGORY(lcPackageVirtual, IFW_PACKAGE_VIRTUAL)
-Q_LOGGING_CATEGORY(lcPackageSortingpriority, IFW_PACKAGE_SORTINGPRIORITY)
-Q_LOGGING_CATEGORY(lcPackageScript, IFW_PACKAGE_SCRIPT)
-Q_LOGGING_CATEGORY(lcPackageDefault, IFW_PACKAGE_DEFAULT)
-Q_LOGGING_CATEGORY(lcPackageEssential, IFW_PACKAGE_ESSETIAL)
-Q_LOGGING_CATEGORY(lcPackageForcedinstallation, IFW_PACKAGE_FORCEDINSTALLATION)
-Q_LOGGING_CATEGORY(lcPackageReplaces, IFW_PACKAGE_REPLACES)
-Q_LOGGING_CATEGORY(lcPackageDownloadableArchives, IFW_PACKAGE_DOWNLOADABLEARCHIVES)
-Q_LOGGING_CATEGORY(lcPackageRequiresAdminRights, IFW_PACKAGE_REQUIRESADMINRIGHTS)
-Q_LOGGING_CATEGORY(lcPackageCheckable, IFW_PACKAGE_CHECKABLE)
-Q_LOGGING_CATEGORY(lcPackageLicenses, IFW_PACKAGE_LICENSES)
-Q_LOGGING_CATEGORY(lcPackageUncompressedSize, IFW_PACKAGE_UNCOMPRESSEDSIZE)
-Q_LOGGING_CATEGORY(lcPackageCompressedSize, IFW_PACKAGE_COMPRESSEDSIZE)
Q_LOGGING_CATEGORY(lcInstallerInstallLog, IFW_INSTALLER_INSTALLLOG)
Q_LOGGING_CATEGORY(lcProgressIndicator, IFW_PROGRESS_INDICATOR)
-
Q_LOGGING_CATEGORY(lcDeveloperBuild, IFW_DEVELOPER_BUILD)
+Q_LOGGING_CATEGORY(lcPackageInfo, IFW_PACKAGE_INFO)
/*!
Returns available logging categories.
@@ -235,29 +78,6 @@ Q_LOGGING_CATEGORY(lcDeveloperBuild, IFW_DEVELOPER_BUILD)
QStringList loggingCategories()
{
static QStringList categories = QStringList()
- << QLatin1String(IFW_PACKAGE_DISPLAYNAME)
- << QLatin1String(IFW_PACKAGE_DESCRIPTION)
- << QLatin1String(IFW_PACKAGE_VERSION)
- << QLatin1String(IFW_PACKAGE_INSTALLEDVERSION)
- << QLatin1String(IFW_PACKAGE_RELEASEDATE)
- << QLatin1String(IFW_PACKAGE_INSTALLDATE)
- << QLatin1String(IFW_PACKAGE_UPDATEDATE)
- << QLatin1String(IFW_PACKAGE_NAME)
- << QLatin1String(IFW_PACKAGE_DEPENDENCIES)
- << QLatin1String(IFW_PACKAGE_AUTODEPENDON)
- << QLatin1String(IFW_PACKAGE_VIRTUAL)
- << QLatin1String(IFW_PACKAGE_SORTINGPRIORITY)
- << QLatin1String(IFW_PACKAGE_SCRIPT)
- << QLatin1String(IFW_PACKAGE_DEFAULT)
- << QLatin1String(IFW_PACKAGE_ESSETIAL)
- << QLatin1String(IFW_PACKAGE_FORCEDINSTALLATION)
- << QLatin1String(IFW_PACKAGE_REPLACES)
- << QLatin1String(IFW_PACKAGE_DOWNLOADABLEARCHIVES)
- << QLatin1String(IFW_PACKAGE_REQUIRESADMINRIGHTS)
- << QLatin1String(IFW_PACKAGE_CHECKABLE)
- << QLatin1String(IFW_PACKAGE_LICENSES)
- << QLatin1String(IFW_PACKAGE_UNCOMPRESSEDSIZE)
- << QLatin1String(IFW_PACKAGE_COMPRESSEDSIZE)
<< QLatin1String(IFW_INSTALLER_INSTALLLOG)
<< QLatin1String(IFW_SERVER);
return categories;
diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h
index c7608ca15..5053f6d9f 100644
--- a/src/libs/installer/globals.h
+++ b/src/libs/installer/globals.h
@@ -38,31 +38,9 @@ namespace QInstaller {
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcServer)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcInstallerInstallLog)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDisplayname)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDescription)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageVersion)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageInstalledVersion)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageReleasedate)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageInstallDate)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageUpdateDate)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageName)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDependencies)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageAutodependon)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageVirtual)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageSortingpriority)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageScript)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDefault)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageEssential)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageForcedinstallation)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageReplaces)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageDownloadableArchives)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageRequiresAdminRights)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageCheckable)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageLicenses)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageUncompressedSize)
-INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageCompressedSize)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcProgressIndicator)
INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcDeveloperBuild)
+INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcPackageInfo)
QStringList INSTALLER_EXPORT loggingCategories();
diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp
index ea6f75e1b..c1326824a 100644
--- a/src/libs/installer/init.cpp
+++ b/src/libs/installer/init.cpp
@@ -129,8 +129,11 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
static Uptime uptime;
- QString ba = QLatin1Char('[') + QString::number(uptime.elapsed()) + QStringLiteral("] ")
- + trimAndPrepend(type, msg);
+ QString ba;
+ if (context.category != lcPackageInfo().categoryName()) {
+ ba = QLatin1Char('[') + QString::number(uptime.elapsed()) + QStringLiteral("] ");
+ }
+ ba += trimAndPrepend(type, msg);
if (type != QtDebugMsg && context.file) {
ba += QString(QStringLiteral(" (%1:%2, %3)")).arg(
diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro
index 225b1c8d1..d1e21bb63 100644
--- a/src/libs/installer/installer.pro
+++ b/src/libs/installer/installer.pro
@@ -137,7 +137,8 @@ HEADERS += packagemanagercore.h \
repositorycategory.h \
componentselectionpage_p.h \
commandlineparser.h \
- commandlineparser_p.h
+ commandlineparser_p.h \
+ printoutput.h
SOURCES += packagemanagercore.cpp \
aspectratiolabel.cpp \
@@ -216,7 +217,8 @@ SOURCES += packagemanagercore.cpp \
packagesource.cpp \
repositorycategory.cpp \
componentselectionpage_p.cpp \
- commandlineparser.cpp
+ commandlineparser.cpp \
+ printoutput.cpp
FORMS += proxycredentialsdialog.ui \
serverauthenticationdialog.ui
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index a921884b2..e4b0e1689 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -45,6 +45,7 @@
#include "settings.h"
#include "installercalculator.h"
#include "uninstallercalculator.h"
+#include "printoutput.h"
#include <productkeycheck.h>
@@ -2195,17 +2196,18 @@ void PackageManagerCore::listAvailablePackages(const QString &regexp)
QRegularExpression re(regexp);
const PackagesList &packages = d->remotePackages();
- bool foundMatch = false;
- foreach (const Package *update, packages) {
- const QString name = update->data(scName).toString();
+ PackagesList matchedPackages;
+ foreach (Package *package, packages) {
+ const QString name = package->data(scName).toString();
if (re.match(name).hasMatch() &&
- (virtualComponentsVisible() ? true : !update->data(scVirtual, false).toBool())) {
- d->printPackageInformation(name, update);
- foundMatch = true;
+ (virtualComponentsVisible() ? true : !package->data(scVirtual, false).toBool())) {
+ matchedPackages.append(package);
}
}
- if (!foundMatch)
+ if (matchedPackages.count() == 0)
qCDebug(QInstaller::lcInstallerInstallLog) << "No matching packages found.";
+ else
+ QInstaller::printPackageInformation(matchedPackages, localInstalledPackages());
}
bool PackageManagerCore::componentUninstallableFromCommandLine(const QString &componentName)
@@ -2254,11 +2256,13 @@ void PackageManagerCore::listInstalledPackages(const QString &regexp)
const QRegularExpression re(regexp);
const QStringList &keys = installedPackages.keys();
+ QList<LocalPackage> packages;
foreach (const QString &key, keys) {
KDUpdater::LocalPackage package = installedPackages.value(key);
if (re.match(package.name).hasMatch())
- d->printLocalPackageInformation(package);
+ packages.append(package);
}
+ QInstaller::printLocalPackageInformation(packages);
}
/*!
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index edc2d6fca..79e07a9f9 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2655,51 +2655,6 @@ bool PackageManagerCorePrivate::askUserAcceptLicense(const QString &name, const
}
}
-void PackageManagerCorePrivate::printPackageInformation(const QString &name, const Package *update)
-{
- qCDebug(QInstaller::lcPackageName).noquote() << "Id:" << name;
- qCDebug(QInstaller::lcPackageDisplayname).noquote() << "\tDisplay name:" << update->data(scDisplayName).toString();
- qCDebug(QInstaller::lcPackageVersion).noquote() << "\tVersion:" << update->data(scVersion).toString();
- qCDebug(QInstaller::lcPackageDescription).noquote() << "\tDescription:" << update->data(scDescription).toString();
- qCDebug(QInstaller::lcPackageReleasedate).noquote() << "\tRelease date:" << update->data(scReleaseDate).toString();
- qCDebug(QInstaller::lcPackageDependencies).noquote() << "\tDependencies:" << update->data(scDependencies).toString();
- qCDebug(QInstaller::lcPackageAutodependon).noquote() << "\tAutodependon:" << update->data(scAutoDependOn).toString();
- qCDebug(QInstaller::lcPackageVirtual).noquote() << "\tVirtual:" << update->data(scVirtual, false).toString();
- qCDebug(QInstaller::lcPackageSortingpriority).noquote() << "\tSorting priority:" << update->data(scSortingPriority).toString();
- qCDebug(QInstaller::lcPackageScript).noquote() << "\tScript:" << update->data(scScript).toString();
- qCDebug(QInstaller::lcPackageDefault).noquote() << "\tDefault:"<< update->data(scDefault, false).toString();
- qCDebug(QInstaller::lcPackageEssential).noquote() << "\tEssential:" << update->data(scEssential, false).toString();
- qCDebug(QInstaller::lcPackageForcedinstallation).noquote() << "\tForced installation:" << update->data(QLatin1String("ForcedInstallation"), false).toString();
- qCDebug(QInstaller::lcPackageReplaces).noquote() << "\tReplaces:" << update->data(scReplaces).toString();
- qCDebug(QInstaller::lcPackageDownloadableArchives).noquote() << "\tDownloadable archives:" << update->data(scDownloadableArchives).toString();
- qCDebug(QInstaller::lcPackageRequiresAdminRights).noquote() << "\tRequires admin rights:" << update->data(scRequiresAdminRights).toString();
- qCDebug(QInstaller::lcPackageCheckable).noquote() << "\tCheckable:" << update->data(scCheckable).toString();
- qCDebug(QInstaller::lcPackageLicenses).noquote() << "\tLicenses:" << update->data(QLatin1String("Licenses")).toString();
- qCDebug(QInstaller::lcPackageCompressedSize).noquote() << "\tCompressed size:" << update->data(QLatin1String("CompressedSize")).toString();
- qCDebug(QInstaller::lcPackageUncompressedSize).noquote() << "\tUncompressed size:" << update->data(QLatin1String("UncompressedSize")).toString();
-
- //Check if package already installed
- LocalPackagesHash installedPackages = this->localInstalledPackages();
- if (installedPackages.contains(name))
- qCDebug(QInstaller::lcPackageInstalledVersion).noquote() << "\tInstalled version:" << installedPackages.value(name).version;
-}
-
-void PackageManagerCorePrivate::printLocalPackageInformation(const KDUpdater::LocalPackage package) const
-{
- qCDebug(QInstaller::lcPackageName).noquote() << "Id:" << package.name;
- qCDebug(QInstaller::lcPackageDisplayname).noquote() << "\tDisplay name:" << package.title;
- qCDebug(QInstaller::lcPackageVersion).noquote() << "\tVersion:" << package.version;
- qCDebug(QInstaller::lcPackageDescription).noquote() << "\tDescription:" << package.description;
- qCDebug(QInstaller::lcPackageDependencies).noquote() << "\tDependencies:" << package.dependencies;
- qCDebug(QInstaller::lcPackageAutodependon).noquote() << "\tAutodependon:" << package.autoDependencies;
- qCDebug(QInstaller::lcPackageVirtual).noquote() << "\tVirtual:" << package.virtualComp;
- qCDebug(QInstaller::lcPackageForcedinstallation).noquote() << "\tForced installation:" << package.forcedInstallation;
- qCDebug(QInstaller::lcPackageCheckable).noquote() << "\tCheckable:" << package.checkable;
- qCDebug(QInstaller::lcPackageUncompressedSize).noquote() << "\tUncompressed size:" << package.uncompressedSize;
- qCDebug(QInstaller::lcPackageInstallDate).noquote() << "\tInstalled:" << package.installDate;
- qCDebug(QInstaller::lcPackageUpdateDate).noquote() << "\tLast updated:" << package.lastUpdateDate;
-}
-
bool PackageManagerCorePrivate::askUserConfirmCommand() const
{
qCDebug(QInstaller::lcInstallerInstallLog) << "Do you want to continue?";
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index 09a26a9de..8b24cf2d0 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -251,8 +251,6 @@ private:
bool acceptLicenseAgreements() const;
bool askUserAcceptLicense(const QString &name, const QString &content) const;
bool askUserConfirmCommand() const;
- void printPackageInformation(const QString &name, const Package *update);
- void printLocalPackageInformation(const KDUpdater::LocalPackage package) const;
private:
PackageManagerCore *m_core;
diff --git a/src/libs/installer/printoutput.cpp b/src/libs/installer/printoutput.cpp
new file mode 100644
index 000000000..1759d6642
--- /dev/null
+++ b/src/libs/installer/printoutput.cpp
@@ -0,0 +1,122 @@
+/**************************************************************************
+**
+** Copyright (C) 2020 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 "printoutput.h"
+
+#include "component.h"
+#include "localpackagehub.h"
+#include "globals.h"
+
+#include <iostream>
+#include <QDomDocument>
+
+namespace QInstaller
+{
+
+void printComponentInfo(const QList<Component *> components)
+{
+ QDomDocument doc;
+ QDomElement root = doc.createElement(QLatin1String("updates"));
+ doc.appendChild(root);
+
+ foreach (Component *component, components) {
+ QDomElement update = doc.createElement(QLatin1String("update"));
+ update.setAttribute(QLatin1String("name"), component->value(scDisplayName));
+ update.setAttribute(QLatin1String("version"), component->value(scVersion));
+ update.setAttribute(QLatin1String("size"), component->value(scUncompressedSize));
+ update.setAttribute(QLatin1String("id"), component->value(scName));
+ root.appendChild(update);
+ }
+ qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+}
+
+void printLocalPackageInformation(const QList<KDUpdater::LocalPackage> &packages)
+{
+ QDomDocument doc;
+ QDomElement root = doc.createElement(QLatin1String("localpackages"));
+ doc.appendChild(root);
+ foreach (KDUpdater::LocalPackage package, packages) {
+ QDomElement update = doc.createElement(QLatin1String("package"));
+ update.setAttribute(QLatin1String("name"), package.name);
+ update.setAttribute(QLatin1String("displayname"), package.title);
+ update.setAttribute(QLatin1String("version"), package.version);
+ if (verboseLevel() == VerbosityLevel::Detailed) {
+ update.setAttribute(QLatin1String("description"), package.description);
+ update.setAttribute(QLatin1String("dependencies"), package.dependencies.join(QLatin1Char(',')));
+ update.setAttribute(QLatin1String("autoDependencies"), package.autoDependencies.join(QLatin1Char(',')));
+ update.setAttribute(QLatin1String("virtual"), package.virtualComp);
+ update.setAttribute(QLatin1String("forcedInstallation"), package.forcedInstallation);
+ update.setAttribute(QLatin1String("checkable"), package.checkable);
+ update.setAttribute(QLatin1String("uncompressedSize"), package.uncompressedSize);
+ update.setAttribute(QLatin1String("installDate"), package.installDate.toString());
+ update.setAttribute(QLatin1String("lastUpdateDate"), package.lastUpdateDate.toString());
+ }
+ root.appendChild(update);
+ }
+ qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+}
+
+void printPackageInformation(const PackagesList &matchedPackages, const LocalPackagesHash &installedPackages)
+{
+ QDomDocument doc;
+ QDomElement root = doc.createElement(QLatin1String("availablepackages"));
+ doc.appendChild(root);
+ foreach (Package *package, matchedPackages) {
+ const QString name = package->data(scName).toString();
+ QDomElement update = doc.createElement(QLatin1String("package"));
+ update.setAttribute(QLatin1String("name"), name);
+ update.setAttribute(QLatin1String("displayname"), package->data(scDisplayName).toString());
+ update.setAttribute(QLatin1String("version"), package->data(scVersion).toString());
+ //Check if package already installed
+ if (installedPackages.contains(name))
+ update.setAttribute(QLatin1String("installedVersion"), installedPackages.value(name).version);
+ if (verboseLevel() == VerbosityLevel::Detailed) {
+ update.setAttribute(QLatin1String("description"), package->data(scDescription).toString());
+ update.setAttribute(QLatin1String("dependencies"), package->data(scDependencies).toString());
+ update.setAttribute(QLatin1String("autoDependencies"), package->data(scAutoDependOn).toString());
+ update.setAttribute(QLatin1String("virtual"), package->data(scVirtual).toString());
+ update.setAttribute(QLatin1String("forcedInstallation"), package->data(QLatin1String("ForcedInstallation")).toString());
+ update.setAttribute(QLatin1String("checkable"), package->data(scCheckable).toString());
+ update.setAttribute(QLatin1String("default"), package->data(scDefault).toString());
+ update.setAttribute(QLatin1String("essential"), package->data(scEssential).toString());
+ update.setAttribute(QLatin1String("compressedsize"), package->data(QLatin1String("CompressedSize")).toString());
+ update.setAttribute(QLatin1String("uncompressedsize"), package->data(QLatin1String("UncompressedSize")).toString());
+ update.setAttribute(QLatin1String("releaseDate"), package->data(scReleaseDate).toString());
+ update.setAttribute(QLatin1String("downloadableArchives"), package->data(scDownloadableArchives).toString());
+ update.setAttribute(QLatin1String("licenses"), package->data(QLatin1String("Licenses")).toString());
+ update.setAttribute(QLatin1String("script"), package->data(scScript).toString());
+ update.setAttribute(QLatin1String("sortingPriority"), package->data(scSortingPriority).toString());
+ update.setAttribute(QLatin1String("replaces"), package->data(scReplaces).toString());
+ update.setAttribute(QLatin1String("requiresAdminRights"), package->data(scRequiresAdminRights).toString());
+ }
+ root.appendChild(update);
+ }
+ qCDebug(lcPackageInfo) << qPrintable(doc.toString(4));
+}
+} // namespace QInstaller
+
diff --git a/src/libs/installer/printoutput.h b/src/libs/installer/printoutput.h
new file mode 100644
index 000000000..b1767830a
--- /dev/null
+++ b/src/libs/installer/printoutput.h
@@ -0,0 +1,42 @@
+/**************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+**************************************************************************/
+
+#ifndef PRINTOUTPUT_H
+#define PRINTOUTPUT_H
+
+#include "component.h"
+
+#include <QObject>
+
+namespace QInstaller {
+ void INSTALLER_EXPORT printComponentInfo(const QList<Component *> components);
+ void INSTALLER_EXPORT printLocalPackageInformation(const QList<KDUpdater::LocalPackage> &packages);
+ void INSTALLER_EXPORT printPackageInformation(const PackagesList &matchedPackages, const LocalPackagesHash &installedPackages);
+}
+
+#endif // PRINTOUTPUT_H
diff --git a/src/sdk/commandlineinterface.cpp b/src/sdk/commandlineinterface.cpp
index 962eab7c0..f522f7df6 100644
--- a/src/sdk/commandlineinterface.cpp
+++ b/src/sdk/commandlineinterface.cpp
@@ -34,11 +34,9 @@
#include <globals.h>
#include <productkeycheck.h>
#include <errors.h>
+#include <printoutput.h>
#include <QDir>
-#include <QDomDocument>
-
-#include <iostream>
CommandLineInterface::CommandLineInterface(int &argc, char *argv[])
: SDKApp<QCoreApplication>(argc, argv)
@@ -103,21 +101,7 @@ int CommandLineInterface::checkUpdates()
qCWarning(QInstaller::lcInstallerInstallLog) << "There are currently no updates available.";
return EXIT_SUCCESS;
}
-
- QDomDocument doc;
- QDomElement root = doc.createElement(QLatin1String("updates"));
- doc.appendChild(root);
-
- foreach (QInstaller::Component *component, components) {
- QDomElement update = doc.createElement(QLatin1String("update"));
- update.setAttribute(QLatin1String("name"), component->value(QInstaller::scDisplayName));
- update.setAttribute(QLatin1String("version"), component->value(QInstaller::scVersion));
- update.setAttribute(QLatin1String("size"), component->value(QInstaller::scUncompressedSize));
- update.setAttribute(QLatin1String("id"), component->value(QInstaller::scName));
- root.appendChild(update);
- }
-
- std::cout << qPrintable(doc.toString(4)) << std::endl;
+ QInstaller::printComponentInfo(components);
return EXIT_SUCCESS;
}
@@ -230,7 +214,7 @@ bool CommandLineInterface::checkLicense()
{
const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance();
if (!productKeyCheck->hasValidLicense()) {
- qCWarning(QInstaller::lcPackageLicenses) << "No valid license found.";
+ qCWarning(QInstaller::lcInstallerInstallLog) << "No valid license found.";
return false;
}
return true;
diff --git a/src/sdk/sdkapp.h b/src/sdk/sdkapp.h
index 249714fea..295456e3b 100644
--- a/src/sdk/sdkapp.h
+++ b/src/sdk/sdkapp.h
@@ -159,17 +159,12 @@ public:
"ifw.installer.* = true\n"
"ifw.server = true\n"
"ifw.progress.indicator = true\n"
- "ifw.package.name = true\n"
- "ifw.package.version = true\n"
- "ifw.package.displayname = true\n");
+ "ifw.package.* = true\n");
} else {
// enable all except detailed package information and developer specific logging
loggingRules = QLatin1String("ifw.* = true\n"
"ifw.developer.build = false\n"
- "ifw.package.* = false\n"
- "ifw.package.name = true\n"
- "ifw.package.version = true\n"
- "ifw.package.displayname = true\n");
+ "ifw.package.* = true\n");
}
if (QInstaller::verboseLevel() == QInstaller::VerbosityLevel::Detailed) {