summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorMichael Brüning <michael.bruning@qt.io>2022-08-19 11:56:19 +0200
committerMichael Brüning <michael.bruning@qt.io>2022-09-02 12:04:23 +0200
commitaed7b5f3701ff51d088bc80c60b6bd4675a01077 (patch)
treea2c3f878c37abdf6afe34622ca70a97fe01e15b1 /src/tools
parent60b069471dda1ae3cacca8cf8cfdd8a140e63563 (diff)
Reland macdeployqt: Don't copy .prl files into the Resources folder
QRegularExpression::isValid returns true on default constructed objects, so the filter was always matching even though it was not meant to be applied at all. Fix this by checking that there is a non-empty pattern string set and applying the filter only then. Fixes: QTBUG-87764 Pick-to: 6.4 Change-Id: If37f8abaecacba3dc6f0b14da681a6e025367c10 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/macdeployqt/shared/shared.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp
index 1c7190f2b6..4d5d0e97a3 100644
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -627,7 +627,8 @@ QStringList getBinaryDependencies(const QString executablePath,
}
// copies everything _inside_ sourcePath to destinationPath
-bool recursiveCopy(const QString &sourcePath, const QString &destinationPath)
+bool recursiveCopy(const QString &sourcePath, const QString &destinationPath,
+ const QRegularExpression &ignoreRegExp = QRegularExpression())
{
if (!QDir(sourcePath).exists())
return false;
@@ -636,7 +637,10 @@ bool recursiveCopy(const QString &sourcePath, const QString &destinationPath)
LogNormal() << "copy:" << sourcePath << destinationPath;
QStringList files = QDir(sourcePath).entryList(QStringList() << "*", QDir::Files | QDir::NoDotAndDotDot);
- for (const QString &file : files) {
+ const bool hasValidRegExp = ignoreRegExp.isValid() && ignoreRegExp.pattern().length() > 0;
+ foreach (QString file, files) {
+ if (hasValidRegExp && ignoreRegExp.match(file).hasMatch())
+ continue;
const QString fileSourcePath = sourcePath + "/" + file;
const QString fileDestinationPath = destinationPath + "/" + file;
copyFilePrintStatus(fileSourcePath, fileDestinationPath);
@@ -769,7 +773,9 @@ QString copyFramework(const FrameworkInfo &framework, const QString path)
// Copy Resources/, Libraries/ and Helpers/
const QString resourcesSourcePath = framework.frameworkPath + "/Resources";
const QString resourcesDestinationPath = frameworkDestinationDirectory + "/Versions/" + framework.version + "/Resources";
- recursiveCopy(resourcesSourcePath, resourcesDestinationPath);
+ // Ignore *.prl files that are in the Resources directory
+ recursiveCopy(resourcesSourcePath, resourcesDestinationPath,
+ QRegularExpression("\\A(?:[^/]*\\.prl)\\z"));
const QString librariesSourcePath = framework.frameworkPath + "/Libraries";
const QString librariesDestinationPath = frameworkDestinationDirectory + "/Versions/" + framework.version + "/Libraries";
bool createdLibraries = recursiveCopy(librariesSourcePath, librariesDestinationPath);