Add -ignore-glob argument (#305)
This commit is contained in:
@@ -29,6 +29,8 @@ Options:
|
|||||||
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.
|
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.
|
||||||
-exclude-libs=<list> : List of libraries which should be excluded,
|
-exclude-libs=<list> : List of libraries which should be excluded,
|
||||||
separated by comma.
|
separated by comma.
|
||||||
|
-ignore-glob=<glob> : Glob pattern relative to appdir to ignore when
|
||||||
|
searching for libraries.
|
||||||
-executable=<path> : Let the given executable use the deployed libraries
|
-executable=<path> : Let the given executable use the deployed libraries
|
||||||
too
|
too
|
||||||
-extra-plugins=<list> : List of extra plugins which should be deployed,
|
-extra-plugins=<list> : List of extra plugins which should be deployed,
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ int main(int argc, char **argv)
|
|||||||
qInfo() << " -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.";
|
qInfo() << " -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.";
|
||||||
qInfo() << " -exclude-libs=<list> : List of libraries which should be excluded,";
|
qInfo() << " -exclude-libs=<list> : List of libraries which should be excluded,";
|
||||||
qInfo() << " separated by comma.";
|
qInfo() << " separated by comma.";
|
||||||
|
qInfo() << " -ignore-glob=<glob> : Glob pattern relative to appdir to ignore when";
|
||||||
|
qInfo() << " searching for libraries.";
|
||||||
qInfo() << " -executable=<path> : Let the given executable use the deployed libraries";
|
qInfo() << " -executable=<path> : Let the given executable use the deployed libraries";
|
||||||
qInfo() << " too";
|
qInfo() << " too";
|
||||||
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
|
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
|
||||||
@@ -216,6 +218,7 @@ int main(int argc, char **argv)
|
|||||||
QString qmakeExecutable;
|
QString qmakeExecutable;
|
||||||
extern QStringList extraQtPlugins;
|
extern QStringList extraQtPlugins;
|
||||||
extern QStringList excludeLibs;
|
extern QStringList excludeLibs;
|
||||||
|
extern QStringList ignoreGlob;
|
||||||
extern bool copyCopyrightFiles;
|
extern bool copyCopyrightFiles;
|
||||||
|
|
||||||
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
|
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
|
||||||
@@ -431,6 +434,10 @@ int main(int argc, char **argv)
|
|||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
excludeLibs = QString(argument.mid(index + 1)).split(",");
|
excludeLibs = QString(argument.mid(index + 1)).split(",");
|
||||||
|
} else if (argument.startsWith("-ignore-glob=")) {
|
||||||
|
LogDebug() << "Argument found:" << argument;
|
||||||
|
int index = argument.indexOf("=");
|
||||||
|
ignoreGlob += argument.mid(index + 1);
|
||||||
} else if (argument.startsWith("--")) {
|
} else if (argument.startsWith("--")) {
|
||||||
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
|
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may enco
|
|||||||
bool deployLibrary = false;
|
bool deployLibrary = false;
|
||||||
QStringList extraQtPlugins;
|
QStringList extraQtPlugins;
|
||||||
QStringList excludeLibs;
|
QStringList excludeLibs;
|
||||||
|
QStringList ignoreGlob;
|
||||||
bool copyCopyrightFiles = true;
|
bool copyCopyrightFiles = true;
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
@@ -542,22 +543,25 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
|
|||||||
|
|
||||||
QStringList findAppLibraries(const QString &appDirPath)
|
QStringList findAppLibraries(const QString &appDirPath)
|
||||||
{
|
{
|
||||||
|
QStringList ignoreGlobAbs;
|
||||||
|
QDir appDir(appDirPath);
|
||||||
|
foreach (const QString &glob, ignoreGlob) {
|
||||||
|
QString globAbs = appDir.filePath(glob);
|
||||||
|
LogDebug() << "Ignoring libraries matching" << globAbs;
|
||||||
|
ignoreGlobAbs += globAbs;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList result;
|
QStringList result;
|
||||||
// .so
|
// .so, .so.*
|
||||||
QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so"),
|
QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so") << QString::fromLatin1("*.so.*"),
|
||||||
QDir::Files, QDirIterator::Subdirectories);
|
QDir::Files, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
iter.next();
|
iter.next();
|
||||||
result << iter.fileInfo().filePath();
|
if (QDir::match(ignoreGlobAbs, iter.fileInfo().absoluteFilePath())) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
// .so.*, FIXME: Is the above really needed or is it covered by the below too?
|
result << iter.fileInfo().filePath();
|
||||||
QDirIterator iter2(appDirPath, QStringList() << QString::fromLatin1("*.so*"),
|
|
||||||
QDir::Files, QDirIterator::Subdirectories);
|
|
||||||
|
|
||||||
while (iter2.hasNext()) {
|
|
||||||
iter2.next();
|
|
||||||
result << iter2.fileInfo().filePath();
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user