2020-10-29 21:16:45 +03:00
|
|
|
#include "deb.h"
|
|
|
|
|
|
|
|
#include <deployconfig.h>
|
|
|
|
#include <pathutils.h>
|
|
|
|
#include <packagecontrol.h>
|
2020-11-07 01:12:28 +03:00
|
|
|
#include <QProcess>
|
2020-10-29 21:16:45 +03:00
|
|
|
|
|
|
|
Deb::Deb(FileManager *fileManager):
|
|
|
|
iDistribution(fileManager)
|
|
|
|
{
|
2020-11-07 01:12:28 +03:00
|
|
|
setLocation("tmp DEB");
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
TemplateInfo info;
|
|
|
|
|
2020-11-07 01:12:28 +03:00
|
|
|
if (!collectInfo(it, cfg, info)) {
|
|
|
|
return false;
|
|
|
|
};
|
2020-10-29 21:16:45 +03:00
|
|
|
|
2020-11-07 01:12:28 +03:00
|
|
|
auto local = location(info.Name);
|
2020-10-29 21:16:45 +03:00
|
|
|
|
2020-11-07 01:12:28 +03:00
|
|
|
if (!pkg.movePackage(it.key(), local)) {
|
2020-10-29 21:16:45 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-11-07 01:12:28 +03:00
|
|
|
if (!unpackDir("qrc:/Templates/DEB/Distributions/Templates/deb",
|
|
|
|
local, info, {""})) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Deb::removeTemplate() const {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Envirement Deb::toolKitEnv() const {
|
2020-11-07 01:12:28 +03:00
|
|
|
Envirement result;
|
|
|
|
result.addEnv(QProcessEnvironment::systemEnvironment().value("PATH"));
|
2020-10-29 21:16:45 +03:00
|
|
|
|
2020-11-07 01:12:28 +03:00
|
|
|
return result;
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QProcessEnvironment Deb::processEnvirement() const {
|
2020-11-07 01:12:28 +03:00
|
|
|
return QProcessEnvironment::systemEnvironment();
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Deb::runCmd() {
|
2020-11-07 01:12:28 +03:00
|
|
|
return "dpkg-deb";
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList Deb::runArg() const {
|
2020-11-07 01:12:28 +03:00
|
|
|
return {"--build"};
|
2020-10-29 21:16:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList Deb::outPutFiles() const {
|
|
|
|
|
|
|
|
}
|
2020-11-07 01:12:28 +03:00
|
|
|
|
|
|
|
QString Deb::dataLocation(const QString &packageName) const {
|
|
|
|
return location(packageName);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Deb::location(const QString &packageName) const {
|
|
|
|
const DeployConfig* cfg = DeployCore::_config;
|
|
|
|
|
|
|
|
return cfg->getTargetDir() + "/" + getLocation() + "/" + packageName;
|
|
|
|
}
|