mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-29 03:04:34 +00:00
read rpath value for linux targets
This commit is contained in:
parent
0c7cea855d
commit
0613199475
@ -10,6 +10,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include "dependenciesscanner.h"
|
||||||
#include "deploycore.h"
|
#include "deploycore.h"
|
||||||
#include "filemanager.h"
|
#include "filemanager.h"
|
||||||
#include "pathutils.h"
|
#include "pathutils.h"
|
||||||
@ -341,7 +342,7 @@ void ConfigParser::setTargetDir(const QString &target) {
|
|||||||
} else {
|
} else {
|
||||||
if (_config.targets.size())
|
if (_config.targets.size())
|
||||||
_config.targetDir = QFileInfo(
|
_config.targetDir = QFileInfo(
|
||||||
*_config.targets.begin()).absolutePath() + "/" + DISTRO_DIR;
|
_config.targets.begin().key()).absolutePath() + "/" + DISTRO_DIR;
|
||||||
|
|
||||||
_config.targetDir = QFileInfo("./" + DISTRO_DIR).absoluteFilePath();
|
_config.targetDir = QFileInfo("./" + DISTRO_DIR).absoluteFilePath();
|
||||||
qInfo () << "flag targetDir not used." << "use default target dir :" << _config.targetDir;
|
qInfo () << "flag targetDir not used." << "use default target dir :" << _config.targetDir;
|
||||||
@ -362,7 +363,8 @@ bool ConfigParser::setTargets(const QStringList &value) {
|
|||||||
|
|
||||||
auto sufix = targetInfo.completeSuffix();
|
auto sufix = targetInfo.completeSuffix();
|
||||||
|
|
||||||
_config.targets.insert(QDir::fromNativeSeparators(i));
|
_config.targets.unite(prepareTarget(QDir::fromNativeSeparators(i)));
|
||||||
|
|
||||||
isfillList = true;
|
isfillList = true;
|
||||||
}
|
}
|
||||||
else if (targetInfo.isDir()) {
|
else if (targetInfo.isDir()) {
|
||||||
@ -426,7 +428,8 @@ bool ConfigParser::setBinDir(const QString &dir, bool recursive) {
|
|||||||
name.contains(".so", Qt::CaseInsensitive) || name.contains(".exe", Qt::CaseInsensitive)) {
|
name.contains(".so", Qt::CaseInsensitive) || name.contains(".exe", Qt::CaseInsensitive)) {
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
_config.targets.insert(QDir::fromNativeSeparators(file.absoluteFilePath()));
|
|
||||||
|
_config.targets.unite(prepareTarget(QDir::fromNativeSeparators(file.absoluteFilePath())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,6 +438,16 @@ bool ConfigParser::setBinDir(const QString &dir, bool recursive) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QHash<QString, LibInfo> ConfigParser::prepareTarget(const QString &target) {
|
||||||
|
LibInfo libinfo;
|
||||||
|
auto key = target;
|
||||||
|
if (_scaner->fillLibInfo(libinfo, key)) {
|
||||||
|
return {{libinfo.fullPath(), libinfo}};
|
||||||
|
} else {
|
||||||
|
return {{key, {}}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigParser::initIgnoreList()
|
void ConfigParser::initIgnoreList()
|
||||||
{
|
{
|
||||||
if (QuasarAppUtils::Params::isEndable("ignore")) {
|
if (QuasarAppUtils::Params::isEndable("ignore")) {
|
||||||
@ -793,11 +806,11 @@ QSet<QString> ConfigParser::getSetDirsRecursive(const QString &path, int maxDepc
|
|||||||
|
|
||||||
bool ConfigParser::smartMoveTargets() {
|
bool ConfigParser::smartMoveTargets() {
|
||||||
|
|
||||||
QSet<QString> temp;
|
decltype (_config.targets) temp;
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for (auto i = _config.targets.cbegin(); i != _config.targets.cend(); ++i) {
|
for (auto i = _config.targets.cbegin(); i != _config.targets.cend(); ++i) {
|
||||||
|
|
||||||
QFileInfo target(*i);
|
QFileInfo target(i.key());
|
||||||
|
|
||||||
QString targetPath = _config.targetDir;
|
QString targetPath = _config.targetDir;
|
||||||
|
|
||||||
@ -811,8 +824,7 @@ bool ConfigParser::smartMoveTargets() {
|
|||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
temp.unite(prepareTarget(targetPath + "/" + target.fileName()));
|
||||||
temp.insert(targetPath + "/" + target.fileName());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,10 +833,12 @@ bool ConfigParser::smartMoveTargets() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigParser::ConfigParser(FileManager *filemanager):
|
ConfigParser::ConfigParser(FileManager *filemanager, DependenciesScanner* scaner):
|
||||||
_fileManager(filemanager) {
|
_fileManager(filemanager),
|
||||||
|
_scaner(scaner) {
|
||||||
|
|
||||||
assert(_fileManager);
|
assert(_fileManager);
|
||||||
|
assert(_scaner);
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
_config.appDir = QuasarAppUtils::Params::getStrArg("appPath");
|
_config.appDir = QuasarAppUtils::Params::getStrArg("appPath");
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#define DISTRO_DIR QString("DistributionKit")
|
#define DISTRO_DIR QString("DistributionKit")
|
||||||
|
|
||||||
class FileManager;
|
class FileManager;
|
||||||
|
class DependenciesScanner;
|
||||||
|
|
||||||
struct DEPLOYSHARED_EXPORT QtDir {
|
struct DEPLOYSHARED_EXPORT QtDir {
|
||||||
QString libs;
|
QString libs;
|
||||||
@ -61,7 +62,7 @@ struct DEPLOYSHARED_EXPORT DeployConfig {
|
|||||||
* key - path
|
* key - path
|
||||||
* value - create wrapper
|
* value - create wrapper
|
||||||
*/
|
*/
|
||||||
QSet<QString> targets;
|
QHash<QString, LibInfo> targets;
|
||||||
Envirement envirement;
|
Envirement envirement;
|
||||||
DistroStruct distroStruct;
|
DistroStruct distroStruct;
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ private:
|
|||||||
|
|
||||||
DeployConfig _config;
|
DeployConfig _config;
|
||||||
FileManager *_fileManager;
|
FileManager *_fileManager;
|
||||||
|
DependenciesScanner *_scaner;
|
||||||
bool createFromDeploy(const QString& file) const;
|
bool createFromDeploy(const QString& file) const;
|
||||||
bool loadFromFile(const QString& file);
|
bool loadFromFile(const QString& file);
|
||||||
bool parseQtDeployMode();
|
bool parseQtDeployMode();
|
||||||
@ -88,7 +90,6 @@ private:
|
|||||||
bool setTargetsRecursive(const QString &dir);
|
bool setTargetsRecursive(const QString &dir);
|
||||||
bool setBinDir(const QString &dir, bool recursive = false);
|
bool setBinDir(const QString &dir, bool recursive = false);
|
||||||
|
|
||||||
|
|
||||||
void initIgnoreList();
|
void initIgnoreList();
|
||||||
void initIgnoreEnvList();
|
void initIgnoreEnvList();
|
||||||
|
|
||||||
@ -112,8 +113,9 @@ private:
|
|||||||
QString getRelativeLink(const QString& from, const QString& to);
|
QString getRelativeLink(const QString& from, const QString& to);
|
||||||
void writeKey(const QString &key, QJsonObject &, const QString &confFileDir) const;
|
void writeKey(const QString &key, QJsonObject &, const QString &confFileDir) const;
|
||||||
void readKey(const QString &key, const QJsonObject &obj, const QString &confFileDir) const;
|
void readKey(const QString &key, const QJsonObject &obj, const QString &confFileDir) const;
|
||||||
|
QHash<QString, LibInfo> prepareTarget(const QString &target);
|
||||||
public:
|
public:
|
||||||
ConfigParser(FileManager *filemanager);
|
ConfigParser(FileManager *filemanager, DependenciesScanner *scaner);
|
||||||
bool parseParams();
|
bool parseParams();
|
||||||
bool smartMoveTargets();
|
bool smartMoveTargets();
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ private:
|
|||||||
PrivateScaner getScaner(const QString& lib) const;
|
PrivateScaner getScaner(const QString& lib) const;
|
||||||
|
|
||||||
QMultiMap<LibPriority, LibInfo> getLibsFromEnvirement(const QString& libName) const;
|
QMultiMap<LibPriority, LibInfo> getLibsFromEnvirement(const QString& libName) const;
|
||||||
bool fillLibInfo(LibInfo& info ,const QString& file) const;
|
|
||||||
|
|
||||||
void recursiveDep(LibInfo& lib, QSet<LibInfo> &res);
|
void recursiveDep(LibInfo& lib, QSet<LibInfo> &res);
|
||||||
|
|
||||||
@ -47,6 +46,7 @@ public:
|
|||||||
void setEnvironment(const QStringList &env);
|
void setEnvironment(const QStringList &env);
|
||||||
|
|
||||||
QSet<LibInfo> scan(const QString& path);
|
QSet<LibInfo> scan(const QString& path);
|
||||||
|
bool fillLibInfo(LibInfo& info ,const QString& file) const;
|
||||||
|
|
||||||
~DependenciesScanner();
|
~DependenciesScanner();
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
Deploy::Deploy() {
|
Deploy::Deploy() {
|
||||||
_fileManager = new FileManager();
|
_fileManager = new FileManager();
|
||||||
_paramsParser = new ConfigParser(_fileManager);
|
_scaner = new DependenciesScanner();
|
||||||
|
_paramsParser = new ConfigParser(_fileManager, _scaner);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Deploy::run() {
|
int Deploy::run() {
|
||||||
@ -38,6 +40,10 @@ Deploy::~Deploy() {
|
|||||||
if (_fileManager) {
|
if (_fileManager) {
|
||||||
delete _fileManager;
|
delete _fileManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_scaner) {
|
||||||
|
delete _scaner;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Deploy::prepare() {
|
bool Deploy::prepare() {
|
||||||
@ -45,7 +51,7 @@ bool Deploy::prepare() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_extracter = new Extracter(_fileManager, _paramsParser);
|
_extracter = new Extracter(_fileManager, _paramsParser, _scaner);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
class ConfigParser;
|
class ConfigParser;
|
||||||
class Extracter;
|
class Extracter;
|
||||||
class FileManager;
|
class FileManager;
|
||||||
|
class DependenciesScanner;
|
||||||
|
|
||||||
class DEPLOYSHARED_EXPORT Deploy
|
class DEPLOYSHARED_EXPORT Deploy
|
||||||
{
|
{
|
||||||
@ -21,6 +22,7 @@ private:
|
|||||||
ConfigParser * _paramsParser = nullptr;
|
ConfigParser * _paramsParser = nullptr;
|
||||||
Extracter *_extracter = nullptr;
|
Extracter *_extracter = nullptr;
|
||||||
FileManager *_fileManager = nullptr;
|
FileManager *_fileManager = nullptr;
|
||||||
|
DependenciesScanner *_scaner = nullptr;
|
||||||
|
|
||||||
bool prepare();
|
bool prepare();
|
||||||
int deploy();
|
int deploy();
|
||||||
|
@ -123,7 +123,7 @@ void Extracter::copyPlugins(const QStringList &list) {
|
|||||||
|
|
||||||
void Extracter::extractAllTargets() {
|
void Extracter::extractAllTargets() {
|
||||||
for (auto i = DeployCore::_config->targets.cbegin(); i != DeployCore::_config->targets.cend(); ++i) {
|
for (auto i = DeployCore::_config->targets.cbegin(); i != DeployCore::_config->targets.cend(); ++i) {
|
||||||
extract(*i);
|
extract(i.key());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ void Extracter::deploy() {
|
|||||||
|
|
||||||
clear();
|
clear();
|
||||||
_cqt->smartMoveTargets();
|
_cqt->smartMoveTargets();
|
||||||
scaner.setEnvironment(DeployCore::_config->envirement.deployEnvironment());
|
_scaner->setEnvironment(DeployCore::_config->envirement.deployEnvironment());
|
||||||
extractAllTargets();
|
extractAllTargets();
|
||||||
|
|
||||||
if (DeployCore::_config->deployQml && !extractQml()) {
|
if (DeployCore::_config->deployQml && !extractQml()) {
|
||||||
@ -264,7 +264,7 @@ QFileInfoList Extracter::findFilesInsideDir(const QString &name,
|
|||||||
void Extracter::extractLib(const QString &file, const QString& mask) {
|
void Extracter::extractLib(const QString &file, const QString& mask) {
|
||||||
qInfo() << "extract lib :" << file;
|
qInfo() << "extract lib :" << file;
|
||||||
|
|
||||||
auto data = scaner.scan(file);
|
auto data = _scaner->scan(file);
|
||||||
|
|
||||||
for (auto &line : data) {
|
for (auto &line : data) {
|
||||||
|
|
||||||
@ -388,9 +388,12 @@ void Extracter::extract(const QString &file, const QString &mask) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Extracter::Extracter(FileManager *fileManager, ConfigParser *cqt):
|
Extracter::Extracter(FileManager *fileManager, ConfigParser *cqt,
|
||||||
|
DependenciesScanner *scaner):
|
||||||
|
_scaner(scaner),
|
||||||
_fileManager(fileManager),
|
_fileManager(fileManager),
|
||||||
_cqt(cqt) {
|
_cqt(cqt)
|
||||||
|
{
|
||||||
|
|
||||||
_qtModules = DeployCore::QtModule::NONE;
|
_qtModules = DeployCore::QtModule::NONE;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class DEPLOYSHARED_EXPORT Extracter {
|
|||||||
QStringList neadedLibs;
|
QStringList neadedLibs;
|
||||||
QStringList systemLibs;
|
QStringList systemLibs;
|
||||||
|
|
||||||
DependenciesScanner scaner;
|
DependenciesScanner *_scaner;
|
||||||
FileManager *_fileManager;
|
FileManager *_fileManager;
|
||||||
ConfigParser *_cqt;
|
ConfigParser *_cqt;
|
||||||
MetaFileManager *_metaFileManager;
|
MetaFileManager *_metaFileManager;
|
||||||
@ -60,7 +60,7 @@ class DEPLOYSHARED_EXPORT Extracter {
|
|||||||
void copyTr();
|
void copyTr();
|
||||||
void copyExtraPlugins();
|
void copyExtraPlugins();
|
||||||
public:
|
public:
|
||||||
explicit Extracter(FileManager *fileManager, ConfigParser * cqt);
|
explicit Extracter(FileManager *fileManager, ConfigParser * cqt, DependenciesScanner *_scaner);
|
||||||
void deploy();
|
void deploy();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void MetaFileManager::createRunMetaFiles() {
|
|||||||
|
|
||||||
for (auto i = DeployCore::_config->targets.cbegin(); i != DeployCore::_config->targets.cend(); ++i) {
|
for (auto i = DeployCore::_config->targets.cbegin(); i != DeployCore::_config->targets.cend(); ++i) {
|
||||||
|
|
||||||
if (!createRunScript(*i)) {
|
if (!createRunScript(i.key())) {
|
||||||
qCritical() << "run script not created!";
|
qCritical() << "run script not created!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,8 @@ void deploytest::cleanupTestCase() {
|
|||||||
void deploytest::testDeployTarget() {
|
void deploytest::testDeployTarget() {
|
||||||
|
|
||||||
FileManager file;
|
FileManager file;
|
||||||
ConfigParser *deploy = new ConfigParser(&file);
|
DependenciesScanner scan;
|
||||||
|
ConfigParser *deploy = new ConfigParser(&file, &scan);
|
||||||
|
|
||||||
QStringList targets;
|
QStringList targets;
|
||||||
targets << "./test/bins/execTarget.exe";
|
targets << "./test/bins/execTarget.exe";
|
||||||
@ -309,31 +310,31 @@ void deploytest::testDeployTarget() {
|
|||||||
delete deploy;
|
delete deploy;
|
||||||
targets.clear();
|
targets.clear();
|
||||||
|
|
||||||
deploy = new ConfigParser(&file);
|
deploy = new ConfigParser(&file, &scan);
|
||||||
targets << "./test/bins/execTarget";
|
targets << "./test/bins/execTarget";
|
||||||
QVERIFY(deploy->setTargets(targets));
|
QVERIFY(deploy->setTargets(targets));
|
||||||
delete deploy;
|
delete deploy;
|
||||||
targets.clear();
|
targets.clear();
|
||||||
|
|
||||||
deploy = new ConfigParser(&file);
|
deploy = new ConfigParser(&file, &scan);
|
||||||
targets << "./test/bins/execTarget.exe" << "./test/bins/execTarget";
|
targets << "./test/bins/execTarget.exe" << "./test/bins/execTarget";
|
||||||
QVERIFY(deploy->setTargets(targets));
|
QVERIFY(deploy->setTargets(targets));
|
||||||
delete deploy;
|
delete deploy;
|
||||||
targets.clear();
|
targets.clear();
|
||||||
|
|
||||||
deploy = new ConfigParser(&file);
|
deploy = new ConfigParser(&file, &scan);
|
||||||
targets << "./test/bns/execTarget.exe";
|
targets << "./test/bns/execTarget.exe";
|
||||||
QVERIFY(!deploy->setTargets(targets));
|
QVERIFY(!deploy->setTargets(targets));
|
||||||
delete deploy;
|
delete deploy;
|
||||||
targets.clear();
|
targets.clear();
|
||||||
|
|
||||||
deploy = new ConfigParser(&file);
|
deploy = new ConfigParser(&file, &scan);
|
||||||
targets << "./test/bins/";
|
targets << "./test/bins/";
|
||||||
QVERIFY(deploy->setTargets(targets));
|
QVERIFY(deploy->setTargets(targets));
|
||||||
delete deploy;
|
delete deploy;
|
||||||
targets.clear();
|
targets.clear();
|
||||||
|
|
||||||
deploy = new ConfigParser(&file);
|
deploy = new ConfigParser(&file, &scan);
|
||||||
targets << "./test/bins/" << "./test/warning/";
|
targets << "./test/bins/" << "./test/warning/";
|
||||||
QVERIFY(deploy->setTargets(targets));
|
QVERIFY(deploy->setTargets(targets));
|
||||||
|
|
||||||
@ -732,7 +733,8 @@ void deploytest::testCheckQt() {
|
|||||||
void deploytest::testSetTargetDir() {
|
void deploytest::testSetTargetDir() {
|
||||||
|
|
||||||
FileManager file;
|
FileManager file;
|
||||||
ConfigParser dep(&file);
|
DependenciesScanner scan;
|
||||||
|
ConfigParser dep(&file, &scan);
|
||||||
|
|
||||||
dep.setTargetDir();
|
dep.setTargetDir();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user