mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-28 18:54:33 +00:00
added prefix option
This commit is contained in:
parent
c182a1ebc9
commit
8bc33007d0
@ -2,7 +2,7 @@
|
||||
|
||||
APPS=$BASH_ARRAY_APPLICATIONS
|
||||
|
||||
TARGET_DIR=/opt/$NAME/
|
||||
TARGET_DIR=/opt/$PREFIX/
|
||||
|
||||
#creating shortcut
|
||||
DEST_FILE=
|
||||
@ -20,7 +20,7 @@ function createShortCut {
|
||||
echo "Encoding=UTF-8" >> $DEST_FILE
|
||||
echo "Name=$DEST_NAME" >> $DEST_FILE
|
||||
echo "Type=Application" >> $DEST_FILE
|
||||
echo "Icon=$TARGET_DIR/icons/Icon.png" >> $DEST_FILE
|
||||
echo "Icon=/opt/$ICON" >> $DEST_FILE
|
||||
echo "Terminal=false" >> $DEST_FILE
|
||||
echo "Exec=$SRC_FILE" >> $DEST_FILE
|
||||
|
||||
|
@ -34,7 +34,7 @@ function generateShortCutCmd(cmd) {
|
||||
Terminal=false\n
|
||||
Exec=\"@TargetDir@/" + cmd + ".sh\"\n
|
||||
Name=" + name + "\n
|
||||
Icon=@TargetDir@/$LOCAL_ICON\n
|
||||
Icon=@TargetDir@/$ICON\n
|
||||
Name[en_US]=" + name);
|
||||
|
||||
console.log("create icons!!! on LINUX done");
|
||||
|
@ -35,13 +35,12 @@ bool Deb::deployTemplate(PackageControl &pkg) {
|
||||
}
|
||||
|
||||
TemplateInfo info;
|
||||
bool fDefaultPakcage;
|
||||
if (!collectInfoWithDeployIcons(package, it.key(), cfg, info, fDefaultPakcage)) {
|
||||
if (!collectInfoWithDeployIcons(package, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto local = location(info.Name);
|
||||
auto localData = dataLocation(info.Name);
|
||||
auto local = location(package);
|
||||
auto localData = dataLocation(package);
|
||||
|
||||
if (!pkg.movePackage(it.key(), localData)) {
|
||||
return false;
|
||||
@ -113,12 +112,27 @@ bool Deb::cb() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString Deb::dataLocation(const QString &packageName) const {
|
||||
return location(packageName) + "/opt/" + packageName;
|
||||
QString Deb::dataLocation(const DistroModule &module) const {
|
||||
return location(module) + "/opt/" + releativeLocation(module);
|
||||
|
||||
}
|
||||
|
||||
QString Deb::location(const QString &packageName) const {
|
||||
QString Deb::location(const DistroModule &module) const {
|
||||
const DeployConfig* cfg = DeployCore::_config;
|
||||
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/" + packageName;
|
||||
auto name = getName(module);
|
||||
|
||||
if (name.isEmpty())
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/" + module.key();
|
||||
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/" + name;
|
||||
}
|
||||
|
||||
QString Deb::releativeLocation(const DistroModule &module) const {
|
||||
|
||||
if (module.prefix().isEmpty()) {
|
||||
return module.key();
|
||||
}
|
||||
|
||||
return module.prefix();
|
||||
}
|
||||
|
@ -23,8 +23,9 @@ public:
|
||||
|
||||
// iDistribution interface
|
||||
protected:
|
||||
QString dataLocation(const QString &packageName) const override;
|
||||
QString location(const QString &packageName) const override;
|
||||
QString dataLocation(const DistroModule &module) const override;
|
||||
QString location(const DistroModule &module) const override;
|
||||
QString releativeLocation(const DistroModule &module) const override;
|
||||
|
||||
private:
|
||||
QStringList outFiles;
|
||||
|
@ -17,13 +17,12 @@ bool DefaultDistro::deployTemplate(PackageControl & ctrl) {
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
auto package = it.value();
|
||||
QString Name = PathUtils::stripPath(it.key());
|
||||
|
||||
QString targetLocation;
|
||||
if (cfg->getDefaultPackage() == Name) {
|
||||
if (package.isDefaultModule()) {
|
||||
targetLocation = cfg->getTargetDir();
|
||||
} else {
|
||||
targetLocation = cfg->getTargetDir() + "/" + it.key();
|
||||
targetLocation = cfg->getTargetDir() + "/" + releativeLocation(package);
|
||||
}
|
||||
|
||||
if (!ctrl.copyPackage(it.key(), targetLocation)) {
|
||||
@ -54,10 +53,19 @@ QStringList DefaultDistro::outPutFiles() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
QString DefaultDistro::dataLocation(const QString &) const {
|
||||
QString DefaultDistro::dataLocation(const DistroModule &) const {
|
||||
return "";
|
||||
}
|
||||
|
||||
QString DefaultDistro::location(const QString &) const {
|
||||
QString DefaultDistro::location(const DistroModule &) const {
|
||||
return "";
|
||||
}
|
||||
|
||||
QString DefaultDistro::releativeLocation(const DistroModule &module) const {
|
||||
|
||||
if (module.prefix().isEmpty()) {
|
||||
return module.key();
|
||||
}
|
||||
|
||||
return module.prefix();
|
||||
}
|
||||
|
@ -19,8 +19,10 @@ public:
|
||||
|
||||
// iDistribution interface
|
||||
protected:
|
||||
QString dataLocation(const QString &packageName) const override;
|
||||
QString location(const QString &packageName) const override;
|
||||
QString dataLocation(const DistroModule &module) const override;
|
||||
QString location(const DistroModule &module) const override;
|
||||
QString releativeLocation(const DistroModule &module) const override;
|
||||
|
||||
};
|
||||
|
||||
#endif // DEFAULTDISTRO_H
|
||||
|
@ -63,6 +63,9 @@ bool iDistribution::unpackFile(const QFileInfo &resource,
|
||||
inputText.replace("$RELEASEDATA", info.ReleaseData);
|
||||
inputText.replace("$ICON", info.Icon);
|
||||
inputText.replace("$PUBLISHER", info.Publisher);
|
||||
inputText.replace("$HOMEPAGE", info.Homepage);
|
||||
inputText.replace("$PREFIX", info.Prefix);
|
||||
|
||||
|
||||
for (auto it = info.Custom.cbegin(); it != info.Custom.cend(); ++it) {
|
||||
inputText.replace(it.key(), it.value());
|
||||
@ -141,12 +144,9 @@ void iDistribution::registerOutFiles() const {
|
||||
}
|
||||
|
||||
bool iDistribution::collectInfoWithDeployIcons(const DistroModule &pkg,
|
||||
const QString &pkgKey,
|
||||
const DeployConfig *cfg,
|
||||
TemplateInfo &info,
|
||||
bool &fDefaultPakcage) {
|
||||
TemplateInfo &info) {
|
||||
|
||||
if (!collectInfo(pkg, pkgKey, cfg, info, fDefaultPakcage)) {
|
||||
if (!collectInfo(pkg, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -155,25 +155,9 @@ bool iDistribution::collectInfoWithDeployIcons(const DistroModule &pkg,
|
||||
}
|
||||
|
||||
bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
const QString &pkgKey,
|
||||
const DeployConfig * cfg,
|
||||
TemplateInfo &info,
|
||||
bool &fDefaultPakcage) {
|
||||
TemplateInfo &info) {
|
||||
|
||||
info.Name = PathUtils::stripPath(pkgKey);
|
||||
fDefaultPakcage = cfg->getDefaultPackage() == info.Name;
|
||||
|
||||
auto targets = pkg.targets();
|
||||
if (fDefaultPakcage && targets.size()) {
|
||||
QFileInfo targetInfo(*pkg.targets().begin());
|
||||
info.Name = targetInfo.baseName();
|
||||
}
|
||||
|
||||
if (!pkg.name().isEmpty()) {
|
||||
info.Name = pkg.name();
|
||||
}
|
||||
|
||||
auto localData = dataLocation(info.Name);
|
||||
info.Name = getName(pkg);
|
||||
|
||||
info.Description = "This package contains the " + info.Name;
|
||||
if (!pkg.description().isEmpty())
|
||||
@ -190,16 +174,16 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
if (!pkg.releaseData().isEmpty())
|
||||
info.ReleaseData = pkg.releaseData();
|
||||
|
||||
info.Icon = "icons/Icon.png";
|
||||
if (!pkg.icon().isEmpty()) {
|
||||
QFileInfo iconInfo(pkg.icon());
|
||||
info.Icon = info.Name + "/icons/" + iconInfo.fileName();
|
||||
}
|
||||
|
||||
info.Publisher = "Company";
|
||||
if (!pkg.publisher().isEmpty())
|
||||
info.Publisher = pkg.publisher();
|
||||
|
||||
info.Homepage = "";
|
||||
if (!pkg.homePage().isEmpty())
|
||||
info.Homepage = pkg.homePage();
|
||||
|
||||
info.Prefix = releativeLocation(pkg);
|
||||
|
||||
QString cmdArray = "[";
|
||||
QString bashArray = "";
|
||||
|
||||
@ -211,18 +195,16 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
cmdArray += ",";
|
||||
bashArray += " ";
|
||||
}
|
||||
cmdArray += "\"" + info.Name + "/" + fileinfo.fileName() + "\"";
|
||||
cmdArray += "\"" + releativeLocation(pkg) + "/" + fileinfo.fileName() + "\"";
|
||||
bashArray += fileinfo.fileName();
|
||||
}
|
||||
}
|
||||
cmdArray += "]";
|
||||
|
||||
info.Custom = {{"[\"array\", \"of\", \"cmds\"]", cmdArray},
|
||||
{"$LOCAL_ICON", info.Name + "/icons/" + QFileInfo(info.Icon).fileName()}};
|
||||
info.Custom = {{"[\"array\", \"of\", \"cmds\"]", cmdArray}};
|
||||
|
||||
info.Custom["$BASH_ARRAY_APPLICATIONS"] = bashArray;
|
||||
|
||||
|
||||
if (info.Name.isEmpty()) {
|
||||
info.Name = "Application";
|
||||
}
|
||||
@ -230,8 +212,25 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
|
||||
return true;
|
||||
}
|
||||
|
||||
QString iDistribution::getName(const DistroModule& pkg) const {
|
||||
|
||||
QString name = PathUtils::stripPath(pkg.key());
|
||||
|
||||
auto targets = pkg.targets();
|
||||
if (pkg.isDefaultModule() && targets.size()) {
|
||||
QFileInfo targetInfo(*pkg.targets().begin());
|
||||
name = targetInfo.baseName();
|
||||
}
|
||||
|
||||
if (!pkg.name().isEmpty()) {
|
||||
name = pkg.name();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
bool iDistribution::deployIcon(TemplateInfo &info ,const DistroModule& pkg) {
|
||||
auto localData = dataLocation(info.Name);
|
||||
auto localData = dataLocation(pkg);
|
||||
|
||||
info.Icon = "icons/Icon.png";
|
||||
if (pkg.icon().isEmpty()) {
|
||||
@ -241,7 +240,7 @@ bool iDistribution::deployIcon(TemplateInfo &info ,const DistroModule& pkg) {
|
||||
}
|
||||
} else {
|
||||
QFileInfo iconInfo(pkg.icon());
|
||||
info.Icon = info.Name + "/icons/" + iconInfo.fileName();
|
||||
info.Icon = releativeLocation(pkg) + "/icons/" + iconInfo.fileName();
|
||||
if (!copyFile(pkg.icon(), localData + "/icons/", false)) {
|
||||
return false;
|
||||
}
|
||||
@ -250,4 +249,16 @@ bool iDistribution::deployIcon(TemplateInfo &info ,const DistroModule& pkg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QString iDistribution::releativeLocation(const DistroModule &module) const {
|
||||
if (module.isDefaultModule()) {
|
||||
return module.prefix();
|
||||
}
|
||||
|
||||
if (module.prefix().isEmpty())
|
||||
return module.key();
|
||||
|
||||
return module.prefix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -59,34 +59,27 @@ protected:
|
||||
/**
|
||||
* @brief collectInfoWithDeployIcons This is wraper of the collectInfo and deployIcon methods.
|
||||
* @param pkg This is package object.
|
||||
* @param pkgKey This is package key value.
|
||||
* @param cfg This is pointer to config.
|
||||
* @param info This is return value (created template information)
|
||||
* @param fDefaultPakcage This is return value
|
||||
* (return true if package that collected information is a default package)
|
||||
* @return true if information collected successful.
|
||||
*/
|
||||
bool collectInfoWithDeployIcons(const DistroModule &pkg,
|
||||
const QString& pkgKey,
|
||||
const DeployConfig *cfg,
|
||||
TemplateInfo& info,
|
||||
bool &fDefaultPakcage);
|
||||
TemplateInfo& info);
|
||||
|
||||
/**
|
||||
* @brief collectInfo This method collect information about package.
|
||||
* @param pkg This is package object.
|
||||
* @param pkgKey This is package key value.
|
||||
* @param cfg This is pointer to config.
|
||||
* @param info This is return value (created template information)
|
||||
* @param fDefaultPakcage This is return value
|
||||
* (return true if package that collected information is a default package)
|
||||
* @return true if information collected successful.
|
||||
*/
|
||||
bool collectInfo(const DistroModule &pkg,
|
||||
const QString& pkgKey,
|
||||
const DeployConfig *cfg,
|
||||
TemplateInfo& info,
|
||||
bool &fDefaultPakcage);
|
||||
TemplateInfo& info);
|
||||
|
||||
/**
|
||||
* @brief getName This method return name of package from pacakge key.
|
||||
* @param pkgKey This is pacakge.
|
||||
* @return package name.
|
||||
*/
|
||||
QString getName(const DistroModule &pkgKey) const;
|
||||
|
||||
/**
|
||||
* @brief deployIcon This method copy default or custom icon to the package.
|
||||
@ -100,17 +93,26 @@ protected:
|
||||
|
||||
/**
|
||||
* @brief dataLocation This method should be retrun location of application or package files.
|
||||
* @param packageName This is name of package that request data location.
|
||||
* @param module This is module with information about package.
|
||||
* @return return location of data files.
|
||||
*/
|
||||
virtual QString dataLocation(const QString& packageName) const = 0;
|
||||
virtual QString dataLocation(const DistroModule &module) const = 0;
|
||||
|
||||
/**
|
||||
* @brief location This method return main patho to files of package.
|
||||
* @param packageName This is name of package that request data location.
|
||||
* @param module This is module with information about package.
|
||||
* @return location of package.
|
||||
*/
|
||||
virtual QString location(const QString& packageName) const = 0;
|
||||
virtual QString location(const DistroModule &module) const = 0;
|
||||
|
||||
/**
|
||||
* @brief releativeLocation This method must be return releative path after install.
|
||||
* Default implementation return prefix value. but for some packages types may need to change a prefix value.
|
||||
* @param module This is module with information about package.
|
||||
* @return releative prefix value.
|
||||
*/
|
||||
virtual QString releativeLocation(const DistroModule &module) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -119,7 +119,7 @@ bool QIF::deployTemplate(PackageControl &pkg) {
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
|
||||
if (!deployPackage(it, cfg, sufixes, pakcagesTemplates, defaultPackageTempalte, pkg)) {
|
||||
if (!deployPackage(it, sufixes, pakcagesTemplates, defaultPackageTempalte, pkg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -172,27 +172,14 @@ QStringList QIF::outPutFiles() const {
|
||||
return {installerFile()};
|
||||
}
|
||||
|
||||
QString QIF::dataLocation(const QString &packageName) const {
|
||||
if (packageName.isEmpty())
|
||||
return "";
|
||||
|
||||
const DeployConfig* cfg = DeployCore::_config;
|
||||
|
||||
QString result = location(packageName) + "/data";
|
||||
if (cfg->getDefaultPackage() != packageName) {
|
||||
result += "/" + packageName;
|
||||
}
|
||||
|
||||
return result;
|
||||
QString QIF::dataLocation(const DistroModule &module) const {
|
||||
return location(module) + "/data/" + releativeLocation(module);
|
||||
}
|
||||
|
||||
QString QIF::location(const QString &packageName) const {
|
||||
QString QIF::location(const DistroModule &module) const {
|
||||
|
||||
if (packageName.isEmpty())
|
||||
return "";
|
||||
|
||||
const DeployConfig* cfg = DeployCore::_config;
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/packages/" + packageName;
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/packages/" + module.key();
|
||||
}
|
||||
|
||||
QString QIF::getStyle(const QString& input) const {
|
||||
@ -227,7 +214,6 @@ QString QIF::installerFile() const {
|
||||
}
|
||||
|
||||
bool QIF::deployPackage(const QHash<QString, DistroModule>::const_iterator& it,
|
||||
const DeployConfig * cfg,
|
||||
const QStringList sufixes,
|
||||
const QHash<QString, QString>& pakcagesTemplates,
|
||||
const QString& defaultPackageTempalte,
|
||||
@ -235,15 +221,14 @@ bool QIF::deployPackage(const QHash<QString, DistroModule>::const_iterator& it,
|
||||
auto package = it.value();
|
||||
|
||||
TemplateInfo info;
|
||||
bool fDefaultPakcage;
|
||||
if (!collectInfoWithDeployIcons(it.value(), it.key(), cfg, info, fDefaultPakcage)) {
|
||||
if (!collectInfoWithDeployIcons(package, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto localData = dataLocation(info.Name);
|
||||
auto local = location(info.Name);
|
||||
auto localData = dataLocation(package);
|
||||
auto local = location(package);
|
||||
|
||||
if (!unpackDir(pakcagesTemplates.value(package.name(), defaultPackageTempalte),
|
||||
if (!unpackDir(pakcagesTemplates.value(package.key(), defaultPackageTempalte),
|
||||
local, info, sufixes)) {
|
||||
return false;
|
||||
}
|
||||
@ -252,7 +237,7 @@ bool QIF::deployPackage(const QHash<QString, DistroModule>::const_iterator& it,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fDefaultPakcage)
|
||||
if (package.isDefaultModule())
|
||||
generalInfo = info;
|
||||
|
||||
return true;
|
||||
@ -262,7 +247,6 @@ bool QIF::initDefaultConfiguratuin() {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
// init default configuration
|
||||
bool fDefaultPakcage;
|
||||
return collectInfo({}, cfg->getDefaultPackage(), cfg, generalInfo, fDefaultPakcage);
|
||||
return collectInfo(DistroModule{cfg->getDefaultPackage()}, generalInfo);
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ public:
|
||||
QStringList outPutFiles() const override;
|
||||
|
||||
protected:
|
||||
QString dataLocation(const QString &packageName) const override;
|
||||
QString location(const QString &packageName) const override;
|
||||
QString dataLocation(const DistroModule &module) const override;
|
||||
QString location(const DistroModule &module) const override;
|
||||
|
||||
private:
|
||||
|
||||
@ -32,7 +32,6 @@ private:
|
||||
/**
|
||||
* @brief deployPackage - private method for deploy package of qt installer framework
|
||||
* @param it - this is const iterator of current DistroModule.
|
||||
* @param cfg - this is config pointer
|
||||
* @param sufixes - this is sufixses of files for copy into package
|
||||
* @param pakcagesTemplates - this is list of pakcages and them tempalte patheses
|
||||
* @param defaultPackageTempalte this is path to default package template
|
||||
@ -40,7 +39,6 @@ private:
|
||||
* @return return true if package deployed successful
|
||||
*/
|
||||
bool deployPackage(const QHash<QString, DistroModule>::const_iterator &it,
|
||||
const DeployConfig *cfg,
|
||||
const QStringList sufixes,
|
||||
const QHash<QString, QString> &pakcagesTemplates,
|
||||
const QString &defaultPackageTempalte,
|
||||
|
@ -14,6 +14,7 @@ struct DEPLOYSHARED_EXPORT TemplateInfo
|
||||
QString Icon;
|
||||
QString Publisher;
|
||||
QString Homepage;
|
||||
QString Prefix;
|
||||
|
||||
QHash<QString, QString> Custom;
|
||||
|
||||
|
@ -23,14 +23,14 @@ bool ZipArhive::deployTemplate(PackageControl &pkg) {
|
||||
auto package = it.value();
|
||||
|
||||
TemplateInfo info;
|
||||
bool fDefaultPakcage;
|
||||
if (!collectInfo(package, it.key(), cfg, info, fDefaultPakcage)) {
|
||||
if (!collectInfo(package, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto local = location(info.Name);
|
||||
auto local = location(it.value());
|
||||
auto dataLoc = dataLocation(it.value());
|
||||
|
||||
if (!pkg.movePackage(it.key(), local)) {
|
||||
if (!pkg.movePackage(it.key(), dataLoc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -69,12 +69,12 @@ QStringList ZipArhive::outPutFiles() const {
|
||||
return outFiles;
|
||||
}
|
||||
|
||||
QString ZipArhive::dataLocation(const QString &packageName) const {
|
||||
return location(packageName);
|
||||
QString ZipArhive::dataLocation(const DistroModule &module) const {
|
||||
return location(module) + "/" + releativeLocation(module);
|
||||
}
|
||||
|
||||
QString ZipArhive::location(const QString &packageName) const {
|
||||
QString ZipArhive::location(const DistroModule &module) const {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/" + packageName;
|
||||
return cfg->getTargetDir() + "/" + getLocation() + "/" + module.key();
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ public:
|
||||
|
||||
// iDistribution interface
|
||||
protected:
|
||||
QString dataLocation(const QString &packageName) const override;
|
||||
QString location(const QString &packageName) const override;
|
||||
QString dataLocation(const DistroModule &module) const override;
|
||||
QString location(const DistroModule &module) const override;
|
||||
private:
|
||||
QStringList outFiles;
|
||||
|
||||
|
@ -47,7 +47,8 @@ bool parsePackagesPrivate(Container& mainContainer,
|
||||
auto first = paramsList.value(0, "");
|
||||
auto second = paramsList.value(1, "");
|
||||
if (paramsList.size() == 1)
|
||||
(mainContainer[defaultPackage].*adder)(first);
|
||||
(valueLink(mainContainer, defaultPackage, DistroModule{defaultPackage}).*adder)(first);
|
||||
|
||||
else {
|
||||
first = PathUtils::fullStripPath(first);
|
||||
if (!mainContainer.contains(first)) {
|
||||
@ -55,7 +56,7 @@ bool parsePackagesPrivate(Container& mainContainer,
|
||||
}
|
||||
|
||||
for (int i = 1; i < paramsList.size(); ++i) {
|
||||
(mainContainer[first].*adder)(paramsList[i]);
|
||||
(valueLink(mainContainer, first, DistroModule{first}).*adder)(paramsList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -361,7 +362,10 @@ bool ConfigParser::initDistroStruct() {
|
||||
auto publisher = QuasarAppUtils::Params::getStrArg("publisher").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto homepage = QuasarAppUtils::Params::getStrArg("homepage").
|
||||
auto homepage = QuasarAppUtils::Params::getStrArg("homePage").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto prefix = QuasarAppUtils::Params::getStrArg("prefix").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto erroLog = [](const QString &flag){
|
||||
@ -431,8 +435,13 @@ bool ConfigParser::initDistroStruct() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (publisher.size() && !parsePackagesPrivate(mainDistro, homepage, &DistroModule::setHomePage)) {
|
||||
erroLog("HomePage");
|
||||
if (homepage.size() && !parsePackagesPrivate(mainDistro, homepage, &DistroModule::setHomePage)) {
|
||||
erroLog("homePage");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prefix.size() && !parsePackagesPrivate(mainDistro, prefix, &DistroModule::setPrefix)) {
|
||||
erroLog("prefix");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -470,7 +479,7 @@ bool ConfigParser::initPackages() {
|
||||
}
|
||||
}
|
||||
|
||||
_config.packagesEdit().insert(package, {});
|
||||
_config.packagesEdit().insert(package, DistroModule{package});
|
||||
|
||||
if (pair.size() != 2) {
|
||||
defaultPackage = package;
|
||||
@ -493,7 +502,7 @@ bool ConfigParser::initPackages() {
|
||||
}
|
||||
|
||||
if (fDefaultPackage) {
|
||||
_config.packagesEdit().insert(defaultPackage, {});
|
||||
_config.packagesEdit().insert(defaultPackage, DistroModule{defaultPackage});
|
||||
}
|
||||
|
||||
_config.setDefaultPackage(defaultPackage);
|
||||
@ -1399,8 +1408,8 @@ bool ConfigParser::smartMoveTargets() {
|
||||
auto newTargetKey = targetPath + "/" + target.fileName();
|
||||
temp.unite(moveTarget(i.value(), newTargetKey));
|
||||
|
||||
_config.packagesEdit()[i.value().getPackage()].addTarget(newTargetKey);
|
||||
|
||||
auto pkgKey = i.value().getPackage();
|
||||
valueLink(_config.packagesEdit(), pkgKey, DistroModule{pkgKey}).addTarget(newTargetKey);
|
||||
}
|
||||
|
||||
_config.targetsEdit() = temp;
|
||||
|
@ -8,4 +8,14 @@
|
||||
#define splitbehavior QString::SkipEmptyParts
|
||||
#endif
|
||||
|
||||
template<class Container, class Key, class T>
|
||||
T& valueLink(Container& ctr, const Key& key, const T& defaultValue) {
|
||||
auto it = ctr.find(key);
|
||||
if (it != ctr.end()) {
|
||||
return *it;
|
||||
}
|
||||
|
||||
return *ctr.insert(key, defaultValue);
|
||||
};
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
@ -37,15 +37,12 @@ void DeployConfig::setTargetDir(const QString &target) {
|
||||
}
|
||||
|
||||
DistroModule DeployConfig::getDistro(const QString &target) const {
|
||||
return _packages.value(_targets.value(target).getPackage());
|
||||
auto key = _targets.value(target).getPackage();
|
||||
return _packages.value(key, DistroModule{key});
|
||||
}
|
||||
|
||||
DistroModule DeployConfig::getDistroFromPackage(const QString &package) const {
|
||||
if (_packages.contains(package)) {
|
||||
return _packages[package];
|
||||
}
|
||||
|
||||
return _packages.value("");
|
||||
return _packages.value(package, DistroModule{package});
|
||||
}
|
||||
|
||||
QMultiHash<QString, TargetInfo> &DeployConfig::targetsEdit() {
|
||||
|
@ -253,7 +253,8 @@ void DeployCore::help() {
|
||||
{"-releaseDate [package;val,val]", "Sets release date for a package"},
|
||||
{"-icon [package;val,val]", "Sets path to icon for a package"},
|
||||
{"-publisher [package;val,val]", "Sets publisher for a package"},
|
||||
{"-homepage [package;val,val]", "Sets the homepage url for a package"},
|
||||
{"-homePage [package;val,val]", "Sets the home page url for a package"},
|
||||
{"-prefix [package;val,val]", "Sets the prefix for the package relatively a target directory "},
|
||||
|
||||
}
|
||||
},
|
||||
@ -343,7 +344,8 @@ QStringList DeployCore::helpKeys() {
|
||||
"qifLogo",
|
||||
"zip",
|
||||
"noQt",
|
||||
"homepage",
|
||||
"homePage",
|
||||
"prefix",
|
||||
"deb"
|
||||
};
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "deployconfig.h"
|
||||
#include "deploycore.h"
|
||||
#include "distromodule.h"
|
||||
|
||||
DistroModule::DistroModule() {
|
||||
|
||||
DistroModule::DistroModule(const QString& key) {
|
||||
setKey(key);
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::targets() const {
|
||||
@ -29,73 +30,59 @@ void DistroModule::addQmlInput(const QString &target) {
|
||||
_qmlInput.insert(DeployCore::transportPathToSnapRoot(target));
|
||||
}
|
||||
|
||||
QString DistroModule::name() const
|
||||
{
|
||||
QString DistroModule::name() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
void DistroModule::setName(const QString &name)
|
||||
{
|
||||
void DistroModule::setName(const QString &name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
QString DistroModule::description() const
|
||||
{
|
||||
QString DistroModule::description() const {
|
||||
return _description;
|
||||
}
|
||||
|
||||
void DistroModule::setDescription(const QString &description)
|
||||
{
|
||||
void DistroModule::setDescription(const QString &description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
QString DistroModule::version() const
|
||||
{
|
||||
QString DistroModule::version() const {
|
||||
return _version;
|
||||
}
|
||||
|
||||
void DistroModule::setVersion(const QString &version)
|
||||
{
|
||||
void DistroModule::setVersion(const QString &version) {
|
||||
_version = version;
|
||||
}
|
||||
|
||||
QString DistroModule::releaseData() const
|
||||
{
|
||||
QString DistroModule::releaseData() const {
|
||||
return _releaseData;
|
||||
}
|
||||
|
||||
void DistroModule::setReleaseData(const QString &releaseData)
|
||||
{
|
||||
void DistroModule::setReleaseData(const QString &releaseData) {
|
||||
_releaseData = releaseData;
|
||||
}
|
||||
|
||||
QString DistroModule::icon() const
|
||||
{
|
||||
QString DistroModule::icon() const {
|
||||
return _icon;
|
||||
}
|
||||
|
||||
void DistroModule::setIcon(const QString &icon)
|
||||
{
|
||||
void DistroModule::setIcon(const QString &icon) {
|
||||
_icon = icon;
|
||||
}
|
||||
|
||||
QString DistroModule::publisher() const
|
||||
{
|
||||
QString DistroModule::publisher() const {
|
||||
return _publisher;
|
||||
}
|
||||
|
||||
void DistroModule::setPublisher(const QString &publisher)
|
||||
{
|
||||
void DistroModule::setPublisher(const QString &publisher) {
|
||||
_publisher = publisher;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::enabledPlugins() const
|
||||
{
|
||||
QSet<QString> DistroModule::enabledPlugins() const {
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
void DistroModule::setEnabledPlugins(const QSet<QString> &enabled)
|
||||
{
|
||||
void DistroModule::setEnabledPlugins(const QSet<QString> &enabled) {
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
@ -103,13 +90,11 @@ void DistroModule::addEnabledPlugins(const QString &enabled) {
|
||||
_enabled += enabled;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::disabledPlugins() const
|
||||
{
|
||||
QSet<QString> DistroModule::disabledPlugins() const {
|
||||
return _disabled;
|
||||
}
|
||||
|
||||
void DistroModule::setDisabledPlugins(const QSet<QString> &disabled)
|
||||
{
|
||||
void DistroModule::setDisabledPlugins(const QSet<QString> &disabled) {
|
||||
_disabled = disabled;
|
||||
}
|
||||
|
||||
@ -117,13 +102,11 @@ void DistroModule::addDisabledPlugins(const QString &disabled) {
|
||||
_disabled += disabled;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::extraPlugins() const
|
||||
{
|
||||
QSet<QString> DistroModule::extraPlugins() const {
|
||||
return _extraPlugins;
|
||||
}
|
||||
|
||||
void DistroModule::setExtraPlugins(const QSet<QString> &extraPlugins)
|
||||
{
|
||||
void DistroModule::setExtraPlugins(const QSet<QString> &extraPlugins) {
|
||||
_extraPlugins = extraPlugins;
|
||||
}
|
||||
|
||||
@ -139,3 +122,29 @@ QString DistroModule::homePage() const {
|
||||
void DistroModule::setHomePage(const QString &homePage) {
|
||||
_homePage = homePage;
|
||||
}
|
||||
|
||||
QString DistroModule::prefix() const {
|
||||
return _prefix;
|
||||
}
|
||||
|
||||
void DistroModule::setPrefix(const QString &location) {
|
||||
_prefix = location;
|
||||
}
|
||||
|
||||
QString DistroModule::key() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
bool DistroModule::isDefaultModule() const {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
return key() == cfg->getDefaultPackage();
|
||||
}
|
||||
|
||||
bool DistroModule::isValid() {
|
||||
return _key.size();
|
||||
}
|
||||
|
||||
void DistroModule::setKey(const QString &key) {
|
||||
_key = key;
|
||||
}
|
||||
|
@ -8,7 +8,9 @@
|
||||
class DEPLOYSHARED_EXPORT DistroModule: public DistroStruct
|
||||
{
|
||||
public:
|
||||
DistroModule();
|
||||
explicit DistroModule(const QString& key );
|
||||
DistroModule(const DistroModule& other ) = default;
|
||||
|
||||
QSet<QString> targets() const;
|
||||
void setTargets(const QSet<QString> &targets);
|
||||
void addTarget(const QString& target);
|
||||
@ -51,8 +53,22 @@ public:
|
||||
QString homePage() const;
|
||||
void setHomePage(const QString &homePage);
|
||||
|
||||
QString prefix() const;
|
||||
void setPrefix(const QString &location);
|
||||
|
||||
QString key() const;
|
||||
|
||||
bool isDefaultModule() const;
|
||||
|
||||
bool isValid();
|
||||
|
||||
protected:
|
||||
void setKey(const QString &key);
|
||||
|
||||
private:
|
||||
QString _name;
|
||||
QString _key;
|
||||
QString _prefix;
|
||||
QString _description;
|
||||
QString _version;
|
||||
QString _releaseData;
|
||||
|
@ -62,8 +62,7 @@ QString DistroStruct::getRootDir(const QString &basePath) const {
|
||||
return getRelativePath(basePath);
|
||||
}
|
||||
|
||||
bool DistroStruct::isEmpty()
|
||||
{
|
||||
bool DistroStruct::isEmpty() {
|
||||
return (libOutDir.isEmpty() &&
|
||||
qmlOutDir.isEmpty() &&
|
||||
binOutDir.isEmpty() &&
|
||||
|
@ -59,9 +59,9 @@ bool Extracter::extractWebEngine() {
|
||||
webEngeneBin += "/QtWebEngineProcess.exe";
|
||||
}
|
||||
|
||||
auto destWebEngine = cnf->getTargetDir() + "/" + package + cnf->packages()[package].getBinOutDir();
|
||||
auto resOut = cnf->getTargetDir() + "/" + package + cnf->packages()[package].getResOutDir();
|
||||
auto libOut = cnf->getTargetDir() + "/" + package + cnf->packages()[package].getLibOutDir();
|
||||
auto destWebEngine = cnf->getTargetDir() + "/" + package + cnf->getDistroFromPackage(package).getBinOutDir();
|
||||
auto resOut = cnf->getTargetDir() + "/" + package + cnf->getDistroFromPackage(package).getResOutDir();
|
||||
auto libOut = cnf->getTargetDir() + "/" + package + cnf->getDistroFromPackage(package).getLibOutDir();
|
||||
|
||||
auto res = cnf->qtDir.getResources();
|
||||
if (!_fileManager->copyFiles(angleGLLibs(), libOut)) {
|
||||
|
@ -182,8 +182,15 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
|
||||
return false;
|
||||
}
|
||||
|
||||
QuasarAppUtils::Params::log(((isMove)? "move :": "copy :") + file,
|
||||
QuasarAppUtils::Info);
|
||||
if (isMove) {
|
||||
QuasarAppUtils::Params::log( "move :" + file,
|
||||
QuasarAppUtils::Debug);
|
||||
} else {
|
||||
QuasarAppUtils::Params::log("copy :" + file,
|
||||
QuasarAppUtils::Info);
|
||||
}
|
||||
|
||||
|
||||
QFile sourceFile(file);
|
||||
auto sourceFileAbsalutePath = QFileInfo(file).absoluteFilePath();
|
||||
|
||||
@ -315,6 +322,10 @@ bool FileManager::moveFolder(const QString &from, const QString &to, const QStri
|
||||
if (!info.exists())
|
||||
return false;
|
||||
|
||||
if (!initDir(to)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.isFile()) {
|
||||
|
||||
if (ignore.size() && info.absoluteFilePath().contains(ignore)) {
|
||||
|
@ -20,7 +20,6 @@ private:
|
||||
bool fileActionPrivate(const QString &file, const QString &target,
|
||||
QStringList *mask, bool isMove, bool targetIsFile);
|
||||
|
||||
bool initDir(const QString &path);
|
||||
QSet<QString> _deployedFiles;
|
||||
|
||||
/**
|
||||
@ -34,6 +33,7 @@ private:
|
||||
QString changeDistanation(const QString &absalutePath, QString basePath, int depch);
|
||||
public:
|
||||
FileManager();
|
||||
bool initDir(const QString &path);
|
||||
|
||||
bool copyFile(const QString &file, const QString &target,
|
||||
QStringList *mask = nullptr, bool targetIsFile = false);
|
||||
|
@ -4,3 +4,7 @@ PackageControl::PackageControl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PackageControl::~PackageControl(){
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ class PackageControl
|
||||
{
|
||||
public:
|
||||
PackageControl();
|
||||
virtual ~PackageControl();
|
||||
|
||||
virtual bool movePackage(const QString& package,
|
||||
const QString& newLocation) = 0;
|
||||
virtual bool copyPackage(const QString& package,
|
||||
|
@ -133,7 +133,14 @@ bool Packing::collectPackages() {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
for (auto it = cfg->packages().begin(); it != cfg->packages().end(); ++it) {
|
||||
if (!moveData(cfg->getTargetDir() + "/" + it.key(), cfg->getTargetDir() + "/" + TMP_PACKAGE_DIR + "/" + it.key()))
|
||||
|
||||
auto from = cfg->getTargetDir() + "/" + it.key();
|
||||
|
||||
if (!QFileInfo::exists(from)) {
|
||||
_fileManager->initDir(from);
|
||||
}
|
||||
|
||||
if (!moveData(from, cfg->getTargetDir() + "/" + TMP_PACKAGE_DIR + "/" + it.key()))
|
||||
return false;
|
||||
|
||||
_packagesLocations.insert(it.key(), cfg->getTargetDir() + "/" + TMP_PACKAGE_DIR + "/" + it.key());
|
||||
|
@ -13,6 +13,10 @@ ModulesQt513::ModulesQt513()
|
||||
|
||||
}
|
||||
|
||||
ModulesQt513::~ModulesQt513() {
|
||||
|
||||
}
|
||||
|
||||
QSet<QString> ModulesQt513::ignoreFilter(const QSet<QString> &input, const QString &filter) const {
|
||||
QSet<QString> res;
|
||||
for (auto& val : input) {
|
||||
|
@ -16,6 +16,7 @@ class ModulesQt513
|
||||
{
|
||||
public:
|
||||
ModulesQt513();
|
||||
virtual ~ModulesQt513();
|
||||
|
||||
virtual QSet<QString> ignoreFilter(const QSet<QString>& input, const QString& filter) const;
|
||||
virtual QSet<QString> replace(const QSet<QString> &data, const QMap<QString, QString>& replaceMap) const;
|
||||
|
@ -163,6 +163,8 @@ private slots:
|
||||
|
||||
void testQmlScaner();
|
||||
|
||||
void testPrefix();
|
||||
|
||||
void customTest();
|
||||
};
|
||||
|
||||
@ -989,8 +991,38 @@ void deploytest::testQmlScaner() {
|
||||
|
||||
}
|
||||
|
||||
void deploytest::testPrefix() {
|
||||
TestUtils utils;
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
|
||||
auto comapareTree = utils.createTree(
|
||||
{
|
||||
"./" + DISTRO_DIR + "/package/TestOnlyC.sh",
|
||||
"./" + DISTRO_DIR + "/package/bin/TestOnlyC",
|
||||
"./" + DISTRO_DIR + "/package/bin/qt.conf"
|
||||
});
|
||||
QString target1 = TestBinDir + "TestOnlyC";
|
||||
|
||||
#else
|
||||
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
|
||||
auto comapareTree = utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/package/TestOnlyC.exe",
|
||||
"./" + DISTRO_DIR + "/package/qt.conf"});
|
||||
QString target1 = TestBinDir + "TestOnlyC.exe";
|
||||
|
||||
#endif
|
||||
QString bin = target1;
|
||||
|
||||
comapareTree = TestModule.replace(comapareTree, {{"package","prefix"}});
|
||||
|
||||
runTestParams({"-bin", bin, "force-clear",
|
||||
"-targetPackage", "/package/;TestOn",
|
||||
"-prefix", "package;prefix"}, &comapareTree);
|
||||
}
|
||||
|
||||
void deploytest::customTest() {
|
||||
runTestParams({"-confFile", "pass to tested configuration",
|
||||
runTestParams({"-confFile", "This is pass to custom configuretion",
|
||||
"qifFromSystem"});
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,8 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
|
||||
| -releaseDate [package;val,val] | Sets release date for package |
|
||||
| -icon [package;val,val] | Sets path to icon for package |
|
||||
| -publisher [package;val,val]| Sets publisher for package |
|
||||
| -homepage [package;val,val] | Sets the homepage url for a package |
|
||||
| -homePage [package;val,val] | Sets the homepage url for a package |
|
||||
| -prefix [package;val,val] | Sets the prefix for the package relatively a target directory |
|
||||
|
||||
### Plugins Controll Options
|
||||
|
||||
|
@ -91,7 +91,9 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
|
||||
| -releaseDate [package;val,val] | Установит дату выпуска префиксу |
|
||||
| -icon [package;val,val] | Установит путь к иконке или логотипу префиксу |
|
||||
| -publisher [package;val,val]| Установит Издательство (автора) префиксу |
|
||||
| -homepage [package;val,val] | Установит URL-адрес домашней страницы для пакета |
|
||||
| -homePage [package;val,val] | Установит URL-адрес домашней страницы для пакета |
|
||||
| -prefix [package;val,val] | Устанавливает префикс для пакета относительно целевого каталога
|
||||
|
|
||||
|
||||
### Параметры управления плагинами:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user