Merge pull request #647 from QuasarApp/task_640

Added new options for control install dir
This commit is contained in:
Andrei Yankovich 2021-07-24 18:38:25 +03:00 committed by GitHub
commit 076d4e1079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 75 additions and 9 deletions

View File

@ -3,7 +3,7 @@
APPS=$BASH_ARRAY_APPLICATIONS
APPS_SHORTCUTS=$BASH_ARRAY_SHORTCUTS_APPLICATIONS
TARGET_DIR=/opt/$PREFIX/
TARGET_DIR=$CQT_INSTALL_DEB_DIR/$PREFIX/
#creating shortcut
DEST_FILE=
@ -21,7 +21,7 @@ function createShortCut {
echo "Encoding=UTF-8" >> $DEST_FILE
echo "Name=$DEST_NAME" >> $DEST_FILE
echo "Type=Application" >> $DEST_FILE
echo "Icon=/opt/$ICON" >> $DEST_FILE
echo "Icon=$CQT_INSTALL_DEB_DIR/$ICON" >> $DEST_FILE
echo "Terminal=false" >> $DEST_FILE
echo "Exec=$SRC_FILE" >> $DEST_FILE

View File

@ -5,7 +5,7 @@
<Title>$NAME</Title>
<Publisher>$PUBLISHER</Publisher>
<StartMenuDir>$NAME</StartMenuDir>
<TargetDir>@HomeDir@/$NAME</TargetDir>
<TargetDir>$CQT_INSTALL_DIR/$NAME</TargetDir>
<InstallActionColumnVisible>true</InstallActionColumnVisible>
<RemoveTargetDir>true</RemoveTargetDir>
<ControlScript>controlScript.qs</ControlScript>

View File

@ -5,7 +5,7 @@
<Title>$NAME</Title>
<Publisher>$PUBLISHER</Publisher>
<StartMenuDir>$NAME</StartMenuDir>
<TargetDir>@HomeDir@/$NAME</TargetDir>
<TargetDir>$CQT_INSTALL_DIR/$NAME</TargetDir>
<InstallActionColumnVisible>true</InstallActionColumnVisible>
<RemoveTargetDir>true</RemoveTargetDir>
<ControlScript>controlScript.qs</ControlScript>

View File

@ -144,8 +144,7 @@ bool Deb::cb() const {
}
QString Deb::dataLocation(const DistroModule &module) const {
return location(module) + "/opt/" + releativeLocation(module);
return location(module) + module.installDirDEB() + "/" + releativeLocation(module);
}
QString Deb::location(const DistroModule &module) const {

View File

@ -74,6 +74,8 @@ bool iDistribution::unpackFile(const QFileInfo &resource,
inputText.replace("$PUBLISHER", info.Publisher);
inputText.replace("$HOMEPAGE", info.Homepage);
inputText.replace("$PREFIX", info.Prefix);
inputText.replace("$CQT_INSTALL_DIR", info.InstallDeirQIFW());
inputText.replace("$CQT_INSTALL_DEB_DIR", info.InstallDirDEB);
for (auto it = info.Custom.cbegin(); it != info.Custom.cend(); ++it) {
@ -192,6 +194,10 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
if (!pkg.homePage().isEmpty())
info.Homepage = pkg.homePage();
info.InstallDirDEB = "/opt";
if (!pkg.installDirDEB().isEmpty())
info.InstallDirDEB = pkg.installDirDEB();
info.Prefix = releativeLocation(pkg);
QString cmdArray = "[";

View File

@ -1 +1,6 @@
#include "templateinfo.h"
#include "quasarapp.h"
QString TemplateInfo::InstallDeirQIFW() const {
return QuasarAppUtils::Params::getArg("installDirQIFW", "@HomeDir@");
}

View File

@ -5,6 +5,9 @@
#include <QHash>
#include <deploy_global.h>
/**
* @brief The TemplateInfo struct This structure contains information about distribution packages.
*/
struct DEPLOYSHARED_EXPORT TemplateInfo
{
QString Name;
@ -15,6 +18,8 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
QString Publisher;
QString Homepage;
QString Prefix;
QString InstallDirDEB;
QString InstallDeirQIFW() const;
QHash<QString, QString> Custom;

View File

@ -463,6 +463,9 @@ bool ConfigParser::initDistroStruct() {
auto trData = QuasarAppUtils::Params::getArg("tr").
split(DeployCore::getSeparator(0), splitbehavior);
auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb").
split(DeployCore::getSeparator(0), splitbehavior);
// init distro stucts for all targets
if (binOut.size() && !parsePackagesPrivate(mainDistro, binOut, &DistroModule::setBinOutDir)) {
packagesErrorLog("binOut");
@ -544,6 +547,11 @@ bool ConfigParser::initDistroStruct() {
return false;
}
if (installDirDeb.size() && !parsePackagesPrivate(mainDistro, installDirDeb, &DistroModule::setInstallDirDEB)) {
packagesErrorLog("installDirDeb");
return false;
}
return true;
}

View File

@ -148,6 +148,17 @@ void DistroModule::setKey(const QString &key) {
_key = key;
}
QString DistroModule::installDirDEB() const {
if (_installDirDEB.isEmpty())
return "/opt";
return _installDirDEB;
}
void DistroModule::setInstallDirDEB(const QString &newInstallDir) {
_installDirDEB = newInstallDir;
}
QSet<QString> DistroModule::tr() const {
return _tr;
}

View File

@ -74,6 +74,9 @@ public:
void setTr(const QSet<QString> &tr);
void addTr(const QString &tr);
QString installDirDEB() const;
void setInstallDirDEB(const QString &newInstallDir);
protected:
void setKey(const QString &key);
@ -101,6 +104,8 @@ private:
// extra translations
QSet<QString> _tr;
QString _installDirDEB;
};

@ -1 +1 @@
Subproject commit 553e337e6a956534d34dbbfcec42359117aa35d4
Subproject commit 12c20dc83f4c34dea9793bdf5ebf27aa18b03357

View File

@ -187,6 +187,9 @@ private slots:
void testQifOut();
void testIgnoreEnvWithLibDir();
// note: this test checking in manual mode only.
void testInstallDirsOptions();
void customTest();
};
@ -1552,6 +1555,26 @@ void deploytest::testIgnoreEnvWithLibDir() {
QVERIFY(QDir().rmdir("libDirtest"));
}
void deploytest::testInstallDirsOptions() {
#ifdef QT_DEBUG
#ifdef Q_OS_UNIX
QStringList binMulti = {TestBinDir + "TestOnlyC" , TestBinDir + "TestCPPOnly"};
#else
QStringList binMulti = {TestBinDir + "TestOnlyC.exe" , TestBinDir + "TestCPPOnly.exe"};
#endif
runTestParams({"-bin", binMulti.join(","), "clear",
"qif", "deb",
"-targetPackage", "pkg;TestCPPOnly",
"-installDirDeb", "pkg;/var",
"-installDirQIFW", "/opt"});
#endif
}
void deploytest::customTest() {
//runTestParams({"-confFile", "",
// "qifFromSystem"});

View File

@ -99,7 +99,9 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| -extraPlugin [list,params]| Sets an additional path to extraPlugin of an app |
| -recursiveDepth [params] | Sets the Depth of recursive search of libs and ignoreEnv (default 0) |
| -targetDir [params] | Sets target directory(by default it is the path to the first deployable file)|
| -verbose [0-3] | Shows debug log |
| -installDirDeb [params] | Sets install target directory fordebian package (by default it is /opt path) |
| -installDirQIFW [params] | Sets install target directory for installers (by default it is /home path) |
| -verbose [0-3] | Shows debug log. By default it is 2 |
### Controll of packages options

View File

@ -94,7 +94,9 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| -extraPlugin [list,params] | Устанавливает дополнительный путь для extraPlugin приложения|
| -recursiveDepth [params] | Устанавливает глубину поиска библиотек и глубину игнорирования окружения для ignoreEnv (по умолчанию 0) |
| -targetDir [params] | Устанавливает целевой каталог (по умолчанию это путь к первому развертываемому файлу)|
| -verbose [0-3] | Показывает дебаг лога |
| -installDirDeb [параметры] | Устанавливает целевой каталог для установки пакета Debian (по умолчанию это /opt путь) |
| -installDirQIFW [параметры]| Устанавливает целевой каталог установки для инсталляторов (по умолчанию это путь /home) |
| -verbose [0-3] | Показывает дебаг лог. По умолчанию равен 2 |
### Параметры управлениями пакетами: