Merge branch 'v1.4' into qif

This commit is contained in:
Andrei Yankovich 2020-01-18 16:38:40 +03:00
commit ff386a7e24
19 changed files with 412 additions and 35 deletions

View File

@ -68,11 +68,10 @@ bool ConfigParser::parseParams() {
} }
auto path = QuasarAppUtils::Params::getStrArg("confFile"); auto path = QuasarAppUtils::Params::getStrArg("confFile");
bool createFile = !(path.isEmpty() || QFile::exists(path)); bool createFile = !QFile::exists(path);
if (path.isEmpty()) { if (QFile::exists(path)) {
path = QFileInfo("./").absoluteFilePath(); loadFromFile(path);
} }
loadFromFile(path);
switch (DeployCore::getMode()) { switch (DeployCore::getMode()) {
case RunMode::Info: { case RunMode::Info: {
@ -215,17 +214,11 @@ void ConfigParser::readKey(const QString& key, const QJsonObject& obj,
} else if (!obj[key].isUndefined()) { } else if (!obj[key].isUndefined()) {
QString val = obj[key].toString(); QString val = obj[key].toString();
if (!val.isEmpty()) { if (!val.isEmpty()) {
if (PathUtils::isReleativePath(val)) {
if (PathUtils::isPath(val)) { QuasarAppUtils::Params::setArg(key, QFileInfo(confFileDir + '/' + val).absoluteFilePath());
} else {
if (PathUtils::isAbsalutPath(val)) { QuasarAppUtils::Params::setArg(key, val);
val = QFileInfo(val).absoluteFilePath();
} else {
val = QFileInfo(confFileDir + '/' + val).absoluteFilePath();
}
} }
QuasarAppUtils::Params::setArg(key, val);
} else { } else {
auto value = obj[key].toBool(true); auto value = obj[key].toBool(true);
QuasarAppUtils::Params::setEnable(key, value); QuasarAppUtils::Params::setEnable(key, value);
@ -752,6 +745,8 @@ void ConfigParser::initIgnoreList()
_config.ignoreList.addRule(addRuleWin("WINMM.DLL")); _config.ignoreList.addRule(addRuleWin("WINMM.DLL"));
_config.ignoreList.addRule(addRuleWin("IMM32.DLL")); _config.ignoreList.addRule(addRuleWin("IMM32.DLL"));
_config.ignoreList.addRule(addRuleWin("KernelBase.DLL")); _config.ignoreList.addRule(addRuleWin("KernelBase.DLL"));
_config.ignoreList.addRule(addRuleWin("dwmapi.DLL"));
} }

View File

@ -12,8 +12,11 @@
#include <QList> #include <QList>
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
#include "pathutils.h"
DependenciesScanner::DependenciesScanner() {} DependenciesScanner::DependenciesScanner() {
}
void DependenciesScanner::clearScaned() { void DependenciesScanner::clearScaned() {
_scanedLibs.clear(); _scanedLibs.clear();
@ -127,18 +130,41 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res) {
recursiveDep(*dep, listDep); recursiveDep(*dep, listDep);
dep->allDep = listDep; dep->allDep = listDep;
lib.setWinApi(lib.getWinApi() | dep->getWinApi());
_scanedLibs.insert(dep->fullPath(), *dep); _scanedLibs.insert(dep->fullPath(), *dep);
res.unite(listDep); res.unite(listDep);
} else { } else {
lib.setWinApi(lib.getWinApi() | scanedLib.getWinApi());
res.unite(scanedLib.allDep); res.unite(scanedLib.allDep);
} }
} }
} }
} }
void DependenciesScanner::addToWinAPI(const QString &lib, QHash<WinAPI, QSet<QString>>& res) {
#ifdef Q_OS_WIN
if (QuasarAppUtils::Params::isEndable("deploySystem")) {
WinAPI api = _peScaner.getAPIModule(lib);
if (api != WinAPI::NoWinAPI) {
res[api] += lib;
}
}
#else
Q_UNUSED(lib)
Q_UNUSED(res)
#endif
}
void DependenciesScanner::setEnvironment(const QStringList &env) { void DependenciesScanner::setEnvironment(const QStringList &env) {
QDir dir; QDir dir;
QHash<WinAPI, QSet<QString>> winAPI;
#ifdef Q_OS_WIN
winAPI[WinAPI::Crt] += "UCRTBASE.DLL";
#endif
for (auto i : env) { for (auto i : env) {
dir.setPath(i); dir.setPath(i);
@ -146,16 +172,19 @@ void DependenciesScanner::setEnvironment(const QStringList &env) {
continue; continue;
} }
auto list = dir.entryInfoList(QStringList() << "*.dll" << ".DLL" auto list = dir.entryInfoList(QStringList() << "*.dll" << "*.DLL"
<< "*.SO*" << "*.so*", << "*.SO*" << "*.so*",
QDir::Files| QDir::NoDotAndDotDot); QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
for (auto i : list) { for (auto i : list) {
addToWinAPI(i.fileName().toUpper(), winAPI);
_EnvLibs.insertMulti(i.fileName().toUpper(), i.absoluteFilePath()); _EnvLibs.insertMulti(i.fileName().toUpper(), i.absoluteFilePath());
} }
} }
_peScaner.setWinAPI(winAPI);
} }
QSet<LibInfo> DependenciesScanner::scan(const QString &path) { QSet<LibInfo> DependenciesScanner::scan(const QString &path) {

View File

@ -40,6 +40,8 @@ private:
void recursiveDep(LibInfo& lib, QSet<LibInfo> &res); void recursiveDep(LibInfo& lib, QSet<LibInfo> &res);
void addToWinAPI(const QString& lib, QHash<WinAPI, QSet<QString> > &res);
public: public:
explicit DependenciesScanner(); explicit DependenciesScanner();

View File

@ -222,7 +222,7 @@ QString DeployCore::help() {
{ " : Examples:" }, { " : Examples:" },
{ " : cqtdeployer qif - for use default templates of qt installer framework." }, { " : cqtdeployer qif - for use default templates of qt installer framework." },
{ " : cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." }, { " : cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." },
{ " -customScript [scriptCode]: Insert extra code inTo All run script."},
{ " v / version : Shows compiled version" }, { " v / version : Shows compiled version" },
{ " verbose [1-3] : Shows debug log" }, { " verbose [1-3] : Shows debug log" },
@ -275,7 +275,8 @@ QStringList DeployCore::helpKeys() {
"deployVersion", "deployVersion",
"releaseDate", "releaseDate",
"icon", "icon",
"publisher" "publisher",
"customScript"
}; };
} }
@ -465,3 +466,7 @@ char DeployCore::getEnvSeparator() {
return ';'; return ';';
#endif #endif
} }
uint qHash(WinAPI i) {
return static_cast<uint>(i);
}

View File

@ -50,6 +50,19 @@ enum LibPriority : int {
NotFile = 0xF, NotFile = 0xF,
}; };
enum class WinAPI : quint8 {
NoWinAPI = 0x00,
Other = 0x01,
Core = 0x02,
Devices = 0x04,
Eventing = 0x08,
Crt = 0x10,
Security = 0x20,
Base = 0x40
};
uint qHash (WinAPI i);
enum class RunMode: int { enum class RunMode: int {
Info, Info,
Deploy, Deploy,

View File

@ -5,6 +5,8 @@
* of this license document, but changing it is not allowed. * of this license document, but changing it is not allowed.
*/ */
#include "filemanager.h" #include "filemanager.h"
#include <QDir> #include <QDir>
#include <quasarapp.h> #include <quasarapp.h>
@ -14,6 +16,10 @@
#include <fstream> #include <fstream>
#include "pathutils.h" #include "pathutils.h"
#ifdef Q_OS_WIN
#include "windows.h"
#endif
FileManager::FileManager() { FileManager::FileManager() {
} }
@ -64,7 +70,20 @@ bool FileManager::addToDeployed(const QString& path) {
QuasarAppUtils::Params::verboseLog("permishens set fail", QuasarAppUtils::Warning); QuasarAppUtils::Params::verboseLog("permishens set fail", QuasarAppUtils::Warning);
} }
} }
#ifdef Q_OS_WIN
if (info.isFile()) {
auto stdString = QDir::toNativeSeparators(info.absoluteFilePath()).toStdString();
DWORD attribute = GetFileAttributesA(stdString.c_str());
if (!SetFileAttributesA(stdString.c_str(), attribute & static_cast<DWORD>(~FILE_ATTRIBUTE_HIDDEN))) {
QuasarAppUtils::Params::verboseLog("attribute set fail", QuasarAppUtils::Warning);
}
}
#endif
} }
return true; return true;
} }

View File

@ -60,6 +60,10 @@ void LibInfo::addDependncies(const QString &value) {
dependncies.insert(value); dependncies.insert(value);
} }
void LibInfo::addDependncies(const QSet<QString> &value) {
dependncies += value;
}
void LibInfo::removeDependncies(const QString &value) { void LibInfo::removeDependncies(const QString &value) {
dependncies.remove(value); dependncies.remove(value);
} }
@ -90,6 +94,14 @@ void LibInfo::setQtPath(const QString &value)
qtPath = value; qtPath = value;
} }
WinAPI LibInfo::getWinApi() const {
return _winApi;
}
void LibInfo::setWinApi(WinAPI winApi) {
_winApi = winApi;
}
QString LibInfo::fullPath() const { QString LibInfo::fullPath() const {
return path + "/" + name; return path + "/" + name;
} }

View File

@ -20,6 +20,7 @@ private:
QSet<QString> dependncies; QSet<QString> dependncies;
QString qtPath; QString qtPath;
LibPriority priority = NotFile; LibPriority priority = NotFile;
WinAPI _winApi = WinAPI::NoWinAPI;
public: public:
@ -46,12 +47,15 @@ public:
QSet<QString> getDependncies() const; QSet<QString> getDependncies() const;
void setDependncies(const QSet<QString> &value); void setDependncies(const QSet<QString> &value);
void addDependncies(const QString &value); void addDependncies(const QString &value);
void addDependncies(const QSet<QString> &value);
void removeDependncies(const QString &value); void removeDependncies(const QString &value);
LibPriority getPriority() const; LibPriority getPriority() const;
void setPriority(const LibPriority &value); void setPriority(const LibPriority &value);
QString getQtPath() const; QString getQtPath() const;
void setQtPath(const QString &value); void setQtPath(const QString &value);
WinAPI getWinApi() const;
void setWinApi(WinAPI winApi);
}; };
uint qHash(const LibInfo& info); uint qHash(const LibInfo& info);

View File

@ -33,9 +33,12 @@ bool MetaFileManager::createRunScriptWindows(const QString &target) {
"@echo off \n" "@echo off \n"
"SET BASE_DIR=%~dp0\n" "SET BASE_DIR=%~dp0\n"
"SET PATH=%BASE_DIR%" + distro.getLibOutDir() + ";%PATH%\n" "SET PATH=%BASE_DIR%" + distro.getLibOutDir() + ";%PATH%\n"
"%2\n"
"start \"\" \"%BASE_DIR%" + distro.getBinOutDir() + "%0\" %1 \n"; "start \"\" \"%BASE_DIR%" + distro.getBinOutDir() + "%0\" %1 \n";
content = content.arg(QFileInfo(target).fileName()).arg("%*"); content = content.arg(QFileInfo(target).fileName()).arg("%*");
content = content.arg(generateCustoScriptBlok(true));
content = QDir::toNativeSeparators(content); content = QDir::toNativeSeparators(content);
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".bat"; QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".bat";
@ -80,6 +83,7 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
"QT_QPA_PLATFORM_PLUGIN_PATH=\"$BASE_DIR\"" + distro.getPluginsOutDir() + "QT_QPA_PLATFORM_PLUGIN_PATH=\"$BASE_DIR\"" + distro.getPluginsOutDir() +
"/platforms:QT_QPA_PLATFORM_PLUGIN_PATH\n" "/platforms:QT_QPA_PLATFORM_PLUGIN_PATH\n"
"%2" "%2"
"%3\n"
"\"$BASE_DIR\"" + distro.getBinOutDir() + "%1 \"$@\""; "\"$BASE_DIR\"" + distro.getBinOutDir() + "%1 \"$@\"";
content = content.arg(QFileInfo(target).fileName()); content = content.arg(QFileInfo(target).fileName());
@ -93,6 +97,8 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
content = content.arg(""); content = content.arg("");
} }
content = content.arg(generateCustoScriptBlok(false));
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".sh"; QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".sh";
QFile F(fname); QFile F(fname);
@ -113,6 +119,28 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
QFileDevice::ReadOwner); QFileDevice::ReadOwner);
} }
QString MetaFileManager::generateCustoScriptBlok(bool bat) const {
QString res = "";
QString commentMarker = "# ";
if (bat) {
commentMarker = ":: ";
}
auto cstSh = QuasarAppUtils::Params::getStrArg("customScript", "");
if (cstSh.size()) {
res = "\n" +
commentMarker + "Begin Custom Script (generated by customScript flag)\n"
"%0\n" +
commentMarker + "End Custom Script\n"
"\n";
res = res.arg(cstSh);
}
return res;
}
MetaFileManager::MetaFileManager(FileManager *manager): MetaFileManager::MetaFileManager(FileManager *manager):
_fileManager(manager) _fileManager(manager)
{ {
@ -189,6 +217,4 @@ void MetaFileManager::createRunMetaFiles() {
QuasarAppUtils::Params::verboseLog("create qt.conf failr", QuasarAppUtils::Warning); QuasarAppUtils::Params::verboseLog("create qt.conf failr", QuasarAppUtils::Warning);
} }
} }
} }

View File

@ -18,7 +18,7 @@ class MetaFileManager
private: private:
bool createRunScriptWindows(const QString &target); bool createRunScriptWindows(const QString &target);
bool createRunScriptLinux(const QString &target); bool createRunScriptLinux(const QString &target);
QString generateCustoScriptBlok(bool bat) const;
bool createRunScript(const QString &target); bool createRunScript(const QString &target);
bool createQConf(const QString &target); bool createQConf(const QString &target);

View File

@ -7,6 +7,7 @@
#include "pathutils.h" #include "pathutils.h"
#include <QDir>
#include <QFileInfo> #include <QFileInfo>
PathUtils::PathUtils() PathUtils::PathUtils()
@ -66,7 +67,20 @@ QString PathUtils::getRelativeLink(QString from, QString to) {
// TODO ignore labels may be mistaken for a path, which will lead to improper eating // TODO ignore labels may be mistaken for a path, which will lead to improper eating
bool PathUtils::isPath(const QString &path) { bool PathUtils::isPath(const QString &path) {
return path.contains('/') || path.contains('\\') || path == "."; QFileInfo info(path);
return info.exists();
// return path.contains('/') || path.contains('\\') || path == ".";
}
bool PathUtils::isReleativePath(const QString &path) {
QString temp = QDir::fromNativeSeparators(path);
if (temp.size() == 1) {
return path[0] == '.';
} else if (temp.size() > 1) {
return path[0] == '.' && path[1] == '/';
}
return false;
} }
QChar PathUtils::getDrive(QString path) { QChar PathUtils::getDrive(QString path) {

View File

@ -63,6 +63,13 @@ public:
*/ */
static bool isPath(const QString &path); static bool isPath(const QString &path);
/**
* @brief isPath
* @param path
* @return return true if imput value is Releative path
*/
static bool isReleativePath(const QString &path);
/** /**
* @brief getDrive * @brief getDrive
* @param path * @param path

View File

@ -12,6 +12,7 @@
#include <QSet> #include <QSet>
#include <QVector> #include <QVector>
#include <parser-library/parse.h> #include <parser-library/parse.h>
#include <quasarapp.h>
#include <bits/stl_set.h> #include <bits/stl_set.h>
@ -25,8 +26,13 @@ struct importent {
std::string moduleName; std::string moduleName;
}; };
struct exportent {
VA addr;
std::string symbolName;
std::string moduleName;
};
class reloc; class reloc;
class exportent;
class symbol; class symbol;
struct parsed_pe_internal { struct parsed_pe_internal {
@ -42,6 +48,7 @@ struct parsed_pe_internal {
bool PE::getDep(peparse::parsed_pe_internal * internal, LibInfo &res) const { bool PE::getDep(peparse::parsed_pe_internal * internal, LibInfo &res) const {
auto imports = internal->imports; auto imports = internal->imports;
auto exports = internal->exports;
std::set<std::string> filter; std::set<std::string> filter;
@ -52,9 +59,61 @@ bool PE::getDep(peparse::parsed_pe_internal * internal, LibInfo &res) const {
} }
} }
for ( auto &i : exports) {
if (!filter.count(i.moduleName)) {
filter.insert(i.moduleName);
res.addDependncies(QString::fromStdString(i.moduleName));
}
}
if (res.getWinApi() != WinAPI::NoWinAPI) {
res.addDependncies(_winAPI.value(res.getWinApi()));
}
return res.getDependncies().size() || !imports.size(); return res.getDependncies().size() || !imports.size();
} }
QHash<WinAPI, QSet<QString> > PE::getWinAPI() const {
return _winAPI;
}
void PE::setWinAPI(const QHash<WinAPI, QSet<QString> > &winAPI) {
_winAPI = winAPI;
}
WinAPI PE::getAPIModule(const QString &libName) const {
if (libName.contains(API_MS_WIN, Qt::CaseInsensitive)) {
if (libName.contains(API_MS_WIN_CORE, Qt::CaseInsensitive)) {
return WinAPI::Core;
}
if (libName.contains(API_MS_WIN_EVENTING, Qt::CaseInsensitive)) {
return WinAPI::Eventing;
}
if (libName.contains(API_MS_WIN_DEVICES, Qt::CaseInsensitive)) {
return WinAPI::Devices;
}
if (libName.contains(API_MS_WIN_CRT, Qt::CaseInsensitive)) {
return WinAPI::Crt;
}
if (libName.contains(API_MS_WIN_SECURITY, Qt::CaseInsensitive)) {
return WinAPI::Security;
}
if (libName.contains(API_MS_WIN_BASE, Qt::CaseInsensitive)) {
return WinAPI::Base;
}
return WinAPI::Other;
}
return WinAPI::NoWinAPI;
}
PE::PE(): IGetLibInfo () { PE::PE(): IGetLibInfo () {
} }
@ -75,6 +134,7 @@ bool PE::getLibInfo(const QString &lib, LibInfo &info) const {
info.setName(QFileInfo(lib).fileName()); info.setName(QFileInfo(lib).fileName());
info.setPath(QFileInfo(lib).absolutePath()); info.setPath(QFileInfo(lib).absolutePath());
info.setWinApi(getAPIModule(info.getName()));
if (!getDep(parsedPeLib->internal, info)) { if (!getDep(parsedPeLib->internal, info)) {
peparse::DestructParsedPE(parsedPeLib); peparse::DestructParsedPE(parsedPeLib);
@ -83,6 +143,7 @@ bool PE::getLibInfo(const QString &lib, LibInfo &info) const {
peparse::DestructParsedPE(parsedPeLib); peparse::DestructParsedPE(parsedPeLib);
return info.isValid(); return info.isValid();
} }

View File

@ -13,6 +13,14 @@
#include <QVector> #include <QVector>
#include "igetlibinfo.h" #include "igetlibinfo.h"
#define API_MS_WIN "api-ms-win-"
#define API_MS_WIN_CORE "-core-"
#define API_MS_WIN_EVENTING "-Eventing-"
#define API_MS_WIN_DEVICES "-devices-"
#define API_MS_WIN_CRT "-crt-"
#define API_MS_WIN_SECURITY "-security-"
#define API_MS_WIN_BASE "-base-"
namespace peparse { namespace peparse {
struct parsed_pe_internal; struct parsed_pe_internal;
} }
@ -21,6 +29,7 @@ class PE : public IGetLibInfo {
private: private:
bool getDep(peparse::parsed_pe_internal *, LibInfo &res) const; bool getDep(peparse::parsed_pe_internal *, LibInfo &res) const;
QHash<WinAPI, QSet<QString>> _winAPI;
public: public:
@ -31,11 +40,14 @@ public:
_ROM = 0x107, _ROM = 0x107,
}; };
PE(); PE();
WinAPI getAPIModule(const QString &libName) const;
bool getLibInfo(const QString& lib, LibInfo& info) const override; bool getLibInfo(const QString& lib, LibInfo& info) const override;
~PE() override; ~PE() override;
QHash<WinAPI, QSet<QString>> getWinAPI() const;
void setWinAPI(const QHash<WinAPI, QSet<QString>> &winAPI);
}; };
#endif // PE_H #endif // PE_H

View File

@ -62,12 +62,13 @@ clearSnap.commands = rm parts prime stage *.snap -rdf
deploySnap.commands = rm *.snap -rdf && chmod 777 -R $$PWD/../prime && snapcraft && cp *.snap $$PWD/../Distro/ deploySnap.commands = rm *.snap -rdf && chmod 777 -R $$PWD/../prime && snapcraft && cp *.snap $$PWD/../Distro/
releaseSnap.commands = snapcraft push *.snap # bad patern releaseSnap.commands = snapcraft push *.snap # bad patern
unix:deploy.depends += clearSnap
unix:deploy.depends += buildSnap
!isEmpty( ONLINE ) { !isEmpty( ONLINE ) {
message(Snap) message(Snap)
unix:deploy.depends += clearSnap
unix:deploy.depends += buildSnap
unix:deploy.depends += deploySnap unix:deploy.depends += deploySnap
unix:release.depends += releaseSnap unix:release.depends += releaseSnap
} }

View File

@ -13,6 +13,17 @@ Modules::Modules()
} }
QSet<QString> Modules::ignoreFilter(const QSet<QString> &input, const QString &filter) {
QSet<QString> res;
for (auto& val : input) {
if (!val.contains(filter)) {
res.insert(val);
}
}
return res;
}
QSet<QString> Modules::qtLibs() { QSet<QString> Modules::qtLibs() {
TestUtils utils; TestUtils utils;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

View File

@ -20,6 +20,7 @@ private:
public: public:
Modules(); Modules();
static QSet<QString> ignoreFilter(const QSet<QString>& input, const QString& filter);
static QSet<QString> qtLibs(); static QSet<QString> qtLibs();
static QSet<QString> qmlLibs(); static QSet<QString> qmlLibs();
static QSet<QString> qmlLibsExtractPlugins(); static QSet<QString> qmlLibsExtractPlugins();

View File

@ -46,9 +46,9 @@ private:
QStringList getFilesFromDir(const QString& dir); QStringList getFilesFromDir(const QString& dir);
void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr, bool noWarnings = false); void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr, bool noWarnings = false, bool onlySize = false);
void checkResults(const QSet<QString> &tree, bool noWarnings); void checkResults(const QSet<QString> &tree, bool noWarnings, bool onlySize = false);
public: public:
deploytest(); deploytest();
/** /**
@ -83,6 +83,9 @@ private slots:
// tested flags : help, version // tested flags : help, version
void testHelp(); void testHelp();
// tested flags customScript
void costomScript();
// tested flags clear noOvervrite // tested flags clear noOvervrite
void testOverwrite(); void testOverwrite();
@ -852,7 +855,7 @@ void deploytest::testSetTargetDir() {
} }
void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, bool noWarnings) { void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree, bool noWarnings, bool onlySize) {
QuasarAppUtils::Params::parseParams(list); QuasarAppUtils::Params::parseParams(list);
@ -860,7 +863,7 @@ void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, boo
QVERIFY(deploy.run() == 0); QVERIFY(deploy.run() == 0);
if (tree) { if (tree) {
checkResults(*tree, noWarnings); checkResults(*tree, noWarnings, onlySize);
} }
#ifdef WITH_SNAP #ifdef WITH_SNAP
@ -898,7 +901,7 @@ void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, boo
#endif #endif
} }
void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings) { void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings , bool onlySize) {
TestUtils utils; TestUtils utils;
QVERIFY(DeployCore::_config); QVERIFY(DeployCore::_config);
@ -908,6 +911,11 @@ void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings) {
auto comapre = utils.compareTree(resultTree, tree); auto comapre = utils.compareTree(resultTree, tree);
if (onlySize) {
QVERIFY(resultTree.size() > tree.size());
return;
}
if (comapre.size() != 0) { if (comapre.size() != 0) {
bool bug = false; bool bug = false;
@ -976,6 +984,59 @@ void deploytest::testHelp() {
} }
} }
}
void deploytest::costomScript() {
TestUtils utils;
#ifdef Q_OS_UNIX
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
"./" + DISTRO_DIR + "/bin/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.sh"});
QString bin = TestBinDir + "TestOnlyC";
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.sh";
#else
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/TestOnlyC.bat",
"./" + DISTRO_DIR + "/qt.conf"});
QString bin = TestBinDir + "TestOnlyC.exe";
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.bat";
#endif
runTestParams({"-bin", bin, "force-clear", "noOverwrite", "-libOut", "lib"}, &comapareTree);
QFile script(scriptPath);
QVERIFY(script.open(QIODevice::ReadOnly));
auto scriptText = script.readAll();
QVERIFY(!scriptText.contains("Begin Custom Script"));
script.close();
runTestParams({"-bin", bin, "force-clear", "noOverwrite",
"-libOut", "lib",
"-customScript", "echo 'this is test script'"}, &comapareTree);
QVERIFY(script.open(QIODevice::ReadOnly));
scriptText = script.readAll();
QVERIFY(scriptText.contains("Begin Custom Script"));
QVERIFY(scriptText.contains("echo 'this is test script'"));
QVERIFY(scriptText.contains("End Custom Script"));
script.close();
} }
void deploytest::testOverwrite() { void deploytest::testOverwrite() {
@ -1226,6 +1287,35 @@ void deploytest::testConfFile() {
QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json"); QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
// Test generar string in confFile
comapareTree = Modules::qtLibs();
comapareTree = Modules::ignoreFilter(comapareTree, "/plugins/p");
#ifdef Q_OS_UNIX
comapareTree -= utils.createTree(
{
"./" + DISTRO_DIR + "/lib/libQt5EglFSDeviceIntegration.so",
"./" + DISTRO_DIR + "/lib/libQt5WebSockets.so"
});
auto bin = TestBinDir + "QtWidgetsProject";
#else
comapareTree -= utils.createTree(
{
"./" + DISTRO_DIR + "/Qt5WebSockets.dll"
});
auto bin = TestBinDir + "QtWidgetsProject.exe";
#endif
runTestParams({"-bin", bin,
"-qmake", qmake,
"clear",
"-ignore", "/plugins/p",
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
runTestParams({"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
QFile::remove(TestBinDir + "/TestConf.json");
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC"); QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
comapareTree = utils.createTree( comapareTree = utils.createTree(
@ -1694,6 +1784,61 @@ void deploytest::testSystemLib() {
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-2-0.dll", "./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-1-0.dll", "./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-util-l1-1-0.dll", "./" + DISTRO_DIR + "/api-ms-win-core-util-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Heap-Obsolete-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-localization-obsolete-l1-2-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-l2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-string-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-core-xstate-l2-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-com-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-comm-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-datetime-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-debug-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-delayload-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-errorhandling-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-fibers-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-interlocked-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-localization-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-2.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processenvironment-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-2.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-processtopology-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-realtime-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l2-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-rtlsupport-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-shutdown-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-stringansi-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-stringloader-l1-1-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-1.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-l1-2-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-legacy-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-private-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-timezone-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-url-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-version-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-wow64-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-core-xstate-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-1.dll",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll", "./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll", "./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll", "./" + DISTRO_DIR + "/libwinpthread-1.dll",
@ -1822,7 +1967,25 @@ void deploytest::testSystemLib() {
"./" + DISTRO_DIR + "/api-ms-win-crt-time-l1-1-0.dll", "./" + DISTRO_DIR + "/api-ms-win-crt-time-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-base-l1-1-0.dll", "./" + DISTRO_DIR + "/api-ms-win-security-base-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-cryptoapi-l1-1-0.dll", "./" + DISTRO_DIR + "/api-ms-win-security-cryptoapi-l1-1-0.dll",
"./" + DISTRO_DIR + "/dwmapi.dll", "./" + DISTRO_DIR + "/API-MS-Win-Eventing-Controller-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Legacy-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-1.dll",
"./" + DISTRO_DIR + "/API-MS-Win-devices-config-L1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-security-lsapolicy-l1-1-0.dll",
"./" + DISTRO_DIR + "/API-MS-Win-security-provider-L1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-conio-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-convert-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-environment-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-filesystem-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-heap-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-locale-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-multibyte-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-process-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-stdio-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-crt-utility-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-eventing-consumer-l1-1-0.dll",
"./" + DISTRO_DIR + "/api-ms-win-security-sddl-l1-1-0.dll",
"./" + DISTRO_DIR + "/mpr.dll", "./" + DISTRO_DIR + "/mpr.dll",
"./" + DISTRO_DIR + "/profapi.dll", "./" + DISTRO_DIR + "/profapi.dll",
"./" + DISTRO_DIR + "/rpcrt4.dll", "./" + DISTRO_DIR + "/rpcrt4.dll",
@ -1830,7 +1993,8 @@ void deploytest::testSystemLib() {
"./" + DISTRO_DIR + "/userenv.dll", "./" + DISTRO_DIR + "/userenv.dll",
"./" + DISTRO_DIR + "/uxtheme.dll", "./" + DISTRO_DIR + "/uxtheme.dll",
"./" + DISTRO_DIR + "/version.dll", "./" + DISTRO_DIR + "/version.dll",
"./" + DISTRO_DIR + "/win32u.dll" "./" + DISTRO_DIR + "/ucrtbase.dll",
}); });
runTestParams({"-bin", bin, "clear" , runTestParams({"-bin", bin, "clear" ,
@ -1838,6 +2002,7 @@ void deploytest::testSystemLib() {
"deploySystem" "deploySystem"
}, &comapareTree, true); }, &comapareTree, true);
#endif #endif
} }

View File

@ -55,10 +55,10 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| | Examples:" }, | | Examples:" },
| | cqtdeployer qif - for use default templates of qt installer framework." | | | cqtdeployer qif - for use default templates of qt installer framework." |
| | cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." | | | cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." |
| -customScript [scriptCode] | Insert extra code inTo All run script. |
| deploySystem | Deploys all libraries | | deploySystem | Deploys all libraries |
| clear | Deletes deployable files of the previous session. | | clear | Deletes deployable files of the previous session. |
| force-clear | Deletes the destination directory before deployment. | | force-clear | Deletes the destination directory before deployment. |
| | For example -runScript myApp.sh |
| allQmlDependes | Extracts all the qml libraries. | | allQmlDependes | Extracts all the qml libraries. |
| | (not recommended, as it takes great amount of computer memory) | | | (not recommended, as it takes great amount of computer memory) |
| version / v | Shows compiled version | | version / v | Shows compiled version |
@ -130,6 +130,7 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| | Примеры:" }, | | Примеры:" },
| | cqtdeployer qif - для использования стандартных шаблонов фреймворка qt. "| | | cqtdeployer qif - для использования стандартных шаблонов фреймворка qt. "|
| | cqtdeployer -qif path/to/folder/with/qifTemplate - для использования пользовательских шаблонов среды установки qt. "| | | cqtdeployer -qif path/to/folder/with/qifTemplate - для использования пользовательских шаблонов среды установки qt. "|
| -customScript [scriptCode] | Установит дополнительный код в скрипты запуска. |
| -extraPlugin [list,params] | Устанавливает дополнительный путь для extraPlugin приложения | | -extraPlugin [list,params] | Устанавливает дополнительный путь для extraPlugin приложения |
| -recursiveDepth [params] | Устанавливает глубину поиска библиотек (по умолчанию 0) | | -recursiveDepth [params] | Устанавливает глубину поиска библиотек (по умолчанию 0) |
| -targetDir [params] | Устанавливает целевой каталог (по умолчанию это путь к первому развертываемому файлу)| | -targetDir [params] | Устанавливает целевой каталог (по умолчанию это путь к первому развертываемому файлу)|
@ -138,7 +139,6 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| deploySystem | Копирует все библиотеки кроме libc | | deploySystem | Копирует все библиотеки кроме libc |
| clear | Удаляет все старые файлы (с прошлого запуска) | | clear | Удаляет все старые файлы (с прошлого запуска) |
| force-clear | Удаляет целевую директорию перед развертыванием | | force-clear | Удаляет целевую директорию перед развертыванием |
| | пример -runScript myApp.sh |
| allQmlDependes | Извлекает все библиотеки qml. | | allQmlDependes | Извлекает все библиотеки qml. |
| | (не рекомендуется, так как занимает много памяти) | | | (не рекомендуется, так как занимает много памяти) |
| deploySystem-with-libc | Копирует все зависимости в том числе и libc | | deploySystem-with-libc | Копирует все зависимости в том числе и libc |