Merge branch 'v1.4' into v1.5

This commit is contained in:
Andrei Yankovich 2020-07-29 19:48:41 +03:00
commit 20012cbc45
17 changed files with 113 additions and 28 deletions

View File

@ -19,7 +19,7 @@ TEMPLATE = lib
DEFINES += DEPLOY_LIBRARY
VERSION = 1.4.5.1
VERSION = 1.4.5.2
DEFINES += APP_VERSION='\\"$$VERSION\\"'

View File

@ -498,6 +498,10 @@ bool ConfigParser::parseDeployMode() {
QuasarAppUtils::Params::setEnable("deploySystem", true );
}
if (!checkSnapPermisions()) {
return false;
}
auto bin = QuasarAppUtils::Params::getStrArg("bin").
split(DeployCore::getSeparator(0));
@ -760,8 +764,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 +1073,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!",
@ -1176,17 +1182,20 @@ iDistribution *ConfigParser::getDistribution() {
void ConfigParser::initEnvirement() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
auto path = env.value("PATH");
_config.envirement.addEnv(env.value("LD_LIBRARY_PATH"));
_config.envirement.addEnv(path);
if (!DeployCore::isSnap()) {
_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));
@ -1202,6 +1211,39 @@ void ConfigParser::initEnvirement() {
}
}
bool ConfigParser::checkSnapPermisions() {
if (!DeployCore::isSnap())
return true;
bool system = QuasarAppUtils::Params::isEndable("deploySystem") ||
QuasarAppUtils::Params::isEndable("extraLibs");
bool checkPath = QDir(DeployCore::snapRootFS()).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).size();
if (system && !checkPath) {
QuasarAppUtils::Params::log("You use a deploySystem or extraLibs options,"
" but not added permision system-backup for cqtdeployer."
" Please add permision system-backup befor usong cqtdeployer."
" Add system-backup permision from console: ",
QuasarAppUtils::Error);
QuasarAppUtils::Params::log(
"'snap connect cqtdeployer:system-backup :system-backup'",
QuasarAppUtils::Info);
QuasarAppUtils::Params::log(
"GUI: Open the gnome system setting >> Applications >> CQtDeployer. "
"in menu rights and permisions enable system-backup.",
QuasarAppUtils::Info);
return false;
}
return true;
}
QStringList ConfigParser::getDirsRecursive(const QString &path, int maxDepch, int depch) {
return getSetDirsRecursive(path, maxDepch, depch).values();
}

View File

@ -82,6 +82,8 @@ private:
void initEnvirement();
bool checkSnapPermisions();
QStringList getDirsRecursive(const QString &path, int maxDepch = -1, int depch = 0);
QSet<QString> getSetDirsRecursive(const QString &path, int maxDepch = -1, int depch = 0);

View File

@ -99,7 +99,7 @@ bool DependenciesScanner::fillLibInfo(LibInfo &info, const QString &file) const
void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QString>& libStack) {
QuasarAppUtils::Params::log("get recursive dependencies of " + lib.fullPath(),
QuasarAppUtils::Info);
QuasarAppUtils::Debug);
if (_scanedLibs.contains(lib.fullPath())) {
auto scanedLib = _scanedLibs.value(lib.fullPath());

View File

@ -15,6 +15,7 @@
#include <QDir>
#include <QFileInfo>
#include <QLibraryInfo>
#include <QProcess>
#include <configparser.h>
#include <iostream>
@ -102,12 +103,12 @@ DeployCore::QtModule DeployCore::getQtModule(const QString& path) {
void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) {
QuasarAppUtils::Params::log("current module " + QString::number(module),
QuasarAppUtils::Info);
QuasarAppUtils::Debug);
auto mod = getQtModule(path);
QuasarAppUtils::Params::log("add new module from path " + path +
" module value " + QString::number(mod),
QuasarAppUtils::Info);
QuasarAppUtils::Debug);
module = static_cast<DeployCore::QtModule>(
@ -531,6 +532,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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View 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;

View File

@ -330,7 +330,7 @@ void Extracter::extractLib(const QString &file,
assert(depMap);
QuasarAppUtils::Params::log("extract lib :" + file,
QuasarAppUtils::Info);
QuasarAppUtils::Debug);
auto data = _scaner->scan(file);

View File

@ -305,7 +305,7 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
if (!skipFilter.isEmpty()) {
QuasarAppUtils::Params::log(
item.absoluteFilePath() + " ignored by filter " + skipFilter,
QuasarAppUtils::VerboseLvl::Info);
QuasarAppUtils::VerboseLvl::Debug);
continue;
}
auto config = DeployCore::_config;
@ -319,7 +319,7 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
if (auto rule = config->ignoreList.isIgnore(info)) {
QuasarAppUtils::Params::log(
item.absoluteFilePath() + " ignored by rule " + rule->label,
QuasarAppUtils::VerboseLvl::Info);
QuasarAppUtils::VerboseLvl::Debug);
continue;
}
@ -461,7 +461,7 @@ bool FileManager::copyFiles(const QStringList &source,
if (!skipFilter.isEmpty()) {
QuasarAppUtils::Params::log(
info.absoluteFilePath() + " ignored by filter " + skipFilter,
QuasarAppUtils::VerboseLvl::Info);
QuasarAppUtils::VerboseLvl::Debug);
continue;
}
auto config = DeployCore::_config;

View File

@ -3,7 +3,7 @@
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.4.5.1</Version>
<Version>1.4.5.2</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>

View File

@ -3,7 +3,7 @@
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.4.5.1</Version>
<Version>1.4.5.2</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>

View File

@ -2,11 +2,11 @@
<Package>
<DisplayName>CQtDeployer 1.4</DisplayName>
<Description>CQtDeployer 1.4</Description>
<Version>1.4.5.1</Version>
<Version>1.4.5.2</Version>
<Default>true</Default>
<ForcedInstallation>false</ForcedInstallation>
<Script>installscript.js</Script>
<ReleaseDate>2020-08-22</ReleaseDate>
<ReleaseDate>2020-08-28</ReleaseDate>
<SortingPriority>201</SortingPriority>
<Translations>
<Translation>ru.qm</Translation>

@ -1 +1 @@
Subproject commit 68f4daac00f7780cbae69b18ed83d0837fd93e04
Subproject commit 838727b12b3d1e6367dd85aa3002d68f0c505a9e

View File

@ -1,5 +1,5 @@
[Desktop Entry]
Version=1.4.5.1
Version=1.4.5.2
Name=CQtDeployer
Comment=CQtDeployer Help.
Exec=cqtdeployer
@ -10,6 +10,6 @@ Categories=Application;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=CQtDeployer
X-GNOME-Bugzilla-Component=General
X-GNOME-Bugzilla-Version=1.4.5.1
X-GNOME-Bugzilla-Version=1.4.5.2
StartupNotify=true
Name[ru_RU]=CQtDeployer

View File

@ -6,7 +6,7 @@
#
name: cqtdeployer # you probably want to 'snapcraft register <name>'
version: '1.4.5.1' # just for humans, typically '1.2+git' or '1.3.2'
version: '1.4.5.2' # just for humans, typically '1.2+git' or '1.3.2'
summary: deploy your qt projects # 79 char long summary
description: |
Console app for deploy qt libs.
@ -21,11 +21,11 @@ icon: snap/gui/icon.png
apps:
cqtdeployer:
command: desktop-launch $SNAP/cqtdeployer.sh
plugs: [home, removable-media, process-control]
plugs: [home, removable-media, process-control, system-backup]
cqt:
command: desktop-launch $SNAP/cqt.sh
plugs: [home, removable-media, process-control]
plugs: [home, removable-media, process-control, system-backup]
parts:
cqtdeployer: