mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-28 18:54:33 +00:00
fix empty packagages
This commit is contained in:
parent
231b4b2b59
commit
8be8a8c5b2
@ -15,13 +15,10 @@ bool Deb::deployTemplate(PackageControl &pkg) {
|
||||
// default template
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
auto package = it.value();
|
||||
|
||||
if (pkg.isEmpty(it.key())) {
|
||||
continue;
|
||||
}
|
||||
auto list = pkg.availablePackages();
|
||||
for (auto it = list.begin();
|
||||
it != list.end(); ++it) {
|
||||
auto package = cfg->getDistroFromPackage(*it);
|
||||
|
||||
QString defaultPackageTempalte = ":/Templates/DEB/Distributions/Templates/deb";
|
||||
auto customTemplate = QuasarAppUtils::Params::getStrArg("deb", "");
|
||||
@ -46,7 +43,7 @@ bool Deb::deployTemplate(PackageControl &pkg) {
|
||||
auto local = location(package);
|
||||
auto localData = dataLocation(package);
|
||||
|
||||
if (!pkg.movePackage(it.key(), localData)) {
|
||||
if (!pkg.movePackage(*it, localData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -14,13 +14,11 @@ bool DefaultDistro::deployTemplate(PackageControl & ctrl) {
|
||||
// default template
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
auto package = it.value();
|
||||
auto list = ctrl.availablePackages();
|
||||
|
||||
if (ctrl.isEmpty(it.key())) {
|
||||
continue;
|
||||
}
|
||||
for (auto it = list.begin();
|
||||
it != list.end(); ++it) {
|
||||
auto package = cfg->getDistroFromPackage(*it);
|
||||
|
||||
QString targetLocation;
|
||||
if (package.isDefaultModule()) {
|
||||
@ -29,7 +27,7 @@ bool DefaultDistro::deployTemplate(PackageControl & ctrl) {
|
||||
targetLocation = cfg->getTargetDir() + "/" + releativeLocation(package);
|
||||
}
|
||||
|
||||
if (!ctrl.copyPackage(it.key(), targetLocation)) {
|
||||
if (!ctrl.copyPackage(*it, targetLocation)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -116,14 +116,11 @@ bool QIF::deployTemplate(PackageControl &pkg) {
|
||||
defaultConfig = customTemplate + "/config";
|
||||
}
|
||||
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
auto list = pkg.availablePackages();
|
||||
for (auto it = list.begin();
|
||||
it != list.end(); ++it) {
|
||||
|
||||
if (pkg.isEmpty(it.key())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!deployPackage(it, sufixes, pakcagesTemplates, defaultPackageTempalte, pkg)) {
|
||||
if (!deployPackage(cfg->getDistroFromPackage(*it), sufixes, pakcagesTemplates, defaultPackageTempalte, pkg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -217,13 +214,13 @@ QString QIF::installerFile() const {
|
||||
return DeployCore::_config->getTargetDir() + "/Installer" + generalInfo.Name + sufix;
|
||||
}
|
||||
|
||||
bool QIF::deployPackage(const QHash<QString, DistroModule>::const_iterator& it,
|
||||
bool QIF::deployPackage(const DistroModule& dist,
|
||||
const QStringList sufixes,
|
||||
const QHash<QString, QString>& pakcagesTemplates,
|
||||
const QString& defaultPackageTempalte,
|
||||
PackageControl &pkg) {
|
||||
|
||||
auto package = it.value();
|
||||
auto package = dist;
|
||||
|
||||
TemplateInfo info;
|
||||
if (!collectInfoWithDeployIcons(package, info)) {
|
||||
@ -238,7 +235,7 @@ bool QIF::deployPackage(const QHash<QString, DistroModule>::const_iterator& it,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!pkg.movePackage(it.key(), localData)) {
|
||||
if (!pkg.movePackage(dist.key(), localData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,14 @@ private:
|
||||
|
||||
/**
|
||||
* @brief deployPackage - private method for deploy package of qt installer framework
|
||||
* @param it - this is const iterator of current DistroModule.
|
||||
* @param dist - this is DistroModule.
|
||||
* @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
|
||||
* @param pkg this is PackageControl object for move a packge data.
|
||||
* @return return true if package deployed successful
|
||||
*/
|
||||
bool deployPackage(const QHash<QString, DistroModule>::const_iterator &it,
|
||||
bool deployPackage(const DistroModule &dist,
|
||||
const QStringList sufixes,
|
||||
const QHash<QString, QString> &pakcagesTemplates,
|
||||
const QString &defaultPackageTempalte,
|
||||
|
@ -18,23 +18,22 @@ bool ZipArhive::deployTemplate(PackageControl &pkg) {
|
||||
const DeployConfig *cfg = DeployCore::_config;
|
||||
|
||||
ZipCompresser zipWorker;
|
||||
for (auto it = cfg->packages().begin();
|
||||
it != cfg->packages().end(); ++it) {
|
||||
if (pkg.isEmpty(it.key())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto package = it.value();
|
||||
auto list = pkg.availablePackages();
|
||||
for (auto it = list.begin();
|
||||
it != list.end(); ++it) {
|
||||
|
||||
auto package = cfg->getDistroFromPackage(*it);
|
||||
|
||||
TemplateInfo info;
|
||||
if (!collectInfo(package, info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto local = location(it.value());
|
||||
auto dataLoc = dataLocation(it.value());
|
||||
auto local = location(package);
|
||||
auto dataLoc = dataLocation(package);
|
||||
|
||||
if (!pkg.movePackage(it.key(), dataLoc)) {
|
||||
if (!pkg.movePackage(*it, dataLoc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,15 @@ public:
|
||||
* @return true if the package is empty.
|
||||
* @note this method using for skiping empty packages on the packing step.
|
||||
*/
|
||||
virtual bool isEmpty(const QString& package) const;
|
||||
bool isEmpty(const QString& package) const;
|
||||
|
||||
/**
|
||||
* @brief availablePackages This method return list of prepared for packaing packages.
|
||||
* @note This list maybe have a difference with the packages list from main config because some packages do not have any files.
|
||||
* @return list of keys of available packages.
|
||||
*/
|
||||
virtual QStringList availablePackages() const = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -129,8 +129,8 @@ bool Packing::copyPackage(const QString &package, const QString &newLocation) {
|
||||
return _fileManager->copyFolder(_packagesLocations[package], newLocation, {}, nullptr, nullptr, true);
|
||||
}
|
||||
|
||||
bool Packing::isEmpty(const QString &package) const {
|
||||
return PackageControl::isEmpty(_packagesLocations[package]);
|
||||
QStringList Packing::availablePackages() const {
|
||||
return _packagesLocations.keys();
|
||||
}
|
||||
|
||||
bool Packing::collectPackages() {
|
||||
|
@ -20,13 +20,15 @@ class DEPLOYSHARED_EXPORT Packing : public QObject, public PackageControl
|
||||
Q_OBJECT
|
||||
public:
|
||||
Packing(FileManager *fileManager);
|
||||
~Packing();
|
||||
~Packing() override;
|
||||
void setDistribution(const QList<iDistribution*> &pakages);
|
||||
bool create();
|
||||
|
||||
bool movePackage(const QString &package, const QString &newLocation) override;
|
||||
bool copyPackage(const QString &package, const QString &newLocation) override;
|
||||
bool isEmpty(const QString &package) const override;
|
||||
|
||||
protected:
|
||||
QStringList availablePackages() const override;
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user