mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-05 05:59:35 +00:00
check strict mode of snap
This commit is contained in:
parent
a897b5efbd
commit
a6cebc2977
@ -760,8 +760,10 @@ void ConfigParser::initIgnoreList()
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("deploySystem-with-libc")) {
|
||||
|
||||
envUnix.addEnv(Envirement::recursiveInvairement("/lib", 3));
|
||||
envUnix.addEnv(Envirement::recursiveInvairement("/usr/lib", 3));
|
||||
envUnix.addEnv(Envirement::recursiveInvairement(DeployCore::transportPathToSnapRoot("/lib"), 3));
|
||||
envUnix.addEnv(Envirement::recursiveInvairement(DeployCore::transportPathToSnapRoot("/usr/lib"), 3));
|
||||
|
||||
|
||||
ruleUnix.prority = SystemLib;
|
||||
ruleUnix.platform = Unix;
|
||||
ruleUnix.enfirement = envUnix;
|
||||
@ -1067,7 +1069,7 @@ void ConfigParser::setExtraPath(const QStringList &value) {
|
||||
QDir dir;
|
||||
|
||||
for (const auto &i : value) {
|
||||
QFileInfo info(i);
|
||||
QFileInfo info(DeployCore::transportPathToSnapRoot(i));
|
||||
if (info.isDir()) {
|
||||
if (_config.targets().contains(info.absoluteFilePath())) {
|
||||
QuasarAppUtils::Params::log("skip the extra lib path because it is target!",
|
||||
@ -1177,16 +1179,19 @@ iDistribution *ConfigParser::getDistribution() {
|
||||
void ConfigParser::initEnvirement() {
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
auto path = env.value("PATH");
|
||||
if (!DeployCore::isSnap()) {
|
||||
auto path = env.value("PATH");
|
||||
|
||||
_config.envirement.addEnv(env.value("LD_LIBRARY_PATH"));
|
||||
_config.envirement.addEnv(path);
|
||||
_config.envirement.addEnv(env.value("LD_LIBRARY_PATH"));
|
||||
_config.envirement.addEnv(path);
|
||||
}
|
||||
|
||||
QStringList dirs;
|
||||
#ifdef Q_OS_LINUX
|
||||
|
||||
dirs.append(getDirsRecursive("/lib", 5));
|
||||
dirs.append(getDirsRecursive("/usr/lib", 5));
|
||||
dirs.append(getDirsRecursive(DeployCore::transportPathToSnapRoot("/lib"), 5));
|
||||
dirs.append(getDirsRecursive(DeployCore::transportPathToSnapRoot("/usr/lib"), 5));
|
||||
|
||||
#else
|
||||
auto winPath = findWindowsPath(path);
|
||||
dirs.append(getDirsRecursive(winPath + "/System32", 2));
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QLibraryInfo>
|
||||
#include <QProcess>
|
||||
#include <configparser.h>
|
||||
#include <iostream>
|
||||
|
||||
@ -532,6 +533,32 @@ char DeployCore::getEnvSeparator() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DeployCore::isSnap() {
|
||||
return QProcessEnvironment::systemEnvironment().value("SNAP").size();
|
||||
}
|
||||
|
||||
QString DeployCore::snapRootFS() {
|
||||
return "/var/lib/snapd/hostfs";
|
||||
}
|
||||
|
||||
QString DeployCore::transportPathToSnapRoot(const QString &path) {
|
||||
if (isSnap()) {
|
||||
|
||||
if (path.size() && path[0] != "/") {
|
||||
auto absalutPath = QProcessEnvironment::systemEnvironment().value("PWD") + "/" + path;
|
||||
if (!absalutPath.contains(DeployCore::snapRootFS())) {
|
||||
return snapRootFS() + "/" + absalutPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!path.contains(DeployCore::snapRootFS())) {
|
||||
return snapRootFS() + "/" + path;
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
uint qHash(WinAPI i) {
|
||||
return static_cast<uint>(i);
|
||||
}
|
||||
|
@ -190,6 +190,9 @@ public:
|
||||
static QString findProcess(const QString& env, const QString& proc);
|
||||
|
||||
|
||||
static bool isSnap();
|
||||
static QString snapRootFS();
|
||||
static QString transportPathToSnapRoot(const QString &path);
|
||||
};
|
||||
|
||||
#endif // DEPLOYUTILS_H
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "deploycore.h"
|
||||
#include "distromodule.h"
|
||||
|
||||
DistroModule::DistroModule() {
|
||||
@ -25,7 +26,7 @@ void DistroModule::setQmlInput(const QSet<QString> &qmlInput) {
|
||||
}
|
||||
|
||||
void DistroModule::addQmlInput(const QString &target) {
|
||||
_qmlInput.insert(target);
|
||||
_qmlInput.insert(DeployCore::transportPathToSnapRoot(target));
|
||||
}
|
||||
|
||||
QString DistroModule::name() const
|
||||
@ -127,6 +128,6 @@ void DistroModule::setExtraPlugins(const QSet<QString> &extraPlugins)
|
||||
}
|
||||
|
||||
void DistroModule::addExtraPlugins(const QString &extraPlugin) {
|
||||
_extraPlugins += extraPlugin;
|
||||
_extraPlugins += DeployCore::transportPathToSnapRoot(extraPlugin);
|
||||
|
||||
}
|
||||
|
@ -83,6 +83,14 @@ void Envirement::addEnv(const QStringList &listDirs) {
|
||||
}
|
||||
}
|
||||
|
||||
void Envirement::clear() {
|
||||
if (_ignoreEnvList)
|
||||
delete _ignoreEnvList;
|
||||
|
||||
_dataEnvironment.clear();
|
||||
|
||||
}
|
||||
|
||||
bool Envirement::inThisEnvirement(const QString &file) const {
|
||||
QFileInfo info (file);
|
||||
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
void addEnv(const QString &dir);
|
||||
void addEnv(const QStringList &listDirs);
|
||||
|
||||
void clear();
|
||||
|
||||
// return true if file exits in this envirement
|
||||
bool inThisEnvirement(const QString &file) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user