From 0a03228dead7864cc28d77e83aa07bc1c0d7bca9 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 11 Apr 2024 16:14:45 +0200 Subject: [PATCH] Added PULL_NEW_BRANCH, PULL_NEW_BRANCH_FAILED, PULL_NEW_BRANCH_SUCCESS and corresponding output messages. --- UpdatePTUDevCtrl/worker.h | 134 +++++++++++++++++++++++++++++--------- 1 file changed, 102 insertions(+), 32 deletions(-) diff --git a/UpdatePTUDevCtrl/worker.h b/UpdatePTUDevCtrl/worker.h index e4c5f93..d9e83ee 100644 --- a/UpdatePTUDevCtrl/worker.h +++ b/UpdatePTUDevCtrl/worker.h @@ -53,38 +53,41 @@ #define _CHECK_ISMAS_TRIGGER_WRONG_VALUE (19) #define _CHECK_ISMAS_TRIGGER_SUCCESS (20) #define _CHECK_ISMAS_TRIGGER_FAILURE (21) -#define _CHECKOUT_BRANCH (22) -#define _CHECKOUT_BRANCH_FAILURE (23) -#define _CHECKOUT_BRANCH_SUCCESS (24) -#define _UPDATE_REPOSITORY (25) -#define _UPDATE_REPOSITORY_FAILURE (26) -#define _UPDATE_REPOSITORY_SUCCESS (27) -#define _CHECK_FOR_REPOSITORY_CHANGES (28) -#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29) -#define _SYNC_CUSTOMER_REPOSITORY (30) -#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (31) -#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (32) -#define _FILES_TO_UPDATE (33) -#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (34) -#define _FILES_TO_DOWNLOAD (35) -#define _EXEC_OPKG_COMMANDS (41) -#define _EXEC_OPKG_COMMAND_1 (42) -#define _EXEC_OPKG_COMMAND_2 (43) -#define _EXEC_OPKG_COMMAND_3 (44) -#define _EXEC_OPKG_COMMAND_4 (45) -#define _EXEC_OPKG_COMMAND_5 (46) -#define _EXEC_OPKG_COMMAND_6 (47) -#define _EXEC_OPKG_COMMAND_7 (48) -#define _EXEC_OPKG_COMMAND_8 (49) -#define _EXEC_OPKG_COMMAND_9 (50) -#define _EXEC_OPKG_COMMAND_LAST (51) -#define _EXEC_OPKG_COMMAND_FAILURE (52) -#define _EXEC_OPKG_COMMAND_SUCCESS (53) -#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (54) -#define _DOWNLOAD_CONFIG_FILE (55) -#define _DOWNLOAD_CONFIG_FILE_SUCCESS (56) -#define _DOWNLOAD_CONFIG_FILE_FAILURE (57) -#define _DOWNLOAD_DEVICE_CONTROLLER (65) +#define _PULL_NEW_BRANCH (22) +#define _PULL_NEW_BRANCH_FAILURE (23) +#define _PULL_NEW_BRANCH_SUCCESS (24) +#define _CHECKOUT_BRANCH (25) +#define _CHECKOUT_BRANCH_FAILURE (26) +#define _CHECKOUT_BRANCH_SUCCESS (27) +#define _UPDATE_REPOSITORY (28) +#define _UPDATE_REPOSITORY_FAILURE (29) +#define _UPDATE_REPOSITORY_SUCCESS (30) +#define _CHECK_FOR_REPOSITORY_CHANGES (31) +#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (32) +#define _SYNC_CUSTOMER_REPOSITORY (33) +#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (34) +#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (35) +#define _FILES_TO_UPDATE (36) +#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (37) +#define _FILES_TO_DOWNLOAD (38) +#define _EXEC_OPKG_COMMANDS (39) +#define _EXEC_OPKG_COMMAND_1 (40) +#define _EXEC_OPKG_COMMAND_2 (41) +#define _EXEC_OPKG_COMMAND_3 (42) +#define _EXEC_OPKG_COMMAND_4 (43) +#define _EXEC_OPKG_COMMAND_5 (44) +#define _EXEC_OPKG_COMMAND_6 (45) +#define _EXEC_OPKG_COMMAND_7 (46) +#define _EXEC_OPKG_COMMAND_8 (47) +#define _EXEC_OPKG_COMMAND_9 (48) +#define _EXEC_OPKG_COMMAND_LAST (49) +#define _EXEC_OPKG_COMMAND_FAILURE (50) +#define _EXEC_OPKG_COMMAND_SUCCESS (51) +#define _DOWNLOAD_FILES_TO_PSA_HARDWARE (60) +#define _DOWNLOAD_CONFIG_FILE (61) +#define _DOWNLOAD_CONFIG_FILE_SUCCESS (62) +#define _DOWNLOAD_CONFIG_FILE_FAILURE (63) +#define _DOWNLOAD_DEVICE_CONTROLLER (64) #define _DOWNLOAD_DEVICE_CONTROLLER_SUCCESS (85) #define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86) #define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87) @@ -162,6 +165,7 @@ class Worker : public QThread{ bool m_ismasTriggerActive = false; bool m_updateNotNecessary = false; bool m_automaticUpdate = false; + bool m_pulledNewBranch = false; QStringList m_ismasTriggerStatusMessage; MainWindow *m_mainWindow; @@ -281,6 +285,9 @@ public: CHECK_ISMAS_TRIGGER_FAILURE = _CHECK_ISMAS_TRIGGER_FAILURE, INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITHOUT_ACTIVE_ISMAS_TRIGGER, INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER = _INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER, + PULL_NEW_BRANCH = _PULL_NEW_BRANCH, + PULL_NEW_BRANCH_FAILURE = _PULL_NEW_BRANCH_FAILURE, + PULL_NEW_BRANCH_SUCCESS = _PULL_NEW_BRANCH_SUCCESS, CHECKOUT_BRANCH = _CHECKOUT_BRANCH, CHECKOUT_BRANCH_SUCCESS = _CHECKOUT_BRANCH_SUCCESS, CHECKOUT_BRANCH_FAILURE = _CHECKOUT_BRANCH_FAILURE, @@ -554,6 +561,18 @@ private: break; case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER: break; + case UPDATE_STEP::PULL_NEW_BRANCH: { + lst << instance->m_debugMsg; + Utils::printUpdateStatusMsg(debug, lst); + } break; + case UPDATE_STEP::PULL_NEW_BRANCH_FAILURE: { + lst << instance->m_debugMsg; + Utils::printUpdateStatusMsg(debug, lst); + } break; + case UPDATE_STEP::PULL_NEW_BRANCH_SUCCESS: { + lst << instance->m_debugMsg; + Utils::printUpdateStatusMsg(debug, lst); + } break; case UPDATE_STEP::CHECKOUT_BRANCH: lst << instance->m_debugMsg; Utils::printUpdateStatusMsg(debug, lst); @@ -872,6 +891,51 @@ private: case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER: ismasClient.setProgressInPercent(_INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER); break; + case UPDATE_STEP::PULL_NEW_BRANCH: { + ismasClient.setProgressInPercent(_PULL_NEW_BRANCH); + QString const &ismasUpdateNews = + QString("#M=APISM#C=CMD_EVENT#J=") + + ismasClient.updateNewsToIsmas( + "U0010", + _PULL_NEW_BRANCH, + IsmasClient::RESULT_CODE::SUCCESS, + smap[UPDATE_STEP::CHECKOUT_BRANCH], + instance->m_ismasMsg.join(' ').toStdString().c_str(), + instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"); + ismasClient.sendRequestReceiveResponse( + IsmasClient::APISM::DB_PORT, ismasUpdateNews); + } + break; + case UPDATE_STEP::PULL_NEW_BRANCH_FAILURE: { + ismasClient.setProgressInPercent(_PULL_NEW_BRANCH_FAILURE); + QString const &ismasUpdateNews = + QString("#M=APISM#C=CMD_EVENT#J=") + + ismasClient.updateNewsToIsmas( + "U0003", + _PULL_NEW_BRANCH_FAILURE, + IsmasClient::RESULT_CODE::INSTALL_ERROR, + smap[UPDATE_STEP::CHECKOUT_BRANCH], + instance->m_ismasMsg.join(' ').toStdString().c_str(), + instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"); + ismasClient.sendRequestReceiveResponse( + IsmasClient::APISM::DB_PORT, ismasUpdateNews); + } + break; + case UPDATE_STEP::PULL_NEW_BRANCH_SUCCESS: { + ismasClient.setProgressInPercent(_PULL_NEW_BRANCH_SUCCESS); + QString const &ismasUpdateNews = + QString("#M=APISM#C=CMD_EVENT#J=") + + ismasClient.updateNewsToIsmas( + "U0010", + _PULL_NEW_BRANCH_SUCCESS, + IsmasClient::RESULT_CODE::SUCCESS, + smap[UPDATE_STEP::CHECKOUT_BRANCH], + instance->m_ismasMsg.join(' ').toStdString().c_str(), + instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A"); + ismasClient.sendRequestReceiveResponse( + IsmasClient::APISM::DB_PORT, ismasUpdateNews); + } + break; case UPDATE_STEP::CHECKOUT_BRANCH: { ismasClient.setProgressInPercent(_CHECKOUT_BRANCH); QString const &ismasUpdateNews = @@ -1305,6 +1369,12 @@ private: break; case UPDATE_STEP::INITIAL_CLONE_WITH_ACTIVE_ISMAS_TRIGGER: break; + case UPDATE_STEP::PULL_NEW_BRANCH: + break; + case UPDATE_STEP::PULL_NEW_BRANCH_FAILURE: + break; + case UPDATE_STEP::PULL_NEW_BRANCH_SUCCESS: + break; case UPDATE_STEP::CHECKOUT_BRANCH: emit worker->appendText("\nPrepare customer environment ..."); break;