Merge pull request #795 from QuasarApp/dev
All checks were successful
buildbot/DocsGenerator Build finished.
buildbot/AndroidBuilder_v8Qt6 Build finished.
buildbot/LinuxCMakeBuilderQt6 Build finished.
buildbot/IOSCMakeBuilder Build finished.
buildbot/WindowsCMakeBuilder Build finished.

Sync main bracnh and dev
This commit is contained in:
Andrei Yankovich 2024-02-05 23:23:19 +01:00 committed by GitHub
commit b411d46c6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 64 deletions

View File

@ -23,6 +23,7 @@
#include <Distributions/defaultdistro.h> #include <Distributions/defaultdistro.h>
#include <Distributions/qif.h> #include <Distributions/qif.h>
#include <Distributions/ziparhive.h> #include <Distributions/ziparhive.h>
#include <qaplatformutils.h>
/** /**
@ -740,7 +741,7 @@ bool ConfigParser::parseDeployMode(bool checkBin) {
if (!initQmake()) { if (!initQmake()) {
if (DeployCore::isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
QuasarAppUtils::Params::log("If you are using qmake from the system repository," QuasarAppUtils::Params::log("If you are using qmake from the system repository,"
" then you must use the classic version of CQtDeployer instead of the snap version." " then you must use the classic version of CQtDeployer instead of the snap version."
" This is due to the fact that the snap version" " This is due to the fact that the snap version"
@ -1024,9 +1025,11 @@ void ConfigParser::initIgnoreList()
envUnix.addEnv(Envirement::recursiveInvairement("/lib", 3)); envUnix.addEnv(Envirement::recursiveInvairement("/lib", 3));
envUnix.addEnv(Envirement::recursiveInvairement("/usr/lib", 3)); envUnix.addEnv(Envirement::recursiveInvairement("/usr/lib", 3));
if (DeployCore::isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
envUnix.addEnv(Envirement::recursiveInvairement(DeployCore::transportPathToSnapRoot("/lib"), 3)); envUnix.addEnv(Envirement::recursiveInvairement(
envUnix.addEnv(Envirement::recursiveInvairement(DeployCore::transportPathToSnapRoot("/usr/lib"), 3)); QuasarAppUtils::PlatformUtils::transportPathToSnapRoot("/lib"), 3));
envUnix.addEnv(Envirement::recursiveInvairement(
QuasarAppUtils::PlatformUtils::transportPathToSnapRoot("/usr/lib"), 3));
} }
ruleUnix.prority = SystemLib; ruleUnix.prority = SystemLib;
@ -1113,7 +1116,7 @@ void ConfigParser::initIgnoreEnvList() {
} }
// forbid pathes of the snap container // forbid pathes of the snap container
if (DeployCore::isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
ignoreEnvList.push_back("/lib"); ignoreEnvList.push_back("/lib");
ignoreEnvList.push_back("/usr/lib"); ignoreEnvList.push_back("/usr/lib");
} }
@ -1134,7 +1137,7 @@ QString ConfigParser::getPathFrmoQmakeLine(const QString &in) const {
auto list = in.split(':'); auto list = in.split(':');
if (list.size() > 1) { if (list.size() > 1) {
list.removeAt(0); list.removeAt(0);
return DeployCore::transportPathToSnapRoot( return QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(
QFileInfo(list.join(':')).absoluteFilePath().remove('\r')); QFileInfo(list.join(':')).absoluteFilePath().remove('\r'));
} }
@ -1151,7 +1154,7 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
// Invoke qmake executable only when qmake paths exclude snapRootFS path. // Invoke qmake executable only when qmake paths exclude snapRootFS path.
// Because files in snapRootFS is not executable ... // Because files in snapRootFS is not executable ...
if (!qmake.contains(DeployCore::snapRootFS()) && setQmake(qmake)) { if (!qmake.contains(QuasarAppUtils::PlatformUtils::snapRootFS()) && setQmake(qmake)) {
return true; return true;
} }
@ -1167,8 +1170,8 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
QString debianQtRoot = QString("/usr/lib/%0/qt%1"). QString debianQtRoot = QString("/usr/lib/%0/qt%1").
arg(neededPlatform).arg(qtVersion); arg(neededPlatform).arg(qtVersion);
if (DeployCore::isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
debianQtRoot = DeployCore::snapRootFS() + debianQtRoot; debianQtRoot = QuasarAppUtils::PlatformUtils::snapRootFS() + debianQtRoot;
} }
if (!setQtDir(debianQtRoot)) { if (!setQtDir(debianQtRoot)) {
@ -1189,7 +1192,7 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
} }
// For snap package of cqtdeplyer it is normal behavior // For snap package of cqtdeplyer it is normal behavior
if (!DeployCore::isSnap()) { if (!QuasarAppUtils::PlatformUtils::isSnap()) {
QuasarAppUtils::Params::log("Failed to execute the qmake process!" QuasarAppUtils::Params::log("Failed to execute the qmake process!"
" Trying to initialize Qt directories from path: " + dir.absolutePath(), " Trying to initialize Qt directories from path: " + dir.absolutePath(),
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
@ -1214,7 +1217,8 @@ bool ConfigParser::initQmake() {
return true; return true;
} }
auto qmake = DeployCore::transportPathToSnapRoot(QuasarAppUtils::Params::getArg("qmake")); auto qmake = QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(
QuasarAppUtils::Params::getArg("qmake"));
QFileInfo info(qmake); QFileInfo info(qmake);
@ -1409,7 +1413,7 @@ bool ConfigParser::initExtraPath() {
QDir dir; QDir dir;
for (const auto &i : listLibDir) { for (const auto &i : listLibDir) {
QFileInfo info(DeployCore::transportPathToSnapRoot(i)); QFileInfo info(QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(i));
if (info.isDir()) { if (info.isDir()) {
if (_config.targets().contains(info.absoluteFilePath())) { if (_config.targets().contains(info.absoluteFilePath())) {
QuasarAppUtils::Params::log("Skip the extra library path because it is target!", QuasarAppUtils::Params::log("Skip the extra library path because it is target!",
@ -1563,7 +1567,7 @@ void ConfigParser::initEnvirement() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
auto path = env.value("PATH"); auto path = env.value("PATH");
if (!DeployCore::isSnap()) { if (!QuasarAppUtils::PlatformUtils::isSnap()) {
_config.envirement.addEnv(env.value("LD_LIBRARY_PATH")); _config.envirement.addEnv(env.value("LD_LIBRARY_PATH"));
_config.envirement.addEnv(path); _config.envirement.addEnv(path);
@ -1572,8 +1576,8 @@ void ConfigParser::initEnvirement() {
QStringList dirs; QStringList dirs;
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
dirs.append(getDirsRecursive(DeployCore::transportPathToSnapRoot("/lib"), 5)); dirs.append(getDirsRecursive(QuasarAppUtils::PlatformUtils::transportPathToSnapRoot("/lib"), 5));
dirs.append(getDirsRecursive(DeployCore::transportPathToSnapRoot("/usr/lib"), 5)); dirs.append(getDirsRecursive(QuasarAppUtils::PlatformUtils::transportPathToSnapRoot("/usr/lib"), 5));
#else #else
auto winPath = findWindowsPath(path); auto winPath = findWindowsPath(path);
@ -1592,14 +1596,14 @@ void ConfigParser::initEnvirement() {
bool ConfigParser::checkSnapPermisions() { bool ConfigParser::checkSnapPermisions() {
if (!DeployCore::isSnap()) if (!QuasarAppUtils::PlatformUtils::isSnap())
return true; return true;
bool system = QuasarAppUtils::Params::isEndable("deploySystem") || bool system = QuasarAppUtils::Params::isEndable("deploySystem") ||
QuasarAppUtils::Params::isEndable("extraLibs"); QuasarAppUtils::Params::isEndable("extraLibs");
if (system && !DeployCore::checkSystemBakupSnapInterface()) { if (system && !QuasarAppUtils::PlatformUtils::checkSystemBakupSnapInterface()) {
QuasarAppUtils::Params::log("You use a deploySystem or extraLibs options," QuasarAppUtils::Params::log("You use a deploySystem or extraLibs options,"
" but not added permision system-backup for cqtdeployer." " but not added permision system-backup for cqtdeployer."

View File

@ -16,6 +16,7 @@
#include <QProcess> #include <QProcess>
#include <configparser.h> #include <configparser.h>
#include <iostream> #include <iostream>
#include <qaplatformutils.h>
//QString DeployCore::qtDir = ""; //QString DeployCore::qtDir = "";
//QStringList DeployCore::extraPaths = QStringList(); //QStringList DeployCore::extraPaths = QStringList();
@ -609,7 +610,7 @@ QString DeployCore::getAppVersion() {
} }
QString DeployCore::getAppVersionName() { QString DeployCore::getAppVersionName() {
if (isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
return "*** Cool Core (snap) ***"; return "*** Cool Core (snap) ***";
} }
return "*** Cool Core ***"; return "*** Cool Core ***";
@ -661,9 +662,10 @@ QString DeployCore::findProcess(const QString &env, const QString& proc, bool ig
} }
// working only for the snap version of cqtdeployer ... // working only for the snap version of cqtdeployer ...
if (isSnap()) { if (QuasarAppUtils::PlatformUtils::isSnap()) {
for (const auto& path : list) { for (const auto& path : list) {
auto files = QDir(transportPathToSnapRoot(path)).entryInfoList(findEntries); auto files = QDir(QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(path)).
entryInfoList(findEntries);
for (const auto& bin : files) { for (const auto& bin : files) {
if (bin.baseName().compare(proc, DeployCore::getCaseSensitivity()) == 0) { if (bin.baseName().compare(proc, DeployCore::getCaseSensitivity()) == 0) {
@ -1006,40 +1008,6 @@ char DeployCore::getEnvSeparator() {
#endif #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() && checkSystemBakupSnapInterface()) {
if(QFileInfo(path).isWritable()) {
return path;
}
if (path.size() && path[0] != QString("/")) {
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;
}
bool DeployCore::checkSystemBakupSnapInterface() {
return QDir(DeployCore::snapRootFS()).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).size();
}
void DeployCore::printInternalError(const char * function, const char* file, int line ) { void DeployCore::printInternalError(const char * function, const char* file, int line ) {
QuasarAppUtils::Params::log(QString("Internal error ocurred in %0 (%1:%2).").arg(function, file).arg(line), QuasarAppUtils::Params::log(QString("Internal error ocurred in %0 (%1:%2).").arg(function, file).arg(line),
QuasarAppUtils::Error); QuasarAppUtils::Error);

View File

@ -283,11 +283,6 @@ public:
static QStringList debugExtensions(); static QStringList debugExtensions();
static bool isDebugFile(const QString& file); static bool isDebugFile(const QString& file);
static bool isSnap();
static QString snapRootFS();
static QString transportPathToSnapRoot(const QString &path);
static bool checkSystemBakupSnapInterface();
/** /**
* @brief getLibCoreName This method remove platfomr specificly prefixes and sufixes of the librarry. * @brief getLibCoreName This method remove platfomr specificly prefixes and sufixes of the librarry.
* Example : getLibCoreName(libTest.so) return Test * Example : getLibCoreName(libTest.so) return Test

View File

@ -8,6 +8,7 @@
#include "deployconfig.h" #include "deployconfig.h"
#include "deploycore.h" #include "deploycore.h"
#include "distromodule.h" #include "distromodule.h"
#include <qaplatformutils.h>
DistroModule::DistroModule(const QString& key) { DistroModule::DistroModule(const QString& key) {
setKey(key); setKey(key);
@ -34,7 +35,7 @@ void DistroModule::setQmlInput(const QSet<QString> &qmlInput) {
} }
void DistroModule::addQmlInput(const QString &target) { void DistroModule::addQmlInput(const QString &target) {
_qmlInput.insert(DeployCore::transportPathToSnapRoot(target)); _qmlInput.insert(QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(target));
} }
QString DistroModule::name() const { QString DistroModule::name() const {
@ -110,7 +111,7 @@ void DistroModule::setExtraPlugins(const QSet<QString> &extraPlugins) {
} }
void DistroModule::addExtraPlugins(const QString &extraPlugin) { void DistroModule::addExtraPlugins(const QString &extraPlugin) {
_extraPlugins += DeployCore::transportPathToSnapRoot(extraPlugin); _extraPlugins += QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(extraPlugin);
} }

View File

@ -66,9 +66,10 @@ QString ELF::extractRPath(ElfReader& reader) const {
for (const auto &path: pathes) { for (const auto &path: pathes) {
if (path.contains("/")) { if (path.contains("/")) {
if (result.size()) { if (result.size()) {
result += DeployCore::getEnvSeparator() + DeployCore::transportPathToSnapRoot(path); result += DeployCore::getEnvSeparator() +
QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(path);
} else { } else {
result += DeployCore::transportPathToSnapRoot(path); result += QuasarAppUtils::PlatformUtils::transportPathToSnapRoot(path);
} }
} }
} }

@ -1 +1 @@
Subproject commit 37fe8a069b88a1b389868b6556e078e1310e9e95 Subproject commit b7b0f330c6866cbc01eb663a5dc6de863815cb58