Do not ignore exit codes of install commands

All calls to QINSTALL or QINSTALL_PROGRAM were written into Makefiles
with a preceding dash which lets make ignore the command's exit code.
Scripts (and users) calling 'make install' had no way to determine if an
installation completely succeeded, unless they inspected make's output
or the installation tree.

Remove the leading dash from those commands to stop 'make install' on
failure. Users who really want to ignore the exit codes can run 'make -k
install'.

[ChangeLog][qmake] Installation targets do not ignore the exit code of
QINSTALL and QINSTALL_PROGRAM anymore.

Fixes: QTBUG-18870
Change-Id: I7c072c896e6bd2b2ddba4b9c082c5bf627c90f50
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Joerg Bornemann 2019-05-23 10:58:30 +02:00
parent ec6dc5f784
commit 20e9422e06
2 changed files with 10 additions and 10 deletions

View File

@ -1294,9 +1294,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += fi.fileName(); dst_file += fi.fileName();
QString cmd; QString cmd;
if (is_target || (!fi.isDir() && fi.isExecutable())) if (is_target || (!fi.isDir() && fi.isExecutable()))
cmd = QLatin1String("-$(QINSTALL_PROGRAM)"); cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else else
cmd = QLatin1String("-$(QINSTALL)"); cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file); cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd; inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") && if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&
@ -1316,9 +1316,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += filestr; dst_file += filestr;
QString cmd; QString cmd;
if (installConfigValues.contains("executable")) if (installConfigValues.contains("executable"))
cmd = QLatin1String("-$(QINSTALL_PROGRAM)"); cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else else
cmd = QLatin1String("-$(QINSTALL)"); cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file); cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd; inst << cmd;
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false)))); uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false))));
@ -1331,7 +1331,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
if (!dst_file.endsWith(Option::dir_sep)) if (!dst_file.endsWith(Option::dir_sep))
dst_file += Option::dir_sep; dst_file += Option::dir_sep;
dst_file += fi.fileName(); dst_file += fi.fileName();
QString cmd = QLatin1String("-$(QINSTALL) ") + QString cmd = QLatin1String("$(QINSTALL) ") +
escapeFilePath(dirstr + file) + " " + escapeFilePath(dst_file); escapeFilePath(dirstr + file) + " " + escapeFilePath(dst_file);
inst << cmd; inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") && if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&

View File

@ -604,7 +604,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1))); dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1)));
if(!ret.isEmpty()) if(!ret.isEmpty())
ret += "\n\t"; ret += "\n\t";
ret += "-$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst; ret += "$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst;
if(!uninst.isEmpty()) if(!uninst.isEmpty())
uninst.append("\n\t"); uninst.append("\n\t");
uninst.append("-$(DEL_FILE) " + dst); uninst.append("-$(DEL_FILE) " + dst);
@ -640,16 +640,16 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QString copy_cmd; QString copy_cmd;
if (bundle == SolidBundle) { if (bundle == SolidBundle) {
copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + plain_targ; copy_cmd += "$(QINSTALL) " + src_targ + ' ' + plain_targ;
} else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) { } else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) {
copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + dst_targ; copy_cmd += "$(QINSTALL) " + src_targ + ' ' + dst_targ;
} else if (!isAux) { } else if (!isAux) {
if (bundle == SlicedBundle) { if (bundle == SlicedBundle) {
if (!ret.isEmpty()) if (!ret.isEmpty())
ret += "\n\t"; ret += "\n\t";
ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false); ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false);
} }
copy_cmd += "-$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ; copy_cmd += "$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
} }
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
&& project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) { && project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) {
@ -702,7 +702,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
ret += "\n\t"; ret += "\n\t";
ret += mkdir_p_asstring("\"`dirname " + dst + "`\"", false) + "\n\t"; ret += mkdir_p_asstring("\"`dirname " + dst + "`\"", false) + "\n\t";
ret += "-$(DEL_FILE) " + dst + "\n\t"; // Can't overwrite symlinks to directories ret += "-$(DEL_FILE) " + dst + "\n\t"; // Can't overwrite symlinks to directories
ret += "-$(QINSTALL) " + escapeFilePath(src) + " " + dst; ret += "$(QINSTALL) " + escapeFilePath(src) + " " + dst;
if (!uninst.isEmpty()) if (!uninst.isEmpty())
uninst.append("\n\t"); uninst.append("\n\t");
uninst.append("-$(DEL_FILE) " + dst); uninst.append("-$(DEL_FILE) " + dst);