Preserve last modification timestamps of installed program files
Similar to the parent commit, this patch adds a unified code path in qmake itself for installing program files while preserving their original last modification timestamp. Change-Id: I7b7dcfa6228c2bfd48ea6036549398bb6f90032f Task-number: QTBUG-59004 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
fbcdf6d753
commit
f074d72c8f
@ -1292,7 +1292,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
|
||||
if (fi.isDir())
|
||||
cmd = "-$(INSTALL_DIR)";
|
||||
else if (is_target || fi.isExecutable())
|
||||
cmd = "-$(INSTALL_PROGRAM)";
|
||||
cmd = "-$(QINSTALL_PROGRAM)";
|
||||
else
|
||||
cmd = "-$(QINSTALL_FILE)";
|
||||
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
|
||||
@ -1318,7 +1318,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
|
||||
dst_file += filestr;
|
||||
}
|
||||
} else if (installConfigValues.contains("executable")) {
|
||||
cmd = QLatin1String("-$(INSTALL_PROGRAM)");
|
||||
cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
|
||||
} else {
|
||||
cmd = QLatin1String("-$(QINSTALL_FILE)");
|
||||
}
|
||||
@ -2249,6 +2249,7 @@ MakefileGenerator::writeDefaultVariables(QTextStream &t)
|
||||
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
|
||||
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
|
||||
t << "QINSTALL_FILE = " << var("QMAKE_QMAKE") << " -install qinstall file" << endl;
|
||||
t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall program" << endl;
|
||||
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
|
||||
t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
|
||||
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
|
||||
|
@ -629,7 +629,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
|
||||
ret += "\n\t";
|
||||
ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false);
|
||||
}
|
||||
copy_cmd += "-$(INSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
|
||||
copy_cmd += "-$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ;
|
||||
}
|
||||
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
|
||||
&& project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) {
|
||||
|
@ -531,6 +531,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
|
||||
t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
|
||||
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
|
||||
t << "QINSTALL_FILE = " << var("QMAKE_QMAKE") << " -install qinstall file" << endl;
|
||||
t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall program" << endl;
|
||||
t << endl;
|
||||
|
||||
t << "####### Output directory\n\n";
|
||||
|
@ -236,7 +236,7 @@ static int doLink(int argc, char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
static int installFile(const QString &source, const QString &targetFileOrDirectory)
|
||||
static int installFile(const QString &source, const QString &targetFileOrDirectory, bool exe = false)
|
||||
{
|
||||
QFile sourceFile(source);
|
||||
|
||||
@ -253,6 +253,17 @@ static int installFile(const QString &source, const QString &targetFileOrDirecto
|
||||
fprintf(stderr, "Error copying %s to %s: %s\n", source.toLatin1().constData(), qPrintable(target), qPrintable(sourceFile.errorString()));
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (exe) {
|
||||
QFile targetFile(target);
|
||||
if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |
|
||||
QFileDevice::ExeGroup | QFileDevice::ExeOther)) {
|
||||
fprintf(stderr, "Error setting execute permissions on %s: %s\n",
|
||||
qPrintable(target), qPrintable(targetFile.errorString()));
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy file times
|
||||
QString error;
|
||||
if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) {
|
||||
@ -274,6 +285,8 @@ static int doQInstall(int argc, char **argv)
|
||||
|
||||
if (!strcmp(argv[0], "file"))
|
||||
return installFile(source, target);
|
||||
if (!strcmp(argv[0], "program"))
|
||||
return installFile(source, target, /*exe=*/true);
|
||||
|
||||
fprintf(stderr, "Error: Unsupported qinstall command type %s\n", argv[0]);
|
||||
return 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user