mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-27 10:14:32 +00:00
add zipout and debout options
This commit is contained in:
parent
0e8cd1ae11
commit
e1f72f739f
@ -60,8 +60,7 @@ bool Deb::deployTemplate(PackageControl &pkg) {
|
||||
QuasarAppUtils::Params::log("Failed to set permissions", QuasarAppUtils::Warning);
|
||||
}
|
||||
|
||||
outFiles.push_back(DeployCore::_config->getTargetDir() + "/" + info.Name + ".deb");
|
||||
packageFolders.push_back(local);
|
||||
inouts.push_back({local, cfg->getTargetDir() + "/" + info.debOut});
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -117,30 +116,19 @@ QProcessEnvironment Deb::processEnvirement() const {
|
||||
|
||||
QList<SystemCommandData> Deb::runCmd() {
|
||||
QList<SystemCommandData> res;
|
||||
for (const auto& dir: qAsConst(packageFolders)) {
|
||||
res.push_back({"dpkg-deb", QStringList{"--build", "--verbose"} << dir});
|
||||
for (const auto& inout: qAsConst(inouts)) {
|
||||
res.push_back({"dpkg-deb", QStringList{"--build", "--verbose"} << inout.input << inout.output});
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QStringList Deb::outPutFiles() const {
|
||||
return outFiles;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
QStringList result;
|
||||
for (const auto& inout: qAsConst(inouts)) {
|
||||
result.push_back(inout.output);
|
||||
}
|
||||
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
QString Deb::dataLocation(const DistroModule &module) const {
|
||||
|
@ -3,6 +3,14 @@
|
||||
|
||||
#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.
|
||||
*/
|
||||
@ -21,7 +29,6 @@ public:
|
||||
QProcessEnvironment processEnvirement() const override;
|
||||
QList<SystemCommandData> runCmd() override;
|
||||
QStringList outPutFiles() const override;
|
||||
bool cb() const override;
|
||||
|
||||
// iDistribution interface
|
||||
protected:
|
||||
@ -30,8 +37,7 @@ protected:
|
||||
QString releativeLocation(const DistroModule &module) const override;
|
||||
|
||||
private:
|
||||
QStringList outFiles;
|
||||
QStringList packageFolders;
|
||||
QList<DebInOut> inouts;
|
||||
};
|
||||
|
||||
#endif // DEB_H
|
||||
|
@ -168,6 +168,8 @@ bool iDistribution::collectInfoWithDeployIcons(const DistroModule &pkg,
|
||||
|
||||
bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
TemplateInfo &info) {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
|
||||
info.Name = getName(pkg);
|
||||
|
||||
@ -198,6 +200,14 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
if (!pkg.installDirDEB().isEmpty())
|
||||
info.InstallDirDEB = pkg.installDirDEB();
|
||||
|
||||
info.debOut = cfg->getTargetDir() + "/" + info.Name + ".deb";
|
||||
if (!pkg.debOut().isEmpty())
|
||||
info.debOut = pkg.debOut();
|
||||
|
||||
info.zipOut = cfg->getTargetDir() + "/" + info.Name + ".zip";
|
||||
if (!pkg.zipOut().isEmpty())
|
||||
info.zipOut = pkg.zipOut();
|
||||
|
||||
info.Prefix = releativeLocation(pkg);
|
||||
|
||||
QString cmdArray = "[";
|
||||
|
@ -19,6 +19,9 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
|
||||
QString Homepage;
|
||||
QString Prefix;
|
||||
QString InstallDirDEB;
|
||||
QString zipOut;
|
||||
QString debOut;
|
||||
|
||||
QString InstallDeirQIFW() const;
|
||||
|
||||
QHash<QString, QString> Custom;
|
||||
|
@ -38,7 +38,7 @@ bool ZipArhive::deployTemplate(PackageControl &pkg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto arr = cfg->getTargetDir() + "/" + info.Name + ".zip";
|
||||
auto arr = cfg->getTargetDir() + "/" + info.zipOut;
|
||||
if (!zipWorker.compress(local, arr)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -465,6 +465,12 @@ bool ConfigParser::initDistroStruct() {
|
||||
auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb").
|
||||
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
|
||||
if (binOut.size() && !parsePackagesPrivate(mainDistro, binOut, &DistroModule::setBinOutDir)) {
|
||||
packagesErrorLog("binOut");
|
||||
@ -551,6 +557,16 @@ bool ConfigParser::initDistroStruct() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -350,14 +350,6 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
|
||||
{"-recursiveDepth"}, "{params}",
|
||||
"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{
|
||||
{"-installDirQIFW"}, "{params}",
|
||||
"Sets install target directory for installers (by default it is /home path)"
|
||||
@ -510,6 +502,31 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
|
||||
"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;
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,22 @@ void DistroModule::setKey(const QString &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 {
|
||||
if (_installDirDEB.isEmpty())
|
||||
return "/opt";
|
||||
|
@ -77,6 +77,30 @@ public:
|
||||
QString installDirDEB() const;
|
||||
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:
|
||||
void setKey(const QString &key);
|
||||
|
||||
@ -105,7 +129,8 @@ private:
|
||||
QSet<QString> _tr;
|
||||
|
||||
QString _installDirDEB;
|
||||
|
||||
QString _debOut;
|
||||
QString _zipOut;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
include($$PWD/InstallerBase.pri);
|
||||
mkpath( $$PWD/../Distro)
|
||||
win32:OUT_FILE = CQtDeployerInstaller.exe
|
||||
unix:OUT_FILE = CQtDeployerInstaller.run
|
||||
win32:OUT_FILE = CQtDeployer_$$VERSION_Installer_Win64.exe
|
||||
unix:OUT_FILE = CQtDeployer_$$VERSION_Installer_Linux64.run
|
||||
|
||||
win32:OUT_FILE_OFF = CQtDeployerOfflineInstaller.exe
|
||||
unix:OUT_FILE_OFF = CQtDeployerOfflineInstaller.run
|
||||
win32:OUT_FILE_OFF = CQtDeployer_$$VERSION_OfflineInstaller_Win64.exe
|
||||
unix:OUT_FILE_OFF = CQtDeployer_$$VERSION_OfflineInstaller_Linux64.run
|
||||
|
||||
DEPLOY_TARGET = $$PWD/../CQtDeployer/build/release
|
||||
|
||||
|
@ -1531,12 +1531,25 @@ void deploytest::testQifOut() {
|
||||
QString bin = TestBinDir + "TestOnlyC.exe";
|
||||
#endif
|
||||
|
||||
auto result = utils.createTree({{DISTRO_DIR + "/QIF_OUT.exe"},
|
||||
{DISTRO_DIR + "/QIF_OUT.exe.md5"}});
|
||||
#ifdef Q_OS_UNIX
|
||||
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
|
||||
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() {
|
||||
|
@ -156,4 +156,16 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
|
||||
| -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
|
||||
|
@ -152,6 +152,17 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
|
||||
| -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user