Merge branch 'v1.5' of github.com:QuasarApp/CQtDeployer into v1.5

This commit is contained in:
Andrei Yankovich 2021-01-22 18:07:06 +03:00
commit d9eb258d2e
11 changed files with 94 additions and 9 deletions

View File

@ -63,6 +63,7 @@ SOURCES += \
extracter.cpp \ extracter.cpp \
filemanager.cpp \ filemanager.cpp \
Distributions/idistribution.cpp \ Distributions/idistribution.cpp \
generalfiles_type.cpp \
ignorerule.cpp \ ignorerule.cpp \
metafilemanager.cpp \ metafilemanager.cpp \
packagecontrol.cpp \ packagecontrol.cpp \
@ -101,6 +102,7 @@ HEADERS += \
extracter.h \ extracter.h \
filemanager.h \ filemanager.h \
Distributions/idistribution.h \ Distributions/idistribution.h \
generalfiles_type.h \
ignorerule.h \ ignorerule.h \
metafilemanager.h \ metafilemanager.h \
packagecontrol.h \ packagecontrol.h \

View File

@ -1458,7 +1458,7 @@ bool ConfigParser::smartMoveTargets() {
for (auto i = _config.targets().cbegin(); i != _config.targets().cend(); ++i) { for (auto i = _config.targets().cbegin(); i != _config.targets().cend(); ++i) {
if (!i.value().isValid()) { if (!i.value().isValid()) {
QuasarAppUtils::Params::log(QString("Interna error ocurred in %0. Target not inited.").arg(__FUNCTION__), QuasarAppUtils::Params::log(QString("Internal error ocurred in %0. Target not inited.").arg(__FUNCTION__),
QuasarAppUtils::Error); QuasarAppUtils::Error);
QuasarAppUtils::Params::log(QString("If you see this message please create a new issue" QuasarAppUtils::Params::log(QString("If you see this message please create a new issue"
" about this problem on the official github page" " about this problem on the official github page"

View File

@ -90,10 +90,13 @@ bool DependenciesScanner::fillLibInfo(LibInfo &info, const QString &file) const
case PrivateScaner::PE: { case PrivateScaner::PE: {
return _peScaner.getLibInfo(file, info); return _peScaner.getLibInfo(file, info);
} }
case PrivateScaner::ELF:
return _elfScaner.getLibInfo(file, info);
default: return false; case PrivateScaner::ELF: {
return _elfScaner.getLibInfo(file, info);
}
default:
return _filesScaner.getLibInfo(file, info);
} }
} }

View File

@ -14,6 +14,7 @@
#include "pe_type.h" #include "pe_type.h"
#include "elf_type.h" #include "elf_type.h"
#include "libinfo.h" #include "libinfo.h"
#include "generalfiles_type.h"
enum class PrivateScaner: unsigned char { enum class PrivateScaner: unsigned char {
@ -32,6 +33,7 @@ private:
PE _peScaner; PE _peScaner;
ELF _elfScaner; ELF _elfScaner;
GeneralFiles _filesScaner;
PrivateScaner getScaner(const QString& lib) const; PrivateScaner getScaner(const QString& lib) const;

View File

@ -91,7 +91,9 @@ bool Deploy::deploy() {
switch (DeployCore::getMode() ) { switch (DeployCore::getMode() ) {
case RunMode::Deploy: case RunMode::Deploy:
_extracter->deploy(); if (!_extracter->deploy())
return false;
break; break;
default: default:
break; break;

View File

@ -18,7 +18,7 @@ ELF::ELF()
QByteArrayList ELF::getDynamicString(ElfReader& reader) const { QByteArrayList ELF::getDynamicString(ElfReader& reader) const {
auto headers = reader.readHeaders(); auto headers = reader.readHeaders();
for (const auto &sectionHeader : headers.sectionHeaders) { for (const auto &sectionHeader : qAsConst(headers.sectionHeaders)) {
if (sectionHeader.name == ".dynstr") { if (sectionHeader.name == ".dynstr") {
auto arr = reader.readSection(sectionHeader.name).split(0); auto arr = reader.readSection(sectionHeader.name).split(0);
return arr; return arr;

View File

@ -262,10 +262,13 @@ void Extracter::copyTr() {
} }
} }
void Extracter::deploy() { bool Extracter::deploy() {
QuasarAppUtils::Params::log("target deploy started!!", QuasarAppUtils::Params::log("target deploy started!!",
QuasarAppUtils::Info); QuasarAppUtils::Info);
_cqt->smartMoveTargets(); if (!_cqt->smartMoveTargets()) {
return false;
}
_scaner->setEnvironment(DeployCore::_config->envirement.environmentList()); _scaner->setEnvironment(DeployCore::_config->envirement.environmentList());
extractAllTargets(); extractAllTargets();
extractExtraDataTargets(); extractExtraDataTargets();
@ -283,6 +286,7 @@ void Extracter::deploy() {
if (!extractWebEngine()) { if (!extractWebEngine()) {
QuasarAppUtils::Params::log("deploy webEngine failed", QuasarAppUtils::Error); QuasarAppUtils::Params::log("deploy webEngine failed", QuasarAppUtils::Error);
return false;
} }
if (!deployMSVC()) { if (!deployMSVC()) {
@ -293,6 +297,8 @@ void Extracter::deploy() {
QuasarAppUtils::Params::log("deploy done!", QuasarAppUtils::Params::log("deploy done!",
QuasarAppUtils::Info); QuasarAppUtils::Info);
return true;
} }
bool Extracter::copyTranslations(const QStringList &list, const QString& package) { bool Extracter::copyTranslations(const QStringList &list, const QString& package) {

View File

@ -24,7 +24,7 @@ class DEPLOYSHARED_EXPORT Extracter {
public: public:
explicit Extracter(FileManager *fileManager, PluginsParser* pluginsParser, ConfigParser * cqt, DependenciesScanner *_scaner); explicit Extracter(FileManager *fileManager, PluginsParser* pluginsParser, ConfigParser * cqt, DependenciesScanner *_scaner);
void deploy(); bool deploy();
void clear(); void clear();
private: private:

View File

@ -0,0 +1,24 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "generalfiles_type.h"
GeneralFiles::GeneralFiles()
{
}
bool GeneralFiles::getLibInfo(const QString &lib, LibInfo &info) const {
QFileInfo fileInfo(lib);
info.setPlatform(GeneralFile);
info.setName(fileInfo.fileName());
info.setPath(fileInfo.absolutePath());
return true;
}

View File

@ -0,0 +1,26 @@
//#
//# Copyright (C) 2021-2021 QuasarApp.
//# Distributed under the lgplv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef GENERALFILES_TYPE_H
#define GENERALFILES_TYPE_H
#include "igetlibinfo.h"
/**
* @brief The GeneralFiles class intendet for extract information of general files.
* This is defautl extracte for unknown files types.
*/
class GeneralFiles: public IGetLibInfo
{
public:
GeneralFiles();
// IGetLibInfo interface
bool getLibInfo(const QString &lib, LibInfo &info) const override;
};
#endif // GENERALFILES_TYPE_H

View File

@ -175,6 +175,7 @@ private slots:
void testRunScripts(); void testRunScripts();
void testGetDefaultTemplate(); void testGetDefaultTemplate();
void testDeployGeneralFiles();
void customTest(); void customTest();
}; };
@ -1147,6 +1148,25 @@ void deploytest::testGetDefaultTemplate() {
} }
void deploytest::testDeployGeneralFiles() {
TestUtils utils;
QString bin = TestBinDir + "/../../CMakeLists.txt";
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/bin/CMakeLists.txt",
"./" + DISTRO_DIR + "/bin/qt.conf",
});
runTestParams(
{"-bin", bin,
"-binOut", "bin",
"force-clear"
}, &comapareTree);
}
void deploytest::customTest() { void deploytest::customTest() {
// runTestParams({"-confFile", "path", // runTestParams({"-confFile", "path",
// "qifFromSystem"}); // "qifFromSystem"});