summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-08-09 19:38:01 +0300
committerAndrew Knight <andrew.knight@digia.com>2013-08-20 08:41:45 +0200
commit4e81147d3776be8e6e452bc2768bdcdf96656297 (patch)
treeb136745876f75745b64c2ae7b6df402238547bdb
parent5700438067ae6ba6dcd7a5b6fa30face85805494 (diff)
windeployqt: Always use verbosity level for user messages
Send all progress messages to stdout, and errors/warnings to stderr. Guard all stdout messages with verbosity level. Change-Id: I2eea11f2f8920ccffaac97ba7fc9abd0ab18cdfa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/windeployqt/main.cpp29
-rw-r--r--src/windeployqt/utils.cpp13
-rw-r--r--src/windeployqt/utils.h5
3 files changed, 26 insertions, 21 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp
index fc43f4370..cfb0bb637 100644
--- a/src/windeployqt/main.cpp
+++ b/src/windeployqt/main.cpp
@@ -513,7 +513,7 @@ static bool deployTranslations(const QString &sourcePath, unsigned usedQtModules
foreach (const QString &qmFile, sourceDir.entryList(translationNameFilters(usedQtModules, prefix)))
arguments.append(qmFile);
if (optVerboseLevel)
- std::fprintf(stderr, "Creating %s...\n", qPrintable(targetFile));
+ std::printf("Creating %s...\n", qPrintable(targetFile));
unsigned long exitCode;
if (!runProcess(binary, arguments, sourcePath, &exitCode, 0, 0, errorMessage) || exitCode)
return false;
@@ -566,7 +566,7 @@ static DeployResult deploy(const Options &options,
const QString libraryLocation = options.platform == Unix ? qmakeVariables.value(QStringLiteral("QT_INSTALL_LIBS")) : qtBinDir;
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Qt binaries in %s\n", qPrintable(QDir::toNativeSeparators(qtBinDir)));
+ std::printf("Qt binaries in %s\n", qPrintable(QDir::toNativeSeparators(qtBinDir)));
QStringList dependentQtLibs;
bool isDebug;
@@ -575,8 +575,10 @@ static DeployResult deploy(const Options &options,
if (!findDependentQtLibraries(libraryLocation, options.binary, options.platform, errorMessage, &dependentQtLibs, &wordSize, &isDebug, &directDependencyCount))
return result;
- std::printf("%s: %ubit, %s executable.\n", qPrintable(QDir::toNativeSeparators(options.binary)),
- wordSize, isDebug ? "debug" : "release");
+ if (optVerboseLevel) {
+ std::printf("%s: %ubit, %s executable.\n", qPrintable(QDir::toNativeSeparators(options.binary)),
+ wordSize, isDebug ? "debug" : "release");
+ }
if (dependentQtLibs.isEmpty()) {
*errorMessage = QDir::toNativeSeparators(options.binary) + QStringLiteral(" does not seem to be a Qt executable.");
@@ -597,7 +599,7 @@ static DeployResult deploy(const Options &options,
if (index >= 0) {
const QString icuVersion = icuLibs.front().mid(index, numberExpression.matchedLength());
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Adding ICU version %s\n", qPrintable(icuVersion));
+ std::printf("Adding ICU version %s\n", qPrintable(icuVersion));
icuLibs.push_back(QStringLiteral("icudt") + icuVersion + QStringLiteral(".dll"));
}
foreach (const QString &icuLib, icuLibs) {
@@ -634,16 +636,16 @@ static DeployResult deploy(const Options &options,
deployedQtLibraries.push_back(libraryPath(libraryLocation, qtModuleEntries[i].libraryName, options.platform, isDebug));
if (optVerboseLevel >= 1) {
- std::fprintf(stderr, "Direct dependencies: %s\nAll dependencies : %s\nTo be deployed : %s\n",
- formatQtModules(result.directlyUsedQtLibraries).constData(),
- formatQtModules(result.usedQtLibraries).constData(),
- formatQtModules(result.deployedQtLibraries).constData());
+ std::printf("Direct dependencies: %s\nAll dependencies : %s\nTo be deployed : %s\n",
+ formatQtModules(result.directlyUsedQtLibraries).constData(),
+ formatQtModules(result.usedQtLibraries).constData(),
+ formatQtModules(result.deployedQtLibraries).constData());
}
const QStringList plugins = findQtPlugins(result.deployedQtLibraries, qmakeVariables.value(QStringLiteral("QT_INSTALL_PLUGINS")),
isDebug, options.platform, &platformPlugin);
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Plugins: %s\n", qPrintable(plugins.join(QLatin1Char(','))));
+ std::printf("Plugins: %s\n", qPrintable(plugins.join(QLatin1Char(','))));
if (plugins.isEmpty())
return result;
@@ -695,7 +697,8 @@ static DeployResult deploy(const Options &options,
foreach (const QString &plugin, plugins) {
const QString targetDirName = plugin.section(slash, -2, -2);
if (!dir.exists(targetDirName)) {
- std::printf("Creating directory %s.\n", qPrintable(targetDirName));
+ if (optVerboseLevel)
+ std::printf("Creating directory %s.\n", qPrintable(targetDirName));
if (!dir.mkdir(targetDirName)) {
std::fprintf(stderr, "Cannot create %s.\n", qPrintable(targetDirName));
*errorMessage = QStringLiteral("Cannot create ") + targetDirName + QLatin1Char('.');
@@ -780,7 +783,7 @@ int main(int argc, char **argv)
options.platform = platformFromMkSpec(xSpec);
if (!parseArguments(QCoreApplication::arguments(), &options) || optHelp) {
- std::printf("\nwindeployqt based on Qt %s\n\n%s", QT_VERSION_STR, usage().constData());
+ std::fprintf(stderr, "\nwindeployqt based on Qt %s\n\n%s", QT_VERSION_STR, usage().constData());
return optHelp ? 0 : 1;
}
@@ -809,7 +812,7 @@ int main(int argc, char **argv)
|| ((result.deployedQtLibraries & QtWebKitModule)
&& (result.directlyUsedQtLibraries & QtQuickModule)))) {
if (optVerboseLevel)
- std::fprintf(stderr, "Deploying: %s...\n", webProcessC);
+ std::printf("Deploying: %s...\n", webProcessC);
if (!deployWebKit2(qmakeVariables, options, &errorMessage)) {
std::fprintf(stderr, "%s\n", qPrintable(errorMessage));
return 1;
diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp
index 8ac5ff963..18df58802 100644
--- a/src/windeployqt/utils.cpp
+++ b/src/windeployqt/utils.cpp
@@ -98,7 +98,7 @@ bool createDirectory(const QString &directory, QString *errorMessage)
return false;
}
if (optVerboseLevel)
- std::fprintf(stderr, "Creating %s...\n", qPrintable(QDir::toNativeSeparators(directory)));
+ std::printf("Creating %s...\n", qPrintable(QDir::toNativeSeparators(directory)));
QDir dir;
if (!dir.mkpath(directory)) {
*errorMessage = QString::fromLatin1("Could not create directory %1.").
@@ -244,7 +244,7 @@ bool runProcess(const QString &binary, const QStringList &args,
foreach (const QString &a, args)
appendToCommandLine(a, &commandLine);
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Running: %s\n", qPrintable(commandLine));
+ std::printf("Running: %s\n", qPrintable(commandLine));
QScopedArrayPointer<wchar_t> commandLineW(new wchar_t[commandLine.size() + 1]);
commandLine.toWCharArray(commandLineW.data());
@@ -478,7 +478,7 @@ bool updateFile(const QString &sourceFileName, const QStringList &nameFilters,
const QFileInfo sourceFileInfo(sourceFileName);
const QString targetFileName = targetDirectory + QLatin1Char('/') + sourceFileInfo.fileName();
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Checking %s, %s\n", qPrintable(sourceFileName), qPrintable(targetFileName));
+ std::printf("Checking %s, %s\n", qPrintable(sourceFileName), qPrintable(targetFileName));
if (!sourceFileInfo.exists()) {
*errorMessage = QString::fromLatin1("%1 does not exist.").arg(QDir::toNativeSeparators(sourceFileName));
@@ -502,7 +502,8 @@ bool updateFile(const QString &sourceFileName, const QStringList &nameFilters,
} // Not a directory.
} else { // exists.
QDir d(targetDirectory);
- std::printf("Creating %s.\n", qPrintable( QDir::toNativeSeparators(targetFileName)));
+ if (optVerboseLevel)
+ std::printf("Creating %s.\n", qPrintable( QDir::toNativeSeparators(targetFileName)));
if (!d.mkdir(sourceFileInfo.fileName())) {
*errorMessage = QString::fromLatin1("Cannot create directory %1 under %2.")
.arg(sourceFileInfo.fileName(), QDir::toNativeSeparators(targetDirectory));
@@ -704,8 +705,8 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage
*isDebugIn = debug;
result = true;
if (optVerboseLevel > 1)
- std::fprintf(stderr, "%s: %s %u bit, debug: %d\n", __FUNCTION__,
- qPrintable(peExecutableFileName), wordSize, debug);
+ std::printf("%s: %s %u bit, debug: %d\n", __FUNCTION__,
+ qPrintable(peExecutableFileName), wordSize, debug);
} while (false);
if (fileMemory)
diff --git a/src/windeployqt/utils.h b/src/windeployqt/utils.h
index 7195b4a2e..f930ee1cc 100644
--- a/src/windeployqt/utils.h
+++ b/src/windeployqt/utils.h
@@ -112,7 +112,7 @@ bool updateFile(const QString &sourceFileName,
const QFileInfo sourceFileInfo(sourceFileName);
const QString targetFileName = targetDirectory + QLatin1Char('/') + sourceFileInfo.fileName();
if (optVerboseLevel > 1)
- std::fprintf(stderr, "Checking %s, %s\n", qPrintable(sourceFileName), qPrintable(targetFileName));
+ std::printf("Checking %s, %s\n", qPrintable(sourceFileName), qPrintable(targetFileName));
if (!sourceFileInfo.exists()) {
*errorMessage = QString::fromLatin1("%1 does not exist.").arg(QDir::toNativeSeparators(sourceFileName));
@@ -162,7 +162,8 @@ bool updateFile(const QString &sourceFileName,
} // Not a directory.
} else { // exists.
QDir d(targetDirectory);
- std::printf("Creating %s.\n", qPrintable(targetFileName));
+ if (optVerboseLevel)
+ std::printf("Creating %s.\n", qPrintable(targetFileName));
if (!d.mkdir(sourceFileInfo.fileName())) {
*errorMessage = QString::fromLatin1("Cannot create directory %1 under %2.")
.arg(sourceFileInfo.fileName(), QDir::toNativeSeparators(targetDirectory));