Compare commits
12 Commits
1197598a3d
...
4cc42b2a65
Author | SHA1 | Date | |
---|---|---|---|
4cc42b2a65 | |||
d783fd7fb6 | |||
e0a0ff54e1 | |||
863d052a21 | |||
61b3d29e31 | |||
cac4f7249e | |||
3223c430be | |||
c09682ea33 | |||
fef1d43d5f | |||
705424727b | |||
b96f0896e3 | |||
a3967c76ac |
@ -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.5
|
VERSION=1.3.6
|
||||||
|
|
||||||
INCLUDEPATH += plugins
|
INCLUDEPATH += plugins
|
||||||
|
|
||||||
@ -27,27 +27,11 @@ 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 += -std=c++17 # for GCC >= 4.7
|
QMAKE_CXXFLAGS += -O2 -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
|
||||||
@ -107,18 +91,6 @@ 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::printCriticalErrorMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
Utils::printInfoMsg("EMPTY RESULT FOR 'GIT FETCH'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -23,6 +23,15 @@
|
|||||||
#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
|
||||||
@ -858,6 +867,7 @@ 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",
|
||||||
@ -875,6 +885,7 @@ 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,8 +180,7 @@ 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.setWindowState(Qt::WindowFullScreen);
|
mw.showFullScreen();
|
||||||
mw.show();
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ void MainWindow::onRestartExitTimer() {
|
|||||||
m_exitTimer->stop();
|
m_exitTimer->stop();
|
||||||
m_exitTimer->start(60 * 1000);
|
m_exitTimer->start(60 * 1000);
|
||||||
|
|
||||||
// ui->updateStatus->blockSignals(true);
|
ui->updateStatus->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onQuit() {
|
void MainWindow::onQuit() {
|
||||||
@ -329,8 +330,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);
|
||||||
|
|
||||||
@ -341,10 +342,12 @@ 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) {
|
||||||
@ -366,12 +369,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) {
|
||||||
@ -405,8 +408,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);
|
||||||
|
145
worker.cpp
145
worker.cpp
@ -88,6 +88,7 @@ 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;
|
||||||
@ -170,8 +171,7 @@ void Worker::privateUpdate() {
|
|||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
emit replaceLast("Initializing customer environment", UPDATE_STEP_DONE);
|
||||||
|
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(5);
|
||||||
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(progress + 10);
|
setProgress(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,9 +195,7 @@ 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);
|
||||||
|
|
||||||
@ -210,11 +208,9 @@ void Worker::privateUpdate() {
|
|||||||
m_returnCode = -3;
|
m_returnCode = -3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_ismasClient.setProgressInPercent(10);
|
if (updateTriggerSet(5)) {
|
||||||
if (updateTriggerSet()) {
|
if (customerEnvironment(30)) {
|
||||||
m_ismasClient.setProgressInPercent(20);
|
m_ismasClient.setProgressInPercent(50);
|
||||||
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
|
||||||
@ -224,23 +220,19 @@ 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));
|
||||||
m_ismasClient.setProgressInPercent(40);
|
if (updateFiles(60)) {
|
||||||
if (updateFiles(50)) {
|
m_ismasClient.setProgressInPercent(70);
|
||||||
m_ismasClient.setProgressInPercent(50);
|
|
||||||
if (syncCustomerRepositoryAndFS()) {
|
if (syncCustomerRepositoryAndFS()) {
|
||||||
m_ismasClient.setProgressInPercent(60);
|
m_ismasClient.setProgressInPercent(80);
|
||||||
if (sendIsmasLastVersionNotification()) {
|
if (sendIsmasLastVersionNotification()) {
|
||||||
m_ismasClient.setProgressInPercent(70);
|
m_ismasClient.setProgressInPercent(90);
|
||||||
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());
|
||||||
@ -325,13 +317,14 @@ 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);
|
||||||
|
|
||||||
@ -414,7 +407,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() {
|
bool Worker::updateTriggerSet(int progress) {
|
||||||
if (m_withoutIsmasDirectPort) { // useful for testing
|
if (m_withoutIsmasDirectPort) { // useful for testing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -450,8 +443,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
= 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();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
QString msg = result.value();
|
QString msg = result.value();
|
||||||
|
|
||||||
@ -490,15 +482,13 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
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")) {
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
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=<"
|
||||||
@ -583,8 +573,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
emit replaceLast(CHECK_UPDATE_TRIGGER_SET, UPDATE_STEP_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progress += 1;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
setProgress(progress);
|
|
||||||
|
|
||||||
if (obj.contains("Fileupload")) {
|
if (obj.contains("Fileupload")) {
|
||||||
QJsonValue v = obj.value("Fileupload");
|
QJsonValue v = obj.value("Fileupload");
|
||||||
@ -602,11 +591,17 @@ bool Worker::updateTriggerSet() {
|
|||||||
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,
|
||||||
@ -618,9 +613,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
} else
|
} else
|
||||||
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
if (QRegExp("\\s*").exactMatch(triggerValue)) { // check for whitespace
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
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;
|
||||||
@ -675,9 +668,7 @@ bool Worker::updateTriggerSet() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
setProgress(m_mainWindow->progressValue()/10 + 11);
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -695,14 +686,14 @@ bool Worker::updateTriggerSet() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::customerEnvironment() {
|
bool Worker::customerEnvironment(int progress) {
|
||||||
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();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(progress);
|
||||||
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());
|
||||||
@ -717,8 +708,8 @@ bool Worker::customerEnvironment() {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stopProgressLoop();
|
stopProgressLoop();
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
m_ismasClient.setProgressInPercent(0);
|
||||||
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"));
|
||||||
@ -736,6 +727,10 @@ bool Worker::customerEnvironment() {
|
|||||||
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;
|
||||||
@ -750,47 +745,38 @@ 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");
|
||||||
|
|
||||||
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
||||||
|
|
||||||
int const size = m_filesToUpdate.size();
|
stopProgressLoop();
|
||||||
if (size > 1) {
|
setProgress(100);
|
||||||
emit appendText(QString("Found %1 files to update :").arg(size), UPDATE_STEP_DONE);
|
|
||||||
for (int i = 0; i < size; ++i) {
|
return false;
|
||||||
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");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
|
|
||||||
Utils::printCriticalErrorMsg("NO FILES TO UPDATE (CHECKED IN ANY FILES?)");
|
|
||||||
}
|
}
|
||||||
setProgress(progress + 30);
|
|
||||||
} else {
|
|
||||||
stopProgressLoop();
|
|
||||||
int progress = (m_mainWindow->progressValue()/10) + 10;
|
|
||||||
setProgress(progress + 30);
|
|
||||||
|
|
||||||
emit showErrorMessage("files to update",
|
Utils::printInfoMsg("FILES-TO-UPDATE " + m_filesToUpdate.join(','));
|
||||||
QString("no changes in ") + m_customerRepository +
|
|
||||||
" (checked-in any files?)");
|
|
||||||
|
|
||||||
Utils::printCriticalErrorMsg("NO CHANGES IN "
|
m_filesToUpdate.removeDuplicates();
|
||||||
+ m_customerRepository
|
int const size = m_filesToUpdate.size();
|
||||||
+ " (CHECKED IN ANY FILES?)");
|
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 {
|
||||||
|
emit appendText("Found 1 file to update :", UPDATE_STEP_DONE);
|
||||||
|
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
setProgress(progress + 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
|
return true;
|
||||||
setProgress(100);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Worker::updateFiles(quint8 percent) {
|
bool Worker::updateFiles(quint8 percent) {
|
||||||
@ -894,7 +880,6 @@ 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();
|
bool updateTriggerSet(int progress);
|
||||||
bool customerEnvironment();
|
bool customerEnvironment(int progress);
|
||||||
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