Added/chenged some debug output.

This commit is contained in:
Gerhard Hoffmann 2023-08-09 16:16:36 +02:00
parent 927197d0d1
commit e523d3cc2c

View File

@ -214,30 +214,30 @@ void Worker::privateUpdate() {
setProgress(100); setProgress(100);
m_ismasClient.setProgressInPercent(10); m_ismasClient.setProgressInPercent(10);
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());
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.checkoutBranch( // m_ismasClient.checkoutBranch(
m_updateStatus.m_statusDescription, "")); // m_updateStatus.m_statusDescription, ""));
qCritical() << "CHECKED OUT BRANCH"; qInfo() << "CHECKED OUT BRANCH";
if (backendConnected()) { qCritical() << "BACKEND CONNECTED"; if (backendConnected()) {
m_ismasClient.setProgressInPercent(20); m_ismasClient.setProgressInPercent(20);
if (updateTriggerSet()) { qCritical() << "UPDATE TRIGGER SET"; if (updateTriggerSet()) {
m_ismasClient.setProgressInPercent(30); m_ismasClient.setProgressInPercent(30);
if (customerEnvironment()) { qCritical() << "CUSTOMER ENVIRONMENT"; if (customerEnvironment()) {
m_ismasClient.setProgressInPercent(40); m_ismasClient.setProgressInPercent(40);
if (filesToUpdate()) { qCritical() << "FILES TO UPDATE"; if (filesToUpdate()) {
m_ismasClient.setProgressInPercent(50); m_ismasClient.setProgressInPercent(50);
if (updateFiles(50)) { qCritical() << "UPDATE FILES"; if (updateFiles(50)) {
m_ismasClient.setProgressInPercent(60); m_ismasClient.setProgressInPercent(60);
if (syncCustomerRepositoryAndFS()) { qCritical() << "SYNC REPOSITORY"; if (syncCustomerRepositoryAndFS()) {
m_ismasClient.setProgressInPercent(70); m_ismasClient.setProgressInPercent(70);
if (sendIsmasLastVersionNotification()) { qCritical() << "SEND LAST NOTIFICATION"; if (sendIsmasLastVersionNotification()) {
m_ismasClient.setProgressInPercent(80); m_ismasClient.setProgressInPercent(80);
sentIsmasLastVersionNotification = true; sentIsmasLastVersionNotification = true;
if (saveLogFile()) { qCritical() << "SAVE LOG FILE"; if (saveLogFile()) {
m_ismasClient.setProgressInPercent(90); m_ismasClient.setProgressInPercent(90);
IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT, IsmasClient::sendRequestReceiveResponse(IsmasClient::APISM::DB_PORT,
@ -345,7 +345,8 @@ bool Worker::backendConnected() {
obj = v.toObject(); obj = v.toObject();
bool ismas = obj.value("ISMAS").toBool(); bool ismas = obj.value("ISMAS").toBool();
QString status = obj.value("Broker").toString(); QString status = obj.value("Broker").toString();
qInfo() << "In backendConnected() STATUS" << status; qInfo() << "REPEAT" << repeat << "In backendConnected() Broker=<"
<< status << ">, ISMAS=<" << (ismas ? "true>" : "false>");
if (ismas) { if (ismas) {
if (status == "Connected") { if (status == "Connected") {
// do not send, as this would result in a corrupted wait button // do not send, as this would result in a corrupted wait button
@ -536,6 +537,7 @@ bool Worker::customerEnvironment() {
setProgress(100); setProgress(100);
emit replaceLast("Prepare customer environment ...", UPDATE_STEP_DONE); emit replaceLast("Prepare customer environment ...", UPDATE_STEP_DONE);
qInfo() << "PREPARE CUSTOMER ENVIRONMENT DONE";
return true; return true;
} else { } else {
stopProgressLoop(); stopProgressLoop();
@ -543,9 +545,15 @@ bool Worker::customerEnvironment() {
setProgress(progress); setProgress(progress);
emit showErrorMessage("cust-env", emit showErrorMessage("cust-env",
QString("Checkout ") + m_customerRepository + " failed"); QString("Checkout ") + m_customerRepository + " failed");
qCritical() << QString(80, '*');
qCritical() << "CHECKOUT OF" << m_customerRepository << "FAILED";
qCritical() << QString(80, '*');
} }
} else { } else {
emit showErrorMessage("cust-env", m_customerRepository + " does not exist"); emit showErrorMessage("cust-env", m_customerRepository + " does not exist");
qCritical() << QString(80, '*');
qCritical() << m_customerRepository << "DOES NOT EXIST";
qCritical() << QString(80, '*');
} }
setProgress(100); setProgress(100);
@ -571,17 +579,35 @@ bool Worker::filesToUpdate() {
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();
qInfo() << QString(80, '*');
qInfo() << "FILES-TO-UPDATE" << m_filesToUpdate;
qInfo() << QString(80, '*');
int const size = m_filesToUpdate.size(); int const size = m_filesToUpdate.size();
if (size > 1) { if (size > 1) {
emit appendText(QString("Found %1 files to update ").arg(size), UPDATE_STEP_DONE); 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 appendText("Found 1 file to update :", UPDATE_STEP_DONE);
emit appendText(QString("\n ") + m_filesToUpdate.at(0));
} }
return true; return true;
} }
emit showErrorMessage("files to update", "pulling files failed"); emit showErrorMessage("files to update", "pulling files failed");
qCritical() << QString(80, '*');
qCritical() << "PULLING FILES FAILED";
qCritical() << QString(80, '*');
} else { } else {
emit showErrorMessage("files to update", "no files to update (checked-in any files?)"); emit showErrorMessage("files to update", "no files to update (checked-in any files?)");
qCritical() << QString(80, '*');
qCritical() << "NO FILES TO UPDATE (CHECKED IN ANY FILES?)";
qCritical() << QString(80, '*');
} }
setProgress(progress + 30); setProgress(progress + 30);
} else { } else {
@ -592,6 +618,10 @@ bool Worker::filesToUpdate() {
emit showErrorMessage("files to update", emit showErrorMessage("files to update",
QString("no changes in ") + m_customerRepository + QString("no changes in ") + m_customerRepository +
" (checked-in any files?)"); " (checked-in any files?)");
qCritical() << QString(80, '*');
qCritical() << "NO CHANGES IN" << m_customerRepository << "(CHECKED IN ANY FILES?)";
qCritical() << QString(80, '*');
} }
emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL); emit replaceLast(QString("Fetch changes files ..."), UPDATE_STEP_FAIL);
@ -600,14 +630,19 @@ bool Worker::filesToUpdate() {
} }
bool Worker::updateFiles(quint8 percent) { bool Worker::updateFiles(quint8 percent) {
emit appendText("\n( ) Update opkg pakets ...");
QStringList filesToDownload; QStringList filesToDownload;
m_displayIndex = 0; m_displayIndex = 0;
startProgressLoop(); startProgressLoop();
for (int i = 0; i < m_filesToUpdate.size(); ++i) { for (int i = 0; i < m_filesToUpdate.size(); ++i) {
QString fName = m_filesToUpdate.at(i); QString fName = m_filesToUpdate.at(i);
qInfo() << QString(80, '*');
qInfo() << "FNAME" << fName;
qInfo() << QString(80, '*');
if (fName.contains("opkg_commands", Qt::CaseInsensitive)) { if (fName.contains("opkg_commands", Qt::CaseInsensitive)) {
emit appendText("\n( ) Update opkg pakets ...");
// execute opkg commands // execute opkg commands
if (QDir::setCurrent(m_customerRepository)) { if (QDir::setCurrent(m_customerRepository)) {
QFile f(fName); QFile f(fName);
@ -644,19 +679,29 @@ bool Worker::updateFiles(quint8 percent) {
} else } else
if (fName.contains("print", Qt::CaseInsensitive)) { if (fName.contains("print", Qt::CaseInsensitive)) {
filesToDownload << fName; // download printer-config-files filesToDownload << fName; // download printer-config-files
} else } else {
if (fName == "dc2c.bin") { static const QRegularExpression version("^.*dc2c[.][0-9][0-9][.][0-9][0-9][.]bin.*$");
if (fName.contains(version)) {
filesToDownload << fName; // download device controller filesToDownload << fName; // download device controller
} }
} }
if (filesToDownload.size() > 0) {
qCritical() << "FILES_TO_WORK_ON" << filesToDownload;
} }
bool const ret = m_update->doUpdate(m_displayIndex, filesToDownload);
stopProgressLoop(); stopProgressLoop();
setProgress(100); setProgress(100);
bool ret = true;
if (filesToDownload.size() > 0) {
qInfo() << QString(80, '*');
qInfo() << "FILES_TO_WORK_ON" << filesToDownload;
qInfo() << QString(80, '*');
ret = m_update->doUpdate(m_displayIndex, filesToDownload);
} else {
qInfo() << QString(80, '*');
qInfo() << "NO FILES_TO_WORK_ON";
qInfo() << QString(80, '*');
}
return ret; return ret;
} }
@ -691,12 +736,14 @@ bool Worker::syncCustomerRepositoryAndFS() {
if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) { if (c.execute(m_customerRepository, QStringList() << "-c" << cmd)) {
QStringList result = c.getCommandResult().split('\n'); QStringList result = c.getCommandResult().split('\n');
for (int i = 0; i < result.size(); ++i) { for (int i = 0; i < result.size(); ++i) {
qCritical() << result.at(i); qInfo() << result.at(i);
} }
qCritical() << "SUCCESS"; qInfo() << "SUCCESS";
} else { } else {
qCritical() << QString(80, '*');
qCritical() << "CMD" << cmd << "FAILED"; qCritical() << "CMD" << cmd << "FAILED";
qCritical() << c.getCommandResult().split('\n'); qCritical() << c.getCommandResult().split('\n');
qCritical() << QString(80, '*');
error = true; error = true;
} }
} }
@ -818,9 +865,11 @@ bool Worker::executeOpkgCommand(QString opkgCommand) {
.arg(c.getCommandResult())); .arg(c.getCommandResult()));
return true; return true;
} else { } else {
qCritical() << QString(80, '*');
qCritical() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE, qCritical() << UpdateStatus(UPDATE_STATUS::EXEC_OPKG_COMMAND_FAILURE,
QString("EXECUTE OPKG COMMAND %1 FAILED") QString("EXECUTE OPKG COMMAND %1 FAILED")
.arg(opkgCommand)); .arg(opkgCommand));
qCritical() << QString(80, '*');
} }
return false; return false;
} }