Compare commits
No commits in common. "4cc42b2a650ea2340879038f03f31eb1a1f31727" and "1197598a3d9b436b2a23a3389e070f7800182689" have entirely different histories.
4cc42b2a65
...
1197598a3d
@ -15,7 +15,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# In order to do so, uncomment the following line.
|
# In order to do so, uncomment the following line.
|
||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
VERSION=1.3.6
|
VERSION=1.3.5
|
||||||
|
|
||||||
INCLUDEPATH += plugins
|
INCLUDEPATH += plugins
|
||||||
|
|
||||||
@ -27,11 +27,27 @@ DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
|||||||
QMAKE_CXXFLAGS += -g
|
QMAKE_CXXFLAGS += -g
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
|
||||||
|
# custom target for 'git subtree'
|
||||||
|
# subtree.target = subtree
|
||||||
|
# subtree.commands = git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
||||||
|
# subtree.depends =
|
||||||
|
# QMAKE_EXTRA_UNIX_TARGETS += subtree
|
||||||
|
|
||||||
|
# ! exists(DCPlugin) {
|
||||||
|
# $$system("git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
|
||||||
|
# } else {
|
||||||
|
# $$system("git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
|
||||||
|
# }
|
||||||
|
|
||||||
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
contains( CONFIG, PTU5 ) {
|
contains( CONFIG, PTU5 ) {
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
lessThan(QT_MAJOR_VERSION, 5): PKGCONFIG += qextserialport
|
lessThan(QT_MAJOR_VERSION, 5): PKGCONFIG += qextserialport
|
||||||
QMAKE_CXXFLAGS += -O2 -std=c++17 # for GCC >= 4.7
|
QMAKE_CXXFLAGS += -std=c++17 # for GCC >= 4.7
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
DEFINES+=PTU5
|
DEFINES+=PTU5
|
||||||
@ -91,6 +107,18 @@ HEADERS += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
|
||||||
|
OTHER_FILES += \
|
||||||
|
/opt/app/tools/atbupdate/update_log.csv \
|
||||||
|
main.cpp.bck \
|
||||||
|
main.cpp.bck2 \
|
||||||
|
main.cpp.bck3
|
||||||
|
|
||||||
|
# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
|
||||||
|
# git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
||||||
|
# git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
|
||||||
|
# include(./DCPlugin/DCPlugin.pri)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# for running program on target through QtCreator
|
# for running program on target through QtCreator
|
||||||
|
@ -271,8 +271,8 @@ std::optional<QString> GitClient::gitFetch() {
|
|||||||
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
|
Utils::printCriticalErrorMsg(QString("WRONG FORMAT FOR RESULT OF 'GIT FETCH' ") + s);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
|
emit m_worker->showErrorMessage("git fetch", "empty result for 'git fetch'");
|
||||||
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
Utils::printCriticalErrorMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,15 +23,6 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
########################
|
|
||||||
# Spec vom 27.10.2023:
|
|
||||||
# U0010 -> %-Werte
|
|
||||||
# U0001 -> 100%
|
|
||||||
# U0003 -> "FAIL"
|
|
||||||
# U0002 -> "" (OK -> WAIT state reset)
|
|
||||||
# ISMAS -> "WAIT"
|
|
||||||
########################
|
|
||||||
#
|
|
||||||
# $1: EVENT: U0001 update finished: 100%
|
# $1: EVENT: U0001 update finished: 100%
|
||||||
# U0002 reset TRG
|
# U0002 reset TRG
|
||||||
# U0003 error
|
# U0003 error
|
||||||
@ -867,7 +858,6 @@ QString IsmasClient::jsonParseFailed(int resultCode, QString reason, QString con
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QString> IsmasClient::finalResult(int resultCode, QString reason, QString const &version) {
|
std::optional<QString> IsmasClient::finalResult(int resultCode, QString reason, QString const &version) {
|
||||||
/*
|
|
||||||
m_progressInPercent = 100;
|
m_progressInPercent = 100;
|
||||||
if (resultCode == RESULT_CODE::SUCCESS) {
|
if (resultCode == RESULT_CODE::SUCCESS) {
|
||||||
return updateNewsToIsmas("U0002",
|
return updateNewsToIsmas("U0002",
|
||||||
@ -885,7 +875,6 @@ std::optional<QString> IsmasClient::finalResult(int resultCode, QString reason,
|
|||||||
reason.toStdString().c_str(),
|
reason.toStdString().c_str(),
|
||||||
version.toStdString().c_str());
|
version.toStdString().c_str());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
main.cpp
3
main.cpp
@ -180,7 +180,8 @@ int main(int argc, char *argv[]) {
|
|||||||
worker.setMainWindow(&mw);
|
worker.setMainWindow(&mw);
|
||||||
|
|
||||||
mw.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
mw.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||||
mw.showFullScreen();
|
mw.setWindowState(Qt::WindowFullScreen);
|
||||||
|
mw.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +319,7 @@ void MainWindow::onRestartExitTimer() {
|
|||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(60 * 1000);
|
m_exitTimer->start(60 * 1000);
|
||||||
|
|
||||||
ui->updateStatus->setEnabled(false);
|
// ui->updateStatus->blockSignals(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onQuit() {
|
void MainWindow::onQuit() {
|
||||||
@ -330,8 +329,8 @@ void MainWindow::onQuit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::scrollDownTextEdit() {
|
void MainWindow::scrollDownTextEdit() {
|
||||||
// Utils::printInfoMsg(QString("SCROLL-DOWN-TEXT_EDIT CALLED AT ")
|
Utils::printInfoMsg(QString("SCROLL-DOWN-TEXT_EDIT CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
ui->updateStatus->setEnabled(true);
|
ui->updateStatus->setEnabled(true);
|
||||||
|
|
||||||
@ -342,12 +341,10 @@ void MainWindow::scrollDownTextEdit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAppendText(QString text, QString suffix) {
|
void MainWindow::onAppendText(QString text, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON APPEND CALLED AT ")
|
Utils::printInfoMsg(QString("ON APPEND CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
scrollDownTextEdit();
|
|
||||||
|
|
||||||
if (!suffix.isNull() && suffix.size() > 0) {
|
if (!suffix.isNull() && suffix.size() > 0) {
|
||||||
//qInfo() << "TEXT" << text << "SUFFIX" << suffix;
|
//qInfo() << "TEXT" << text << "SUFFIX" << suffix;
|
||||||
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
|
if (suffix == Worker::UPDATE_STEP_SUCCESS || suffix == Worker::UPDATE_STEP_FAIL) {
|
||||||
@ -369,12 +366,12 @@ void MainWindow::onAppendText(QString text, QString suffix) {
|
|||||||
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
// Utils::printLineEditInfo(editText.split('\n', QString::SplitBehavior::SkipEmptyParts));
|
||||||
// ui->updateStatus->setText(editText.trimmed());
|
// ui->updateStatus->setText(editText.trimmed());
|
||||||
|
|
||||||
// scrollDownTextEdit();
|
scrollDownTextEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
Utils::printInfoMsg(QString("ON REPLACE LAST (LIST) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
int const s = newTextLines.size();
|
int const s = newTextLines.size();
|
||||||
if (s > 0) {
|
if (s > 0) {
|
||||||
@ -408,8 +405,8 @@ void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
void MainWindow::onReplaceLast(QString text, QString suffix) {
|
||||||
// Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ")
|
||||||
// + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
+ QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
|
||||||
|
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts);
|
||||||
|
143
worker.cpp
143
worker.cpp
@ -88,7 +88,6 @@ Worker::Worker(int customerNr,
|
|||||||
m_apismVersion = v.value();
|
m_apismVersion = v.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::printInfoMsg("STARTING PTU-UPDATE");
|
|
||||||
qInfo() << "CURRENT TIME ..............." << QDateTime::currentDateTime().toString(Qt::ISODate);
|
qInfo() << "CURRENT TIME ..............." << QDateTime::currentDateTime().toString(Qt::ISODate);
|
||||||
qInfo() << "OS VERSION ................." << m_osVersion;
|
qInfo() << "OS VERSION ................." << m_osVersion;
|
||||||
qInfo() << "ATBQT VERSION .............." << m_atbqtVersion;
|
qInfo() << "ATBQT VERSION .............." << m_atbqtVersion;
|
||||||
@ -171,7 +170,8 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||||
|
|
||||||
setProgress(5);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CLONE_AND_CHECKOUT_SUCCESS,
|
||||||
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
QString("CLONED AND CHECKED OUT: ") + m_customerRepository);
|
||||||
@ -181,7 +181,7 @@ void Worker::privateUpdate() {
|
|||||||
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
m_ismasClient.cloneAndCheckoutCustomerRepository(
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
setProgress(10);
|
setProgress(progress + 10);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
@ -195,7 +195,9 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = 0;
|
m_returnCode = 0;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
setProgress(0);
|
|
||||||
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
@ -208,9 +210,11 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = -3;
|
m_returnCode = -3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (updateTriggerSet(5)) {
|
m_ismasClient.setProgressInPercent(10);
|
||||||
if (customerEnvironment(30)) {
|
if (updateTriggerSet()) {
|
||||||
m_ismasClient.setProgressInPercent(50);
|
m_ismasClient.setProgressInPercent(20);
|
||||||
|
if (customerEnvironment()) {
|
||||||
|
m_ismasClient.setProgressInPercent(30);
|
||||||
if (filesToUpdate()) {
|
if (filesToUpdate()) {
|
||||||
// send message to ISMAS about files which have been
|
// send message to ISMAS about files which have been
|
||||||
// checked in into git repository
|
// checked in into git repository
|
||||||
@ -220,19 +224,23 @@ void Worker::privateUpdate() {
|
|||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
m_ismasClient.updateOfPSAContinues("CHECK-FILES-TO-UPDATE",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
if (updateFiles(60)) {
|
m_ismasClient.setProgressInPercent(40);
|
||||||
m_ismasClient.setProgressInPercent(70);
|
if (updateFiles(50)) {
|
||||||
|
m_ismasClient.setProgressInPercent(50);
|
||||||
if (syncCustomerRepositoryAndFS()) {
|
if (syncCustomerRepositoryAndFS()) {
|
||||||
m_ismasClient.setProgressInPercent(80);
|
m_ismasClient.setProgressInPercent(60);
|
||||||
if (sendIsmasLastVersionNotification()) {
|
if (sendIsmasLastVersionNotification()) {
|
||||||
m_ismasClient.setProgressInPercent(90);
|
m_ismasClient.setProgressInPercent(70);
|
||||||
sentIsmasLastVersionNotification = true;
|
sentIsmasLastVersionNotification = true;
|
||||||
if (saveLogFile()) {
|
if (saveLogFile()) {
|
||||||
|
m_ismasClient.setProgressInPercent(80);
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSASucceeded(""));
|
m_ismasClient.updateOfPSASucceeded(""));
|
||||||
|
|
||||||
// mark update as activated -> this resets the WAIT button
|
// mark update as activated -> this resets the WAIT button
|
||||||
|
m_ismasClient.setProgressInPercent(95);
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAActivated());
|
m_ismasClient.updateOfPSAActivated());
|
||||||
@ -317,14 +325,13 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
emit appendText(QString("UPDATE "), UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
// m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::UPDATE_PROCESS_FAILURE,
|
||||||
// QString("Update process failed"));
|
QString("Update process failed"));
|
||||||
// if (std::optional<QString> s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
if (std::optional<QString> s = m_ismasClient.finalResult(IsmasClient::RESULT_CODE::INSTALL_ERROR,
|
||||||
// m_updateStatus.m_statusDescription)) {
|
m_updateStatus.m_statusDescription)) {
|
||||||
// IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
// QString("#M=APISM#C=CMD_EVENT#J=") + s.value());
|
QString("#M=APISM#C=CMD_EVENT#J=") + s.value());
|
||||||
// }
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
emit appendText(QString("UPDATE "), UPDATE_STEP_SUCCESS);
|
||||||
|
|
||||||
@ -407,7 +414,7 @@ std::optional<QString> Worker::getApismVersion() {
|
|||||||
|
|
||||||
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
#define CHECK_UPDATE_TRIGGER_SET "Check update trigger ..."
|
||||||
|
|
||||||
bool Worker::updateTriggerSet(int progress) {
|
bool Worker::updateTriggerSet() {
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -443,7 +450,8 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
= IsmasClient::sendRequestReceiveResponse(
|
= IsmasClient::sendRequestReceiveResponse(
|
||||||
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
IsmasClient::APISM::DIRECT_PORT, "#M=APISM#C=REQ_ISMASPARAMETER#J={}")) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
QString msg = result.value();
|
QString msg = result.value();
|
||||||
|
|
||||||
@ -482,13 +490,15 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
progress += 1;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
QJsonObject obj = document.object();
|
QJsonObject obj = document.object();
|
||||||
|
|
||||||
// always look for an 'error' first
|
// always look for an 'error' first
|
||||||
if (obj.contains("error")) {
|
if (obj.contains("error")) {
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
progress += 1;
|
||||||
|
setProgress(progress);
|
||||||
QString value = obj.value("error").toString();
|
QString value = obj.value("error").toString();
|
||||||
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
emit showErrorMessage("check update trigger", QString("REPEAT %1 error=<").arg(repeat) + value + ">");
|
||||||
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
qInfo() << "REPEAT" << repeat << "In updateTriggerSet() error=<"
|
||||||
@ -573,7 +583,8 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
progress += 1;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
QJsonValue v = obj.value("Fileupload");
|
QJsonValue v = obj.value("Fileupload");
|
||||||
@ -591,17 +602,11 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_SANITY_CHECK_OK,
|
||||||
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
QString("MACHINE-NR (%1) AND CUST-NR (%2) OK")
|
||||||
.arg(m_machineNr).arg(m_customerNr));
|
.arg(m_machineNr).arg(m_customerNr));
|
||||||
|
|
||||||
m_ismasClient.setProgressInPercent(progress);
|
|
||||||
|
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
QString("#M=APISM#C=CMD_EVENT#J=") +
|
QString("#M=APISM#C=CMD_EVENT#J=") +
|
||||||
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
m_ismasClient.updateOfPSAContinues("MACHINE-AND-CUSTOMER-CHECK",
|
||||||
m_updateStatus.m_statusDescription));
|
m_updateStatus.m_statusDescription));
|
||||||
|
|
||||||
progress += 5;
|
|
||||||
m_ismasClient.setProgressInPercent(progress);
|
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::ISMAS_UPDATE_TRIGGER_SET,
|
||||||
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
QString("UPDATE TRIGGER SET. CONTINUE. "));
|
||||||
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
|
||||||
@ -613,7 +618,9 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
progress += 1;
|
||||||
|
setProgress(progress);
|
||||||
emit showErrorMessage("check update trigger", "empty update-trigger");
|
emit showErrorMessage("check update trigger", "empty update-trigger");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
continue;
|
continue;
|
||||||
@ -668,7 +675,9 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
progress += 1;
|
||||||
|
setProgress(progress);
|
||||||
emit showErrorMessage("check update trigger", "no ISMAS response");
|
emit showErrorMessage("check update trigger", "no ISMAS response");
|
||||||
QThread::sleep(6);
|
QThread::sleep(6);
|
||||||
}
|
}
|
||||||
@ -686,14 +695,14 @@ bool Worker::updateTriggerSet(int progress) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::customerEnvironment(int progress) {
|
bool Worker::customerEnvironment() {
|
||||||
emit appendText("\nPrepare customer environment ...");
|
emit appendText("\nPrepare customer environment ...");
|
||||||
if (QDir(m_customerRepository).exists()) {
|
if (QDir(m_customerRepository).exists()) {
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
setProgress(m_mainWindow->progressValue()/10 + 11);
|
|
||||||
if (m_gc.gitCheckoutBranch()) {
|
if (m_gc.gitCheckoutBranch()) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
m_ismasClient.setProgressInPercent(progress);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress);
|
||||||
|
|
||||||
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
m_updateStatus = UpdateStatus(UPDATE_STATUS::GIT_CHECKOUT_BRANCH,
|
||||||
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
QString("CHECKED-OUT BRANCH ") + m_gc.branchName());
|
||||||
@ -708,8 +717,8 @@ bool Worker::customerEnvironment(int progress) {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
m_ismasClient.setProgressInPercent(0);
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress);
|
||||||
emit showErrorMessage("cust-env",
|
emit showErrorMessage("cust-env",
|
||||||
QString("Checkout ") + m_customerRepository + " failed");
|
QString("Checkout ") + m_customerRepository + " failed");
|
||||||
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
Utils::printCriticalErrorMsg(QString("CHECKOUT OF " + m_customerRepository + "FAILED"));
|
||||||
@ -727,10 +736,6 @@ bool Worker::customerEnvironment(int progress) {
|
|||||||
bool Worker::filesToUpdate() {
|
bool Worker::filesToUpdate() {
|
||||||
emit appendText("\nFetch changes files ...");
|
emit appendText("\nFetch changes files ...");
|
||||||
startProgressLoop();
|
startProgressLoop();
|
||||||
|
|
||||||
// always execute contents of opkg_commands-file
|
|
||||||
m_filesToUpdate << "etc/psa_update/opkg_commands";
|
|
||||||
|
|
||||||
if (std::optional<QString> changes = m_gc.gitFetch()) {
|
if (std::optional<QString> changes = m_gc.gitFetch()) {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
@ -745,38 +750,47 @@ bool Worker::filesToUpdate() {
|
|||||||
setProgress(progress + 20);
|
setProgress(progress + 20);
|
||||||
if (m_gc.gitPull()) {
|
if (m_gc.gitPull()) {
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_DONE);
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_DONE);
|
||||||
m_filesToUpdate << changedFileNames.value();
|
m_filesToUpdate = changedFileNames.value();
|
||||||
} else {
|
|
||||||
emit showErrorMessage("files to update", "pulling files failed");
|
|
||||||
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
|
||||||
|
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
||||||
|
|
||||||
stopProgressLoop();
|
int const size = m_filesToUpdate.size();
|
||||||
setProgress(100);
|
if (size > 1) {
|
||||||
|
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
||||||
return false;
|
for (int i = 0; i < size; ++i) {
|
||||||
|
emit appendText(QString("\n ") + m_filesToUpdate.at(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emit appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||||
|
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
emit showErrorMessage("files to update", "pulling files failed");
|
||||||
|
Utils::printCriticalErrorMsg("PULLING FILES FAILED");
|
||||||
|
|
||||||
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
|
||||||
|
|
||||||
m_filesToUpdate.removeDuplicates();
|
|
||||||
int const size = m_filesToUpdate.size();
|
|
||||||
if (size > 1) {
|
|
||||||
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
|
||||||
for (int i = 0; i < size; ++i) {
|
|
||||||
emit appendText(QString("\n ") + m_filesToUpdate.at(i));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
emit appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
|
||||||
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
|
Utils::printCriticalErrorMsg("NO FILES TO UPDATE (CHECKED IN ANY FILES?)");
|
||||||
}
|
}
|
||||||
|
|
||||||
setProgress(progress + 30);
|
setProgress(progress + 30);
|
||||||
|
} else {
|
||||||
|
stopProgressLoop();
|
||||||
|
int progress = (m_mainWindow->progressValue()/10) + 10;
|
||||||
|
setProgress(progress + 30);
|
||||||
|
|
||||||
|
emit showErrorMessage("files to update",
|
||||||
|
QString("no changes in ") + m_customerRepository +
|
||||||
|
" (checked-in any files?)");
|
||||||
|
|
||||||
|
Utils::printCriticalErrorMsg("NO CHANGES IN "
|
||||||
|
+ m_customerRepository
|
||||||
|
+ " (CHECKED IN ANY FILES?)");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
||||||
|
setProgress(100);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::updateFiles(quint8 percent) {
|
bool Worker::updateFiles(quint8 percent) {
|
||||||
@ -880,6 +894,7 @@ bool Worker::syncCustomerRepositoryAndFS() {
|
|||||||
"--exclude=.* "
|
"--exclude=.* "
|
||||||
"--include=*.bin "
|
"--include=*.bin "
|
||||||
"--include=*.json "
|
"--include=*.json "
|
||||||
|
"--include=opkg_commands "
|
||||||
"--include=*.ini");
|
"--include=*.ini");
|
||||||
QStringList cmds;
|
QStringList cmds;
|
||||||
cmds << QString("rsync ") + params.simplified() + " etc/ /etc";
|
cmds << QString("rsync ") + params.simplified() + " etc/ /etc";
|
||||||
|
4
worker.h
4
worker.h
@ -190,8 +190,8 @@ public slots:
|
|||||||
void update();
|
void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool updateTriggerSet(int progress);
|
bool updateTriggerSet();
|
||||||
bool customerEnvironment(int progress);
|
bool customerEnvironment();
|
||||||
bool filesToUpdate();
|
bool filesToUpdate();
|
||||||
bool updateFiles(quint8 percent);
|
bool updateFiles(quint8 percent);
|
||||||
bool syncCustomerRepositoryAndFS();
|
bool syncCustomerRepositoryAndFS();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user