Skip to content

Commit

Permalink
Merge pull request #583 from QuasarApp/logs
Browse files Browse the repository at this point in the history
Fix log behavior
  • Loading branch information
EndrII authored May 3, 2021
2 parents 9072cd6 + b0e6fe3 commit 7fda866
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 121 deletions.
2 changes: 1 addition & 1 deletion CQtDeployer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) {


if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
QuasarAppUtils::Params::log("wrong parametrs", QuasarAppUtils::Warning);
QuasarAppUtils::Params::log("Wrong parameters", QuasarAppUtils::Warning);
DeployCore::help();
exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion Deploy/Distributions/deb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool Deb::deployTemplate(PackageControl &pkg) {
}

if (!QFile::setPermissions(local + "/DEBIAN", static_cast<QFile::Permission>(0x7775))) {
QuasarAppUtils::Params::log("permishens set fail", QuasarAppUtils::Warning);
QuasarAppUtils::Params::log("Failed to set permissions", QuasarAppUtils::Warning);
}

outFiles.push_back(info.Name + ".deb");
Expand Down
9 changes: 4 additions & 5 deletions Deploy/Distributions/idistribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ bool iDistribution::unpackFile(const QFileInfo &resource,
QByteArray inputData = file.readAll();
file.close();
if (!QDir().mkpath(target)) {
QuasarAppUtils::Params::log(QString("impossible to create path : %0 ").arg(target),
QuasarAppUtils::Params::log(QString("Failed to create path : %0 ").arg(target),
QuasarAppUtils::Error);
return false;

}

file.setFileName(target + "/" + resource.fileName());
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QuasarAppUtils::Params::log(QString("impossible to write in file: %0 ").arg(file.fileName()),
QuasarAppUtils::Params::log(QString("Failed to open file for writing: %0. %1").arg(file.fileName(),
file.errorString()),
QuasarAppUtils::Error);
return false;
}
Expand Down Expand Up @@ -251,7 +252,7 @@ bool iDistribution::deployIcon(TemplateInfo &info, const DistroModule& pkg) {
info.Icon = releativeLocation(pkg) + "/icons/" + iconInfo.fileName();
if (!copyFile(icon, localData + "/icons/", false)) {

QuasarAppUtils::Params::log(QString("fail to copy icon: %0 ").arg(icon),
QuasarAppUtils::Params::log(QString("Failed to copy icon: %0.").arg(icon),
QuasarAppUtils::Error);

return false;
Expand All @@ -278,5 +279,3 @@ QString iDistribution::releativeLocation(const DistroModule &module) const {

}



3 changes: 1 addition & 2 deletions Deploy/Distributions/qif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ QList<SystemCommandData> QIF::runCmd() {
bool QIF::deployTemplate(PackageControl &pkg) {
if (!initDefaultConfiguratuin()) {

QuasarAppUtils::Params::log("Fail to init rhe default configuration of the qif installer.",
QuasarAppUtils::Params::log("Failed to init the default configuration of qif installer.",
QuasarAppUtils::Error);
return false;
}
Expand Down Expand Up @@ -291,4 +291,3 @@ bool QIF::initDefaultConfiguratuin() {
// init default configuration
return collectInfo(DistroModule{cfg->getDefaultPackage()}, generalInfo);
}

114 changes: 62 additions & 52 deletions Deploy/configparser.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Deploy/configparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DEPLOYSHARED_EXPORT ConfigParser
bool initQmake();
bool initQmlInput();

void packagesErrorLog(const QString &flag);
void packagesErrorLog(const QString &option);

bool setQmake(const QString &value);
bool setQtDir(const QString &value);
Expand Down
12 changes: 6 additions & 6 deletions Deploy/dependenciesscanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ QMultiMap<LibPriority, LibInfo> DependenciesScanner::getLibsFromEnvirement(

if (!fillLibInfo(info, lib)) {
QuasarAppUtils::Params::log(
"error extract lib info from " + lib + "(" + libName + ")",
"Failed to extract lib info from " + lib + "(" + libName + ")",
QuasarAppUtils::VerboseLvl::Warning);
continue;
}
Expand Down Expand Up @@ -101,14 +101,14 @@ 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::Params::log("Get the recursive dependencies of " + lib.fullPath(),
QuasarAppUtils::Debug);

if (_scanedLibs.contains(lib.fullPath())) {
auto scanedLib = _scanedLibs.value(lib.fullPath());

if (!scanedLib.isValid()) {
QuasarAppUtils::Params::log( "no valid lib in scanned libs list!",
QuasarAppUtils::Params::log( "Detected an invalid library in scanned library cache!!",
QuasarAppUtils::Error);
return;
}
Expand All @@ -120,7 +120,7 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS

if (libStack.contains(lib.fullPath())) {
QuasarAppUtils::Params::log("A recursive dependency was found in library " + lib.fullPath(),
QuasarAppUtils::Warning);
QuasarAppUtils::Warning);
return;
}

Expand All @@ -131,8 +131,8 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS
auto libs = getLibsFromEnvirement(i);

if (!libs.size()) {
QuasarAppUtils::Params::log("lib for dependency " + i + " not found!!",
QuasarAppUtils::Warning);
QuasarAppUtils::Params::log("Cannot find the library for dependency " + i,
QuasarAppUtils::Debug);
continue;
}

Expand Down
16 changes: 8 additions & 8 deletions Deploy/deploycore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ 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::Params::log("Current module " + QString::number(module),
QuasarAppUtils::Debug);

auto mod = getQtModule(path);
QuasarAppUtils::Params::log("add new module from path " + path +
QuasarAppUtils::Params::log("Add new module from path " + path +
" module value " + QString::number(mod),
QuasarAppUtils::Debug);

Expand Down Expand Up @@ -327,9 +327,9 @@ void DeployCore::help() {
}
};

help.unite(QuasarAppUtils::Params::getparamsHelp());
help.unite(QuasarAppUtils::Params::getParamsHelp());

QuasarAppUtils::Params::showHelp(help);
QuasarAppUtils::Help::print(help);

return;
}
Expand Down Expand Up @@ -491,19 +491,19 @@ MSVCVersion DeployCore::getMSVC(const QString &_qtBin) {
QDir dir = QFileInfo(_qtBin).absoluteFilePath();

if (!dir.cdUp()) {
QuasarAppUtils::Params::log("is not standart qt repo");
QuasarAppUtils::Params::log("is not a standard qt repo", QuasarAppUtils::Debug);
return static_cast<MSVCVersion>(res);
}

auto msvcPath = dir.absolutePath();

if (!(dir.cdUp() && dir.cdUp())) {
QuasarAppUtils::Params::log("is not standart qt repo");
QuasarAppUtils::Params::log("is not a standard qt repo", QuasarAppUtils::Debug);
return static_cast<MSVCVersion>(res);
}

if (!msvcPath.contains("msvc")) {
QuasarAppUtils::Params::log("vcredis not defined");
QuasarAppUtils::Params::log("vcredist not defined", QuasarAppUtils::Debug);
return static_cast<MSVCVersion>(res);
}

Expand Down Expand Up @@ -540,7 +540,7 @@ QString DeployCore::getVCredist(const QString &_qtbinDir) {
QDir dir = _qtbinDir;

if (!(dir.cdUp() && dir.cdUp() && dir.cdUp() && dir.cd("vcredist"))) {
QuasarAppUtils::Params::log("redist not found!");
QuasarAppUtils::Params::log("vcredist not found!");
return "";
}

Expand Down
6 changes: 4 additions & 2 deletions Deploy/envirement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ void Envirement::addEnv(const QStringList &listDirs) {
}

if (!QFileInfo(path).isDir()) {
QuasarAppUtils::Params::log("is not dir!! :" + path);
QuasarAppUtils::Params::log(QString("%0 is not a directory!! ").arg(path),
QuasarAppUtils::Debug);
continue;
}

if (_dataEnvironment.contains(path)) {
QuasarAppUtils::Params::log ("Environment alredy added: " + path);
QuasarAppUtils::Params::log (QString("Path %0 is already added").arg(path),
QuasarAppUtils::Debug);
continue;
}

Expand Down
28 changes: 12 additions & 16 deletions Deploy/extracter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#include <fstream>

bool Extracter::deployMSVC() {
QuasarAppUtils::Params::log("try deploy msvc",
QuasarAppUtils::Info);
QuasarAppUtils::Params::log("Trying to deploy msvc", QuasarAppUtils::Debug);
auto msvcInstaller = DeployCore::getVCredist(DeployCore::_config->qtDir.getBins());

if (msvcInstaller.isEmpty()) {
Expand Down Expand Up @@ -146,7 +145,7 @@ void Extracter::copyExtraPlugins(const QString& package) {
if (!_fileManager->copyFile(info.absoluteFilePath(),
targetPath + distro.getPluginsOutDir())) {

QuasarAppUtils::Params::log("fail to copy extra plugin from:" + info.absoluteFilePath() +
QuasarAppUtils::Params::log("Failed to copy extra plugin from:" + info.absoluteFilePath() +
" to: " + targetPath + distro.getPluginsOutDir(),
QuasarAppUtils::Warning);
}
Expand All @@ -162,7 +161,7 @@ void Extracter::copyExtraPlugins(const QString& package) {
DeployCore::debugExtensions(),
&plugins)) {

QuasarAppUtils::Params::log("fail to copy extra plugin from:" + info.absoluteFilePath() +
QuasarAppUtils::Params::log("Failed to copy extra plugin from:" + info.absoluteFilePath() +
" to: " + targetPath + distro.getPluginsOutDir(),
QuasarAppUtils::Warning);
}
Expand Down Expand Up @@ -211,9 +210,7 @@ void Extracter::copyLibs(const QSet<QString> &files, const QString& package, boo
}

for (const auto &file : files) {
if (!_fileManager->smartCopyFile(file, libOutpath)) {
QuasarAppUtils::Params::log(file + " not copied");
}
_fileManager->smartCopyFile(file, libOutpath);
}
}

Expand All @@ -225,7 +222,7 @@ void Extracter::copyExtraData(const QSet<QString> &files, const QString &package
for (const auto &file : files) {

if (!_fileManager->cp(file, targetPath + distro.getExtraDataOutDir())) {
QuasarAppUtils::Params::log(file + " not copied");
QuasarAppUtils::Params::log("Failed to copy " + file);
}
}
}
Expand All @@ -243,7 +240,7 @@ void Extracter::copyFiles() {


if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(cnf->getTargetDir())) {
QuasarAppUtils::Params::log("strip failed!");
QuasarAppUtils::Params::log("Failed to strip libraries!");
}

copyExtraData(_packageDependencyes[i.key()].extraData(), i.key());
Expand Down Expand Up @@ -276,7 +273,7 @@ bool Extracter::copyTr() {

bool Extracter::deploy() {
QuasarAppUtils::Params::log("target deploy started!!",
QuasarAppUtils::Info);
QuasarAppUtils::Debug);
if (!_cqt->smartMoveTargets()) {
QuasarAppUtils::Params::log("Fail to copy targets", QuasarAppUtils::Error);
return false;
Expand All @@ -287,7 +284,7 @@ bool Extracter::deploy() {
extractExtraDataTargets();

if (DeployCore::_config->deployQml && !extractQml()) {
QuasarAppUtils::Params::log("qml not extacted!",
QuasarAppUtils::Params::log("Failed to extract qml!",
QuasarAppUtils::Error);
}

Expand All @@ -307,7 +304,7 @@ bool Extracter::deploy() {
}

if (!deployMSVC()) {
QuasarAppUtils::Params::log("deploy msvc failed", QuasarAppUtils::Warning);
QuasarAppUtils::Params::log("Failed to deploy msvc", QuasarAppUtils::Debug);
}

_metaFileManager->createRunMetaFiles(_targetModules);
Expand Down Expand Up @@ -428,22 +425,22 @@ bool Extracter::extractQml() {
QFileInfo info(qmlInput);

if (!info.isDir()) {
QuasarAppUtils::Params::log("extract qml fail! qml source dir not exits or is not dir " + qmlInput,
QuasarAppUtils::Params::log("Failed to extract qml! The qml source dir does not exist :" + qmlInput,
QuasarAppUtils::Error);
continue;
}
QuasarAppUtils::Params::log("extractQmlFromSource " + info.absoluteFilePath());

if (!QFileInfo::exists(cnf->qtDir.getQmls())) {
QuasarAppUtils::Params::log("qml dir wrong!",
QuasarAppUtils::Params::log("Failed to extract qml! The qt qml dir is not initialized!",
QuasarAppUtils::Warning);
continue;
}

QML ownQmlScaner(cnf->qtDir.getQmls(), cnf->isNeededQt(i.key()));

if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
QuasarAppUtils::Params::log("qml scaner run failed!",
QuasarAppUtils::Params::log("Failed to run qml scanner",
QuasarAppUtils::Error);
continue;
}
Expand Down Expand Up @@ -504,4 +501,3 @@ Extracter::Extracter(FileManager *fileManager, PluginsParser *pluginsParser, Con

_metaFileManager = new MetaFileManager(_fileManager);
}

Loading

0 comments on commit 7fda866

Please sign in to comment.