Merge pull request #656 from QuasarApp/v1.5.4

CQtDeployer 1.5.4
This commit is contained in:
Andrei Yankovich 2021-09-04 18:08:39 +03:00 committed by GitHub
commit 2b8c4bbe0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 356 additions and 104 deletions

View File

@ -60,8 +60,7 @@ bool Deb::deployTemplate(PackageControl &pkg) {
QuasarAppUtils::Params::log("Failed to set permissions", QuasarAppUtils::Warning); QuasarAppUtils::Params::log("Failed to set permissions", QuasarAppUtils::Warning);
} }
outFiles.push_back(DeployCore::_config->getTargetDir() + "/" + info.Name + ".deb"); inouts.push_back({local, cfg->getTargetDir() + "/" + info.debOut});
packageFolders.push_back(local);
} }
return true; return true;
@ -117,30 +116,19 @@ QProcessEnvironment Deb::processEnvirement() const {
QList<SystemCommandData> Deb::runCmd() { QList<SystemCommandData> Deb::runCmd() {
QList<SystemCommandData> res; QList<SystemCommandData> res;
for (const auto& dir: qAsConst(packageFolders)) { for (const auto& inout: qAsConst(inouts)) {
res.push_back({"dpkg-deb", QStringList{"--build", "--verbose"} << dir}); res.push_back({"dpkg-deb", QStringList{"--build", "--verbose"} << inout.input << inout.output});
} }
return res; return res;
} }
QStringList Deb::outPutFiles() const { QStringList Deb::outPutFiles() const {
return outFiles; QStringList result;
} for (const auto& inout: qAsConst(inouts)) {
result.push_back(inout.output);
bool Deb::cb() const {
const DeployConfig* cfg = DeployCore::_config;
QString from = cfg->getTargetDir() + "/" + getLocation() + "/";
QString to = cfg->getTargetDir() + "/" + getLocation() + "/../";
auto const outputFiles = outPutFiles();
for (const QString& file : outputFiles) {
if(!moveData(from + PathUtils::getName(file), to, "")) {
return false;
}
} }
return result;
return true;
} }
QString Deb::dataLocation(const DistroModule &module) const { QString Deb::dataLocation(const DistroModule &module) const {

View File

@ -3,6 +3,14 @@
#include "idistribution.h" #include "idistribution.h"
/**
* @brief The DebInOut struct contains input and output value of the debian packages.
*/
struct DebInOut {
QString input;
QString output;
};
/** /**
* @brief The deb class contains methods for create a debian pacakge. * @brief The deb class contains methods for create a debian pacakge.
*/ */
@ -21,7 +29,6 @@ public:
QProcessEnvironment processEnvirement() const override; QProcessEnvironment processEnvirement() const override;
QList<SystemCommandData> runCmd() override; QList<SystemCommandData> runCmd() override;
QStringList outPutFiles() const override; QStringList outPutFiles() const override;
bool cb() const override;
// iDistribution interface // iDistribution interface
protected: protected:
@ -30,8 +37,7 @@ protected:
QString releativeLocation(const DistroModule &module) const override; QString releativeLocation(const DistroModule &module) const override;
private: private:
QStringList outFiles; QList<DebInOut> inouts;
QStringList packageFolders;
}; };
#endif // DEB_H #endif // DEB_H

View File

@ -198,6 +198,14 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
if (!pkg.installDirDEB().isEmpty()) if (!pkg.installDirDEB().isEmpty())
info.InstallDirDEB = pkg.installDirDEB(); info.InstallDirDEB = pkg.installDirDEB();
info.debOut = info.Name + ".deb";
if (!pkg.debOut().isEmpty())
info.debOut = pkg.debOut();
info.zipOut = info.Name + ".zip";
if (!pkg.zipOut().isEmpty())
info.zipOut = pkg.zipOut();
info.Prefix = releativeLocation(pkg); info.Prefix = releativeLocation(pkg);
QString cmdArray = "["; QString cmdArray = "[";
@ -221,7 +229,7 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
bashShortCutsArray += "\"" + targetInfo.getRunScriptFile() + "\""; bashShortCutsArray += "\"" + targetInfo.getRunScriptFile() + "\"";
} }
if (fileinfo.suffix().compare("exe", ONLY_WIN_CASE_INSENSIATIVE) == 0 || fileinfo.suffix().isEmpty()) { if (fileinfo.suffix().compare("exe", Qt::CaseInsensitive) == 0 || fileinfo.suffix().isEmpty()) {
if (cmdArray.size() > initSize) { if (cmdArray.size() > initSize) {
cmdArray += ","; cmdArray += ",";
bashArray += " "; bashArray += " ";

View File

@ -72,13 +72,20 @@ QList<SystemCommandData> QIF::runCmd() {
cmd.arguments = QStringList{ cmd.arguments = QStringList{
"-c", "-c",
location + "/config/config.xml", QuasarAppUtils::Params::getArg("qifConfig", location + "/config/config.xml"),
"-p", "-p",
location + "/packages/", QuasarAppUtils::Params::getArg("qifPackages", location + "/packages/"),
"-v", "-v"
installerFile()
}; };
QString resources = QuasarAppUtils::Params::getArg("qifResources");
if (resources.size()) {
cmd.arguments.push_back("-r");
cmd.arguments.push_back(resources);
}
cmd.arguments.push_back(installerFile());
return {cmd}; return {cmd};
} }

View File

@ -19,6 +19,9 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
QString Homepage; QString Homepage;
QString Prefix; QString Prefix;
QString InstallDirDEB; QString InstallDirDEB;
QString zipOut;
QString debOut;
QString InstallDeirQIFW() const; QString InstallDeirQIFW() const;
QHash<QString, QString> Custom; QHash<QString, QString> Custom;

View File

@ -38,7 +38,7 @@ bool ZipArhive::deployTemplate(PackageControl &pkg) {
return false; return false;
} }
auto arr = cfg->getTargetDir() + "/" + info.Name + ".zip"; auto arr = cfg->getTargetDir() + "/" + info.zipOut;
if (!zipWorker.compress(local, arr)) { if (!zipWorker.compress(local, arr)) {
return false; return false;
} }

View File

@ -465,6 +465,12 @@ bool ConfigParser::initDistroStruct() {
auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb"). auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb").
split(DeployCore::getSeparator(0), splitbehavior); split(DeployCore::getSeparator(0), splitbehavior);
auto debOut = QuasarAppUtils::Params::getArg("debOut").
split(DeployCore::getSeparator(0), splitbehavior);
auto zipOut = QuasarAppUtils::Params::getArg("zipOut").
split(DeployCore::getSeparator(0), splitbehavior);
// init distro stucts for all targets // init distro stucts for all targets
if (binOut.size() && !parsePackagesPrivate(mainDistro, binOut, &DistroModule::setBinOutDir)) { if (binOut.size() && !parsePackagesPrivate(mainDistro, binOut, &DistroModule::setBinOutDir)) {
packagesErrorLog("binOut"); packagesErrorLog("binOut");
@ -551,6 +557,16 @@ bool ConfigParser::initDistroStruct() {
return false; return false;
} }
if (debOut.size() && !parsePackagesPrivate(mainDistro, debOut, &DistroModule::setDebOut)) {
packagesErrorLog("debOut");
return false;
}
if (zipOut.size() && !parsePackagesPrivate(mainDistro, zipOut, &DistroModule::setZipOut)) {
packagesErrorLog("zipOut");
return false;
}
return true; return true;
} }

View File

@ -149,7 +149,7 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS
if (!scanedLib.isValid()) { if (!scanedLib.isValid()) {
QSet<LibInfo> listDep = {}; QSet<LibInfo> listDep = {};
if (!lib._name.compare(dep.value()._name, ONLY_WIN_CASE_INSENSIATIVE)) if (!lib._name.compare(dep.value()._name, DeployCore::getCaseSensitivity(lib._name)))
continue; continue;
recursiveDep(*dep, listDep, libStack); recursiveDep(*dep, listDep, libStack);

View File

@ -14,12 +14,6 @@
#define DISTRO_DIR QString("DistributionKit") #define DISTRO_DIR QString("DistributionKit")
#ifdef Q_OS_WIN
#define ONLY_WIN_CASE_INSENSIATIVE Qt::CaseInsensitive
#else
#define ONLY_WIN_CASE_INSENSIATIVE Qt::CaseSensitive
#endif
#if defined(DEPLOY_LIBRARY) #if defined(DEPLOY_LIBRARY)
# define DEPLOYSHARED_EXPORT Q_DECL_EXPORT # define DEPLOYSHARED_EXPORT Q_DECL_EXPORT
#else #else

View File

@ -105,12 +105,12 @@ DeployCore::QtModule DeployCore::getQtModule(const QString& path) {
void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) { void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) {
QuasarAppUtils::Params::log("Current module " + QString::number(module), QuasarAppUtils::Params::log("Current module " + QString::number(module),
QuasarAppUtils::Debug); QuasarAppUtils::Debug);
auto mod = getQtModule(path); auto mod = getQtModule(path);
QuasarAppUtils::Params::log("Add new module from path " + path + QuasarAppUtils::Params::log("Add new module from path " + path +
" module value " + QString::number(mod), " module value " + QString::number(mod),
QuasarAppUtils::Debug); QuasarAppUtils::Debug);
module = static_cast<DeployCore::QtModule>( module = static_cast<DeployCore::QtModule>(
@ -251,15 +251,15 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"deb", "-deb"}, "", {"deb", "-deb"}, "",
"Create the deb package for deployment programm" "Create the deb package for deployment programm"
" You can specify the path to your own debian template.", " You can specify the path to your own debian template.",
"cqtdeployer -deb path/to/myCustom/DEBIAN." "cqtdeployer -deb path/to/myCustom/DEBIAN."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"deploySystem"}, "", {"deploySystem"}, "",
"Deploys all libraries." "Deploys all libraries."
" Not recomendet because there may be conflicts with system libraries" " Not recomendet because there may be conflicts with system libraries"
" (on snap version you need to turn on permission)" " (on snap version you need to turn on permission)"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"noQt"}, "", {"noQt"}, "",
@ -271,10 +271,10 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"getDefaultTemplate"}, "", {"getDefaultTemplate"}, "",
"Extracts defaults deb or qif templates." "Extracts defaults deb or qif templates."
" All templates extract into targetDirectory." " All templates extract into targetDirectory."
" For change target directory use the targetDir option.", " For change target directory use the targetDir option.",
"cqtdeployer -bin myExecutable getDefaultTemplate qif deb." "cqtdeployer -bin myExecutable getDefaultTemplate qif deb."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"noHashSum"}, "", {"noHashSum"}, "",
@ -302,10 +302,10 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-confFile"}, "{params}", {"-confFile"}, "{params}",
"The path to the json file with all deployment configurations. Using this file," "The path to the json file with all deployment configurations. Using this file,"
" you can add the necessary options, thereby simplifying the command invocation in the console." " you can add the necessary options, thereby simplifying the command invocation in the console."
" However, the parameters in Kansol have a higher priority than in the file." " However, the parameters in Kansol have a higher priority than in the file."
" For more info about this flag see https://github.com/QuasarApp/CQtDeployer/wiki/DeployConfigFileEn" " For more info about this flag see https://github.com/QuasarApp/CQtDeployer/wiki/DeployConfigFileEn"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-qmlDir"}, "{params}", {"-qmlDir"}, "{params}",
@ -336,8 +336,8 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
{"-extraLibs"}, "{list,params}", {"-extraLibs"}, "{list,params}",
"Sets the mask of the library name for forced copying.", "Sets the mask of the library name for forced copying.",
"\"-extraLib mySql\" - forces to copy all libraries whose names contain mySql to the project folder." "\"-extraLib mySql\" - forces to copy all libraries whose names contain mySql to the project folder."
" This option is case-insensitive on Windows and case-sensitive on other platforms." " This option is case-insensitive on Windows and case-sensitive on other platforms."
" This option will only search libraries in system environments similar to **deploySystem**." " This option will only search libraries in system environments similar to **deploySystem**."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-customScript"}, "{scriptCode}", {"-customScript"}, "{scriptCode}",
@ -350,23 +350,15 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
{"-recursiveDepth"}, "{params}", {"-recursiveDepth"}, "{params}",
"Sets the Depth of recursive search of libs and depth for ignoreEnv option (default 0)" "Sets the Depth of recursive search of libs and depth for ignoreEnv option (default 0)"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{
{"-targetDir"}, "{params}",
"Sets target directory(by default it is the path to the first deployable file)"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-installDirDeb"}, "{params}",
"Sets install target directory fordebian package (by default it is /opt path)"
}});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-installDirQIFW"}, "{params}", {"-installDirQIFW"}, "{params}",
"Sets install target directory for installers (by default it is /home path)" "Sets install target directory for installers (by default it is /home path)"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-runScript"}, "{list,parems}", {"-runScript"}, "{list,parems}",
"forces cqtdeployer swap default run script to new from the arguments of option." "forces cqtdeployer swap default run script to new from the arguments of option."
" This option copy all content from input file and insert all code into runScript.sh or .bat", " This option copy all content from input file and insert all code into runScript.sh or .bat",
"cqtdeployer -runScript \"myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh\"" "cqtdeployer -runScript \"myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh\""
}}); }});
group = "Part 3 Control of packages options"; group = "Part 3 Control of packages options";
@ -374,7 +366,7 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-targetPackage"}, "{package;tar1,package;tar2}", {"-targetPackage"}, "{package;tar1,package;tar2}",
"Creates a new package and adds 'tar1 and tar2' to it. " "Creates a new package and adds 'tar1 and tar2' to it. "
"If you want configure the package that do not have any targets use the allowEmptyPackages option." "If you want configure the package that do not have any targets use the allowEmptyPackages option."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-qmlOut"}, "{package;path,path}", {"-qmlOut"}, "{package;path,path}",
@ -408,7 +400,7 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-name"}, "{package;val,val}", {"-name"}, "{package;val,val}",
"Sets name for a package." "Sets name for a package."
"If this if you do not specify a package, the value will be assigned to the default package ("")" "If this if you do not specify a package, the value will be assigned to the default package ("")"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-description"}, "{package;val,val}", {"-description"}, "{package;val,val}",
@ -443,7 +435,7 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
"Adds qm files into the translations folder." "Adds qm files into the translations folder."
}}); }});
group = "Part 4 Control of packages options"; group = "Part 4 Control of target options";
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-icon"}, "{target;val,val}", {"-icon"}, "{target;val,val}",
@ -466,16 +458,16 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-enablePlugins"}, "{package;val1;val2,SingeleVa}", {"-enablePlugins"}, "{package;val1;val2,SingeleVa}",
"Enables additional plugins for distribution." "Enables additional plugins for distribution."
" By default disabled next plugins: " + PluginsParser::defaultForbidenPlugins().join(',') + " if you want enable" " By default disabled next plugins: " + PluginsParser::defaultForbidenPlugins().join(',') + " if you want enable"
" it then use '-enablePlugins " + PluginsParser::defaultForbidenPlugins().join(',') + "' option" " it then use '-enablePlugins " + PluginsParser::defaultForbidenPlugins().join(',') + "' option"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-disablePlugins"}, "{package;val1;val2,SingeleVal}", {"-disablePlugins"}, "{package;val1;val2,SingeleVal}",
"Disables plugins for distribution. " "Disables plugins for distribution. "
"You can disable any plugin of your Qt build, just see the yourQtFolder/plugins forlder for available plugins." "You can disable any plugin of your Qt build, just see the yourQtFolder/plugins forlder for available plugins."
" Example if you want disable qxcb plugin: -disablePlugins qxcb." " Example if you want disable qxcb plugin: -disablePlugins qxcb."
" Note that the name of the plugin is indicated without its extension" " Note that the name of the plugin is indicated without its extension"
}}); }});
group = "Part 6 QtInstallFramework options"; group = "Part 6 QtInstallFramework options";
@ -497,6 +489,43 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
{"-qifOut"}, "{nameOfOutputInstallerFile}", {"-qifOut"}, "{nameOfOutputInstallerFile}",
"Sets name of output qifw installer. Note: on Windows, the exe suffix will be added to the installer automatically." "Sets name of output qifw installer. Note: on Windows, the exe suffix will be added to the installer automatically."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{
{"-qifConfig"}, "{path/to/config.xml}",
"Sets a custom path to the configure file of the qt ifw installer. By default it is qif/config/config.xml"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-qifPackages"}, "{path/to/packagesFodoler}",
"Sets a custom path to the packages directories. By default it is qif/packages"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-qifResources"}, "{path/to/resources1.qrc,path/to/resources2.qrc}",
"Sets a custom path to the resources files. By default this option is skipped"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-targetDir"}, "{params}",
"Sets target directory(by default it is the path to the first deployable file)"
}});
group = "Part 7 Deb package options";
help.insert(group, {QuasarAppUtils::OptionData{
{"-debOut"}, "{package;nameOfOutputDebFile,nameOfOutputDebFile}",
"Sets name of the output debian file. This option can be work with multiple packages"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-installDirDeb"}, "{params}",
"Sets install target directory fordebian package (by default it is /opt path)"
}});
group = "Part 8 zip package options";
help.insert(group, {QuasarAppUtils::OptionData{
{"-zipOut"}, "{package;nameOfOutputZipFile,nameOfOutputZipFile}",
"Sets name of the output zip arrhive. This option can be work with multiple packages"
}});
return help; return help;
} }
@ -589,7 +618,7 @@ QString DeployCore::findProcess(const QString &env, const QString& proc) {
auto files = QDir(path).entryInfoList(QDir::NoDotAndDotDot | QDir::Files); auto files = QDir(path).entryInfoList(QDir::NoDotAndDotDot | QDir::Files);
for (const auto& bin : files) { for (const auto& bin : files) {
if (bin.baseName().compare(proc, ONLY_WIN_CASE_INSENSIATIVE) == 0) { if (bin.baseName().compare(proc, DeployCore::getCaseSensitivity()) == 0) {
return bin.absoluteFilePath(); return bin.absoluteFilePath();
} }
} }
@ -605,7 +634,7 @@ QStringList DeployCore::debugExtensions() {
bool DeployCore::isDebugFile(const QString &file) { bool DeployCore::isDebugFile(const QString &file) {
auto debug = debugExtensions(); auto debug = debugExtensions();
for (const auto& debugEx: debug) { for (const auto& debugEx: debug) {
if (file.contains(debugEx, ONLY_WIN_CASE_INSENSIATIVE)) { if (file.contains(debugEx, Qt::CaseInsensitive)) {
return true; return true;
} }
} }
@ -752,11 +781,11 @@ QtMajorVersion DeployCore::isQtLibName(const QString &lib) {
} }
QString fileName = info.fileName(); QString fileName = info.fileName();
if (fileName.contains("Qt4", ONLY_WIN_CASE_INSENSIATIVE)) { if (fileName.contains("Qt4", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt4; isQt = QtMajorVersion::Qt4;
} else if (fileName.contains("Qt5", ONLY_WIN_CASE_INSENSIATIVE)) { } else if (fileName.contains("Qt5", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt5; isQt = QtMajorVersion::Qt5;
} else if (fileName.contains("Qt6", ONLY_WIN_CASE_INSENSIATIVE)) { } else if (fileName.contains("Qt6", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt6; isQt = QtMajorVersion::Qt6;
} }
@ -774,8 +803,8 @@ bool DeployCore::isExtraLib(const QString &lib) {
} }
bool DeployCore::isAlienLib(const QString &lib) { bool DeployCore::isAlienLib(const QString &lib) {
return lib.contains("/opt/", ONLY_WIN_CASE_INSENSIATIVE) || return lib.contains("/opt/", Qt::CaseSensitive) ||
lib.contains("/PROGRAM FILES", ONLY_WIN_CASE_INSENSIATIVE); lib.contains("/PROGRAM FILES", Qt::CaseInsensitive);
} }
bool DeployCore::isAllowedLib(const QString &lib) { bool DeployCore::isAllowedLib(const QString &lib) {
@ -920,6 +949,25 @@ QFileInfo DeployCore::findItem(const QString &bin) {
} }
return QFileInfo(bin); return QFileInfo(bin);
}
Qt::CaseSensitivity DeployCore::getCaseSensitivity(const QString &checkedFile) {
if (checkedFile.isEmpty()) {
#ifdef Q_OS_WIN
return Qt::CaseInsensitive;
#else
return Qt::CaseSensitive;
#endif
}
QString sufix = QFileInfo(checkedFile).completeSuffix();
if (sufix.compare("dll", Qt::CaseInsensitive) == 0 ||
sufix.compare("exe", Qt::CaseInsensitive)) {
return Qt::CaseInsensitive;
}
return Qt::CaseSensitive;
}; };
QString DeployCore::systemLibsFolderName() { QString DeployCore::systemLibsFolderName() {

View File

@ -303,6 +303,12 @@ public:
*/ */
static QFileInfo findItem(const QString &file); static QFileInfo findItem(const QString &file);
/**
* @brief getCaseSensitivity This method return case sensitivity for a @a checkedFile. Usually return Qt::CaseSensiativy exept windows binaryes files like a dll and exe.
* @param checkedFile This is checked file. By default empty value.
* @return Qt CaseSensitivity value
*/
static Qt::CaseSensitivity getCaseSensitivity(const QString& checkedFile = "");
}; };
#define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__) #define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__)

View File

@ -148,6 +148,22 @@ void DistroModule::setKey(const QString &key) {
_key = key; _key = key;
} }
const QString &DistroModule::zipOut() const {
return _zipOut;
}
void DistroModule::setZipOut(const QString &newZipOut) {
_zipOut = newZipOut;
}
const QString &DistroModule::debOut() const {
return _debOut;
}
void DistroModule::setDebOut(const QString &newDebOut) {
_debOut = newDebOut;
}
QString DistroModule::installDirDEB() const { QString DistroModule::installDirDEB() const {
if (_installDirDEB.isEmpty()) if (_installDirDEB.isEmpty())
return "/opt"; return "/opt";

View File

@ -77,6 +77,30 @@ public:
QString installDirDEB() const; QString installDirDEB() const;
void setInstallDirDEB(const QString &newInstallDir); void setInstallDirDEB(const QString &newInstallDir);
/**
* @brief debOut This method return output filePath to debian pacakge
* @return output filePath to debian pacakge
*/
const QString &debOut() const;
/**
* @brief setDebOut This method sets new value of debian outpup path.
* @param newDebOut This is new value of the debian output
*/
void setDebOut(const QString &newDebOut);
/**
* @brief debOut This method return output filePath to zip pacakge
* @return output filePath to zip pacakge
*/
const QString &zipOut() const;
/**
* @brief setDebOut This method sets new value of zip outpup path.
* @param newDebOut This is new value of the zip output
*/
void setZipOut(const QString &newZipOut);
protected: protected:
void setKey(const QString &key); void setKey(const QString &key);
@ -105,7 +129,8 @@ private:
QSet<QString> _tr; QSet<QString> _tr;
QString _installDirDEB; QString _installDirDEB;
QString _debOut;
QString _zipOut;
}; };

View File

@ -390,7 +390,7 @@ void Extracter::extractLib(const QString &file,
for (const auto &line : data.getAllDep()) { for (const auto &line : data.getAllDep()) {
if (mask.size() && !line.getName().contains(mask, ONLY_WIN_CASE_INSENSIATIVE)) { if (mask.size() && !line.getName().contains(mask, DeployCore::getCaseSensitivity())) {
continue; continue;
} }

View File

@ -178,7 +178,7 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
bool copy = !masks; bool copy = !masks;
if (masks) { if (masks) {
for (const auto &mask : qAsConst(*masks)) { for (const auto &mask : qAsConst(*masks)) {
if (info.absoluteFilePath().contains(mask, ONLY_WIN_CASE_INSENSIATIVE)) { if (info.absoluteFilePath().contains(mask, DeployCore::getCaseSensitivity())) {
copy = true; copy = true;
break; break;
} }
@ -263,7 +263,7 @@ bool FileManager::smartCopyFile(const QString &file,
bool ifFileTarget) { bool ifFileTarget) {
auto config = DeployCore::_config; auto config = DeployCore::_config;
if (file.contains(config->getTargetDir(), ONLY_WIN_CASE_INSENSIATIVE)) { if (file.contains(config->getTargetDir(), DeployCore::getCaseSensitivity())) {
if (!moveFile(file, target, mask)) { if (!moveFile(file, target, mask)) {
QuasarAppUtils::Params::log("Failed to move the file. Trying to copy it"); QuasarAppUtils::Params::log("Failed to move the file. Trying to copy it");
@ -309,7 +309,7 @@ bool FileManager::copyFolder(const QString &from,
if (!force) { if (!force) {
QString skipFilter = ""; QString skipFilter = "";
for (const auto &i: filter) { for (const auto &i: filter) {
if (item.fileName().contains(i, ONLY_WIN_CASE_INSENSIATIVE)) { if (item.fileName().contains(i, DeployCore::getCaseSensitivity())) {
skipFilter = i; skipFilter = i;
break; break;
} }
@ -496,7 +496,7 @@ bool FileManager::copyFiles(const QStringList &source,
QString skipFilter = ""; QString skipFilter = "";
for (const auto &i: filter) { for (const auto &i: filter) {
if (info.fileName().contains(i, ONLY_WIN_CASE_INSENSIATIVE)) { if (info.fileName().contains(i, DeployCore::getCaseSensitivity())) {
skipFilter = i; skipFilter = i;
break; break;
} }

View File

@ -27,7 +27,7 @@ void IgnoreRule::addRule(const IgnoreData &rule) {
} }
bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const { bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const {
if (info.fullPath().contains(ignoreLabel, ONLY_WIN_CASE_INSENSIATIVE)) { if (info.fullPath().contains(ignoreLabel, DeployCore::getCaseSensitivity())) {
QuasarAppUtils::Params::log(info.fullPath() + " ignored by filter" + ignoreLabel); QuasarAppUtils::Params::log(info.fullPath() + " ignored by filter" + ignoreLabel);
return true; return true;
} }

View File

@ -86,11 +86,11 @@ bool QtDir::isQt(QString path) const {
path = PathUtils::fixPath(path); path = PathUtils::fixPath(path);
return return
(!libs.isEmpty() && path.contains(libs, ONLY_WIN_CASE_INSENSIATIVE)) || (!libs.isEmpty() && path.contains(libs, DeployCore::getCaseSensitivity())) ||
(!bins.isEmpty() && path.contains(bins, ONLY_WIN_CASE_INSENSIATIVE)) || (!bins.isEmpty() && path.contains(bins, DeployCore::getCaseSensitivity())) ||
(!libexecs.isEmpty() && path.contains(libexecs, ONLY_WIN_CASE_INSENSIATIVE)) || (!libexecs.isEmpty() && path.contains(libexecs, DeployCore::getCaseSensitivity())) ||
(!plugins.isEmpty() && path.contains(plugins, ONLY_WIN_CASE_INSENSIATIVE)) || (!plugins.isEmpty() && path.contains(plugins, DeployCore::getCaseSensitivity())) ||
(!qmls.isEmpty() && path.contains(qmls, ONLY_WIN_CASE_INSENSIATIVE)) || (!qmls.isEmpty() && path.contains(qmls, DeployCore::getCaseSensitivity())) ||
(!translations.isEmpty() && path.contains(translations, ONLY_WIN_CASE_INSENSIATIVE)) || (!translations.isEmpty() && path.contains(translations, DeployCore::getCaseSensitivity())) ||
(!resources.isEmpty() && path.contains(resources, ONLY_WIN_CASE_INSENSIATIVE)); (!resources.isEmpty() && path.contains(resources, DeployCore::getCaseSensitivity()));
} }

View File

@ -1,10 +1,10 @@
include($$PWD/InstallerBase.pri); include($$PWD/InstallerBase.pri);
mkpath( $$PWD/../Distro) mkpath( $$PWD/../Distro)
win32:OUT_FILE = CQtDeployerInstaller.exe win32:OUT_FILE = CQtDeployer_$$VERSION_Installer_Win64.exe
unix:OUT_FILE = CQtDeployerInstaller.run unix:OUT_FILE = CQtDeployer_$$VERSION_Installer_Linux64.run
win32:OUT_FILE_OFF = CQtDeployerOfflineInstaller.exe win32:OUT_FILE_OFF = CQtDeployer_$$VERSION_OfflineInstaller_Win64.exe
unix:OUT_FILE_OFF = CQtDeployerOfflineInstaller.run unix:OUT_FILE_OFF = CQtDeployer_$$VERSION_OfflineInstaller_Linux64.run
DEPLOY_TARGET = $$PWD/../CQtDeployer/build/release DEPLOY_TARGET = $$PWD/../CQtDeployer/build/release

View File

@ -20,7 +20,7 @@ ModulesQt513::~ModulesQt513() {
QSet<QString> ModulesQt513::ignoreFilter(const QSet<QString> &input, const QString &filter) const { QSet<QString> ModulesQt513::ignoreFilter(const QSet<QString> &input, const QString &filter) const {
QSet<QString> res; QSet<QString> res;
for (auto& val : input) { for (auto& val : input) {
if (!val.contains(filter, ONLY_WIN_CASE_INSENSIATIVE)) { if (!val.contains(filter, DeployCore::getCaseSensitivity())) {
res.insert(val); res.insert(val);
} }
} }

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>customconfig.xml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>Stylesheet Example</Name>
<Version>1.0.0</Version>
<Title>Stylesheet Example</Title>
<Publisher>Qt-Project</Publisher>
<StartMenuDir>Qt IFW Examples</StartMenuDir>
<TargetDir>@HomeDir@/IfwExamples/stylesheet</TargetDir>
<WizardStyle>Classic</WizardStyle>
<TitleColor>#FFFFFF</TitleColor>
</Installer>

View File

@ -0,0 +1,39 @@
/**************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
**
** $QT_END_LICENSE$
**
**************************************************************************/
function Component()
{
// constructor
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>Dummy</DisplayName>
<ReleaseDate>2015-09-09</ReleaseDate>
<Version>1.0.1</Version>
<Default>true</Default>
<Script>installscript.qs</Script>
</Package>

View File

@ -190,6 +190,8 @@ private slots:
// note: this test checking in manual mode only. // note: this test checking in manual mode only.
void testInstallDirsOptions(); void testInstallDirsOptions();
void testQIFResources();
void customTest(); void customTest();
}; };
@ -1529,12 +1531,25 @@ void deploytest::testQifOut() {
QString bin = TestBinDir + "TestOnlyC.exe"; QString bin = TestBinDir + "TestOnlyC.exe";
#endif #endif
auto result = utils.createTree({{DISTRO_DIR + "/QIF_OUT.exe"}, #ifdef Q_OS_UNIX
{DISTRO_DIR + "/QIF_OUT.exe.md5"}}); auto result = utils.createTree({{DISTRO_DIR + "/QIF_OUT.exe"}, {DISTRO_DIR + "/QIF_OUT.exe.md5"},
{DISTRO_DIR + "/DEB_OUT.deb"}, {DISTRO_DIR + "/DEB_OUT.deb.md5"},
{DISTRO_DIR + "/ZIP_OUT.zip"}, {DISTRO_DIR + "/ZIP_OUT.zip.md5"}});
// Run deploy installer // Run deploy installer
runTestParams({"-bin", bin, "clear", runTestParams({"-bin", bin, "clear",
"qif", "-qifOut", "QIF_OUT.exe"}, &result); "qif", "-qifOut", "QIF_OUT.exe",
"deb", "-debOut", "DEB_OUT.deb",
"zip", "-zipOut", "ZIP_OUT.zip"}, &result);
#else
auto result = utils.createTree({{DISTRO_DIR + "/QIF_OUT.exe"}, {DISTRO_DIR + "/QIF_OUT.exe.md5"},
{DISTRO_DIR + "/ZIP_OUT.zip"}, {DISTRO_DIR + "/ZIP_OUT.zip.md5"}});
// Run deploy installer
runTestParams({"-bin", bin, "clear",
"qif", "-qifOut", "QIF_OUT.exe",
"zip", "-zipOut", "ZIP_OUT.zip"}, &result);
#endif
} }
void deploytest::testIgnoreEnvWithLibDir() { void deploytest::testIgnoreEnvWithLibDir() {
@ -1575,6 +1590,35 @@ void deploytest::testInstallDirsOptions() {
#endif #endif
} }
void deploytest::testQIFResources() {
TestUtils utils;
#ifdef Q_OS_UNIX
QString bin = {TestBinDir + "TestOnlyC"};
auto result = utils.createTree({{DISTRO_DIR + "/InstallerTestOnlyC.run"},
{DISTRO_DIR + "/InstallerTestOnlyC.run.md5"}});
#else
QString bin = {TestBinDir + "TestOnlyC.exe"};
auto result = utils.createTree({{DISTRO_DIR + "/InstallerTestOnlyC.exe"},
{DISTRO_DIR + "/InstallerTestOnlyC.exe.md5"}});
#endif
auto templateDir = TestBinDir + "/../../UnitTests/testRes/QIFCustomTemplate";
runTestParams({
"-bin", bin,
"clear",
"qif",
"-qifConfig", templateDir + "/customconfig.xml",
"-qifPackages", templateDir + "/custompackages",
"-qifResources", templateDir + "customRes.qrc"
}, &result
);
}
void deploytest::customTest() { void deploytest::customTest() {
//runTestParams({"-confFile", "", //runTestParams({"-confFile", "",
// "qifFromSystem"}); // "qifFromSystem"});

View File

@ -152,6 +152,20 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| -qifBanner [path/to/banner.png]| Sets path to the banner png file. | | -qifBanner [path/to/banner.png]| Sets path to the banner png file. |
| -qifLogo [path/to/logo.png]| Sets path to the logo png file. | | -qifLogo [path/to/logo.png]| Sets path to the logo png file. |
| -qifOut [nameOfOutputInstallerFile] | Sets name of output qifw installer. Note: on Windows, the exe suffix will be added to the installer automatically. | | -qifOut [nameOfOutputInstallerFile] | Sets name of output qifw installer. Note: on Windows, the exe suffix will be added to the installer automatically. |
| -qifConfig [path/to/config.xml] | Sets a custom path to the configure file of the qt ifw installer. By default it is qif/config/config.xml |
| -qifPackages [path/to/packagesFodoler] | Sets a custom path to the packages directories. By default it is qif/packages |
| -qifResources [path/to/resources1.qrc,path/to/resources2.qrc] | Sets a custom path to the resources files. By default this option is skipped |
### Deb package options
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -debOut [package;nameOfOutputDebFile,nameOfOutputDebFile]| Sets name of the output debian file. This option can be work with multiple packages |
### Zip pacakge options
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -debOut [package;nameOfOutputZipFile,nameOfOutputZipFile]| Sets name of the output zip arrhive. This option can be work with multiple packages |
#### Example: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.15.4/gcc_64/bin/qmake clear #### Example: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.15.4/gcc_64/bin/qmake clear

View File

@ -148,7 +148,21 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| -qifBanner [path/to/banner.png]| Устанавливает путь к png-файлу баннера. | | -qifBanner [path/to/banner.png]| Устанавливает путь к png-файлу баннера. |
| -qifLogo [path/to/logo.png]| Устанавливает путь к файлу логотипа png. | | -qifLogo [path/to/logo.png]| Устанавливает путь к файлу логотипа png. |
| -qifOut [nameOfOutputInstallerFile] | Устанавливает имя выходного установщика qifw. Примечание: для установщика Windows автоматически добавляется суффикс exe. | | -qifOut [nameOfOutputInstallerFile] | Устанавливает имя выходного установщика qifw. Примечание: для установщика Windows автоматически добавляется суффикс exe. |
| -qifConfig [path/to/config.xml] | Устанавливает пользовательский путь к файлу конфигурации установщика qt ifw. По умолчанию это qif/config/config.xml |
| -qifPackages [path/to/packagesFodoler] | Устанавливает пользовательский путь к каталогам пакетов. По умолчанию это qif/packages |
| -qifResources [path/to/resources1.qrc,path/to/resources2.qrc] | Устанавливает пользовательский путь к файлам ресурсов. По умолчанию эта опция пропущена |
### Deb package options:
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -debOut [package;nameOfOutputDebFile,nameOfOutputDebFile]| Устанавливает имя выходного файла debian. Эта опция может работать с несколькими пакетами |
### Zip pacakge options:
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -debOut [package;nameOfOutputZipFile,nameOfOutputZipFile]| Устанавливает имя выходного zip архива. Эта опция может работать с несколькими пакетами |
#### Пример: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.15.0/gcc_64/bin/qmake clear #### Пример: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.15.0/gcc_64/bin/qmake clear