2020-01-05 13:58:38 +03:00
|
|
|
#include "defaultdistro.h"
|
|
|
|
|
|
|
|
#include <deployconfig.h>
|
|
|
|
#include <deploycore.h>
|
2020-08-15 19:29:17 +03:00
|
|
|
#include <packagecontrol.h>
|
|
|
|
#include <pathutils.h>
|
2020-01-05 13:58:38 +03:00
|
|
|
|
2020-01-15 18:31:09 +03:00
|
|
|
DefaultDistro::DefaultDistro(FileManager *fileManager)
|
|
|
|
:iDistribution(fileManager){
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-08-15 19:29:17 +03:00
|
|
|
bool DefaultDistro::deployTemplate(PackageControl & ctrl) {
|
|
|
|
// default template
|
|
|
|
const DeployConfig *cfg = DeployCore::_config;
|
|
|
|
|
2020-12-14 10:52:22 +03:00
|
|
|
auto list = ctrl.availablePackages();
|
2020-08-15 19:29:17 +03:00
|
|
|
|
2020-12-14 10:52:22 +03:00
|
|
|
for (auto it = list.begin();
|
|
|
|
it != list.end(); ++it) {
|
|
|
|
auto package = cfg->getDistroFromPackage(*it);
|
2020-12-10 11:12:04 +03:00
|
|
|
|
2020-08-15 19:29:17 +03:00
|
|
|
QString targetLocation;
|
2020-12-03 20:00:14 +03:00
|
|
|
if (package.isDefaultModule()) {
|
2020-08-15 19:29:17 +03:00
|
|
|
targetLocation = cfg->getTargetDir();
|
|
|
|
} else {
|
2020-12-03 20:00:14 +03:00
|
|
|
targetLocation = cfg->getTargetDir() + "/" + releativeLocation(package);
|
2020-08-15 19:29:17 +03:00
|
|
|
}
|
|
|
|
|
2020-12-14 10:52:22 +03:00
|
|
|
if (!ctrl.copyPackage(*it, targetLocation)) {
|
2020-08-15 19:29:17 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-14 15:48:35 +03:00
|
|
|
return true;
|
|
|
|
}
|
2020-01-05 13:58:38 +03:00
|
|
|
|
2020-01-16 11:10:16 +03:00
|
|
|
Envirement DefaultDistro::toolKitEnv() const {
|
2020-01-05 13:58:38 +03:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2020-11-10 11:50:54 +03:00
|
|
|
QList<SystemCommandData> DefaultDistro::runCmd() {
|
2020-01-05 13:58:38 +03:00
|
|
|
return {};
|
|
|
|
}
|
2020-01-15 11:50:30 +03:00
|
|
|
|
|
|
|
bool DefaultDistro::removeTemplate() const {
|
|
|
|
return true;
|
|
|
|
}
|
2020-01-16 11:10:16 +03:00
|
|
|
|
|
|
|
QProcessEnvironment DefaultDistro::processEnvirement() const {
|
|
|
|
return QProcessEnvironment::systemEnvironment();
|
|
|
|
}
|
2020-03-08 13:52:26 +03:00
|
|
|
|
|
|
|
QStringList DefaultDistro::outPutFiles() const {
|
|
|
|
return {};
|
|
|
|
}
|
2020-11-07 01:12:28 +03:00
|
|
|
|
2020-12-03 20:00:14 +03:00
|
|
|
QString DefaultDistro::dataLocation(const DistroModule &) const {
|
2020-11-07 01:12:28 +03:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2020-12-03 20:00:14 +03:00
|
|
|
QString DefaultDistro::location(const DistroModule &) const {
|
2020-11-07 01:12:28 +03:00
|
|
|
return "";
|
|
|
|
}
|
2020-12-03 20:00:14 +03:00
|
|
|
|
|
|
|
QString DefaultDistro::releativeLocation(const DistroModule &module) const {
|
|
|
|
|
|
|
|
if (module.prefix().isEmpty()) {
|
|
|
|
return module.key();
|
|
|
|
}
|
|
|
|
|
|
|
|
return module.prefix();
|
|
|
|
}
|