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