checkin for saving current state
This commit is contained in:
@@ -216,7 +216,9 @@ GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||
|
||||
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||
|
||||
INCLUDEPATH += plugins
|
||||
# INCLUDEPATH += plugins
|
||||
INCLUDEPATH += plugins \
|
||||
$${_PRO_FILE_PWD_}/../common/include
|
||||
|
||||
CONFIG += c++17
|
||||
# CONFIG -= app_bundle
|
||||
@@ -291,7 +293,8 @@ SOURCES += \
|
||||
message_handler.cpp \
|
||||
worker.cpp \
|
||||
commandline_parser.cpp \
|
||||
work_process_list.cpp
|
||||
work_process_list.cpp \
|
||||
../common/src/utils_internal.cpp
|
||||
|
||||
HEADERS += \
|
||||
update.h \
|
||||
@@ -315,7 +318,8 @@ HEADERS += \
|
||||
message_handler.h \
|
||||
worker.h \
|
||||
commandline_parser.h \
|
||||
work_process_list.h
|
||||
work_process_list.h \
|
||||
../common/include/utils_internal.h
|
||||
|
||||
|
||||
OTHER_FILES += \
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <QThread>
|
||||
#include <QtWidgets>
|
||||
#include <QScopedPointer>
|
||||
#include <QScreen>
|
||||
|
||||
#if defined (Q_OS_UNIX) || defined (Q_OS_LINUX)
|
||||
#include <unistd.h>
|
||||
@@ -48,6 +49,17 @@
|
||||
#define SERIAL_PORT "ttyUSB0"
|
||||
#endif
|
||||
|
||||
//QString Orientation(Qt::ScreenOrientation orientation) {
|
||||
// switch (orientation) {
|
||||
// case Qt::PrimaryOrientation : return "Primary";
|
||||
// case Qt::LandscapeOrientation : return "Landscape";
|
||||
// case Qt::PortraitOrientation : return "Portrait";
|
||||
// case Qt::InvertedLandscapeOrientation : return "Inverted landscape";
|
||||
// case Qt::InvertedPortraitOrientation : return "Inverted portrait";
|
||||
// default : return "Unknown";
|
||||
// }
|
||||
//}
|
||||
|
||||
// argv[1]: file to send to dc
|
||||
int main(int argc, char *argv[]) {
|
||||
QByteArray const value = qgetenv("LC_ALL");
|
||||
@@ -70,6 +82,15 @@ int main(int argc, char *argv[]) {
|
||||
setDebugLevel(LOG_NOTICE);
|
||||
}
|
||||
|
||||
//qCritical() << "Number of screens:" << QGuiApplication::screens().size();
|
||||
//qCritical() << "Primary screen:" << QGuiApplication::primaryScreen()->name();
|
||||
|
||||
//foreach (QScreen *screen, QGuiApplication::screens()) {
|
||||
// qDebug() << "Information for screen:" << screen->name();
|
||||
// qDebug() << " Orientation:" << Orientation(screen->orientation());
|
||||
//}
|
||||
//return 0;
|
||||
|
||||
CommandLineParser parser;
|
||||
parser.process(a);
|
||||
parser.readSettings();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ui_mainwindow.h"
|
||||
#include "worker.h"
|
||||
#include "utils.h"
|
||||
#include "utils_internal.h"
|
||||
#include "progress_event.h"
|
||||
#include "update_dc_event.h"
|
||||
#include "process/update_command.h"
|
||||
@@ -158,14 +159,27 @@ void MainWindow::onShowISMASConnectivity(QString status) {
|
||||
tmp += " ";
|
||||
}
|
||||
|
||||
bool const custRepoExists = internal::customerRepoExists();
|
||||
|
||||
if (status.contains(UpdateCommand::ISMAS_CONNECTED, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Green'>connected</font><br />").arg(tmp);
|
||||
if (custRepoExists) {
|
||||
s += QString("%1 <font color='Green'>connected</font><br />").arg(tmp);
|
||||
} else {
|
||||
s += QString("%1 <font color='Green'>connected (initial configuration)</font><br />").arg(tmp);
|
||||
}
|
||||
} else
|
||||
if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Blue'>NOT CONNECTED</font><br />").arg(tmp);
|
||||
} else
|
||||
if (status.contains(UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Green'>connecting</font><br />").arg(tmp);
|
||||
} else
|
||||
if (status.contains(UpdateCommand::ISMAS_NOT_CONNECTED, Qt::CaseInsensitive)) {
|
||||
s += QString( "%1 <font color='Red'>NOT CONNECTED</font><br />").arg(tmp);
|
||||
if (custRepoExists) {
|
||||
s += QString( "%1 <font color='Red'>NOT CONNECTED. STOP</font><br />").arg(tmp);
|
||||
} else {
|
||||
s += QString( "%1 <font color='Red'>not connected. (initial configuration)</font><br />").arg(tmp);
|
||||
}
|
||||
} else {
|
||||
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
|
||||
}
|
||||
@@ -291,16 +305,29 @@ void MainWindow::onShowUpdateRequest(QString status) {
|
||||
tmp += " ";
|
||||
}
|
||||
|
||||
bool const custRepoExists = internal::customerRepoExists();
|
||||
|
||||
if (status.contains(UpdateCommand::UPDATE_NOT_REQUESTED, Qt::CaseInsensitive)) {
|
||||
s += QString( "%1 <font color='Red'>NOT REQUESTED</font><br />").arg(tmp);
|
||||
if (custRepoExists) {
|
||||
s += QString( "%1 <font color='Red'>NOT REQUESTED. STOP.</font><br />").arg(tmp);
|
||||
} else {
|
||||
s += QString("%1 <font color='Blue'>not requested (initial configuration)</font><br />").arg(tmp);
|
||||
}
|
||||
} else
|
||||
if (status.contains(UpdateCommand::UPDATE_REQUESTED, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Green'>requested</font><br />").arg(tmp);
|
||||
if (custRepoExists) {
|
||||
s += QString("%1 <font color='Green'>requested</font><br />").arg(tmp);
|
||||
} else {
|
||||
s += QString("%1 <font color='Blue'>requested (initial configuration)</font><br />").arg(tmp);
|
||||
}
|
||||
} else
|
||||
if (status.contains(UpdateCommand::UPDATE_NOT_NECESSARY, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Green'>not necessary</font><br />").arg(tmp);
|
||||
} else
|
||||
if (status.contains(UpdateCommand::NO_CUSTOMER_REPOSITORY, Qt::CaseInsensitive)) {
|
||||
s += QString("%1 <font color='Blue'>UNKNOWN (ISMAS not connected)</font><br />").arg(tmp);
|
||||
} else {
|
||||
s += QString( "%1 <font color='Red'>UNKNOWN STATUS</font><br />").arg(tmp);
|
||||
s += QString( "%1 <font color='Red'>UNKNOWN</font><br />").arg(tmp);
|
||||
}
|
||||
|
||||
ui->stepLabel->setText(s);
|
||||
|
@@ -1,21 +1,44 @@
|
||||
#include "process/check_and_fetch_customer_repository_command.h"
|
||||
#include "worker.h"
|
||||
#include "utils_internal.h"
|
||||
|
||||
CheckAndFetchCustomerRepositoryCommand::CheckAndFetchCustomerRepositoryCommand(
|
||||
QString const &command, Worker *worker, int start_timeout, int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
QString const &command, Worker *worker, int nextCommandIndex,
|
||||
int start_timeout, int finish_timeout)
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void CheckAndFetchCustomerRepositoryCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << command() << exitCode << exitStatus;
|
||||
Worker *w = worker();
|
||||
if (w) {
|
||||
switch (exitCode) {
|
||||
case -2:
|
||||
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_CHECKOUT_ERROR);
|
||||
break;
|
||||
case -4:
|
||||
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_PULL_ERROR);
|
||||
break;
|
||||
case 0:
|
||||
emit w->showCustRepoStatus(internal::GIT_CUSTOMER_REPO_UP_TO_DATE);
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void CheckAndFetchCustomerRepositoryCommand::readyReadStandardOutput() {
|
||||
QProcess *p = (QProcess *)sender();
|
||||
if (p) {
|
||||
QString s = p->readAllStandardOutput();
|
||||
//QProcess *p = (QProcess *)sender();
|
||||
//if (p) {
|
||||
// Worker *w = worker();
|
||||
// if (w) {
|
||||
// QString s = p->readAllStandardOutput().trimmed();
|
||||
//
|
||||
// qCritical() << __func__ << ":" << __LINE__ << s;
|
||||
|
||||
// TODO
|
||||
Worker *w = worker();
|
||||
if (w) {
|
||||
// static constexpr const char *GIT_CUSTOMER_REPO_UP_TO_DATE{"up to date"};
|
||||
emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE);
|
||||
}
|
||||
}
|
||||
// emit w->showCustRepoStatus(UpdateCommand::GIT_CUSTOMER_REPO_UP_TO_DATE);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
@@ -7,10 +7,12 @@ class CheckAndFetchCustomerRepositoryCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit CheckAndFetchCustomerRepositoryCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // CHECK_AND_FETCH_CUSTOMER_REPOSITORY_COMMAND_H_INCLUDED
|
||||
|
@@ -5,23 +5,34 @@
|
||||
|
||||
CheckIsmasConnectivityCommand::CheckIsmasConnectivityCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void CheckIsmasConnectivityCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void CheckIsmasConnectivityCommand::readyReadStandardOutput() {
|
||||
QProcess *p = (QProcess *)sender();
|
||||
if (p) {
|
||||
QString s = p->readAllStandardOutput();
|
||||
|
||||
// TODO
|
||||
Worker *w = worker();
|
||||
if (w) {
|
||||
//static constexpr const char *ISMAS_CONNECTED{"connected"};
|
||||
//static constexpr const char *ISMAS_NOT_CONNECTED{"not connected"};
|
||||
//static constexpr const char *ISMAS_CONNECTION_IN_PROGRESS{"connecting"};
|
||||
emit w->showISMASConnectivity(UpdateCommand::ISMAS_CONNECTED);
|
||||
QString s = p->readAllStandardOutput().trimmed();
|
||||
if (s == UpdateCommand::ISMAS_CONNECTED) {
|
||||
emit w->showISMASConnectivity(UpdateCommand::ISMAS_CONNECTED);
|
||||
} else
|
||||
if (s == UpdateCommand::NO_CUSTOMER_REPOSITORY) {
|
||||
emit w->showISMASConnectivity(UpdateCommand::NO_CUSTOMER_REPOSITORY);
|
||||
} else
|
||||
if (s == UpdateCommand::ISMAS_NOT_CONNECTED) {
|
||||
emit w->showISMASConnectivity(UpdateCommand::ISMAS_NOT_CONNECTED);
|
||||
} else
|
||||
if (s == UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS) {
|
||||
emit w->showISMASConnectivity(UpdateCommand::ISMAS_CONNECTION_IN_PROGRESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,10 +7,12 @@ class CheckIsmasConnectivityCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit CheckIsmasConnectivityCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // CHECK_ISMAS_CONNECTIVITY_COMMAND_H_INCLUDED
|
||||
|
@@ -5,23 +5,35 @@
|
||||
|
||||
CheckUpdateActivationCommand::CheckUpdateActivationCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void CheckUpdateActivationCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << command() << exitCode << exitStatus;
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void CheckUpdateActivationCommand::readyReadStandardOutput() {
|
||||
QProcess *p = (QProcess *)sender();
|
||||
if (p) {
|
||||
QString s = p->readAllStandardOutput();
|
||||
|
||||
// TODO
|
||||
Worker *w = worker();
|
||||
if (w) {
|
||||
//static constexpr const char *UPDATE_NOT_NECESSARY{"not necessary"};
|
||||
//static constexpr const char *UPDATE_NOT_REQUESTED{"not requested"};
|
||||
//static constexpr const char *UPDATE_REQUESTED{"requested"};
|
||||
emit w->showUpdateRequest(UpdateCommand::UPDATE_REQUESTED);
|
||||
QString s = p->readAllStandardOutput().trimmed();
|
||||
if (s == UpdateCommand::UPDATE_REQUESTED) {
|
||||
emit w->showUpdateRequest(UpdateCommand::UPDATE_REQUESTED);
|
||||
} else
|
||||
if (s == UpdateCommand::UPDATE_NOT_NECESSARY) {
|
||||
emit w->showUpdateRequest(UpdateCommand::UPDATE_NOT_NECESSARY);
|
||||
} else
|
||||
if (s == UpdateCommand::UPDATE_NOT_REQUESTED) {
|
||||
emit w->showUpdateRequest(UpdateCommand::UPDATE_NOT_REQUESTED);
|
||||
} else
|
||||
if (s == UpdateCommand::NO_CUSTOMER_REPOSITORY) {
|
||||
emit w->showUpdateRequest(UpdateCommand::NO_CUSTOMER_REPOSITORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,10 +7,12 @@ class CheckUpdateActivationCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit CheckUpdateActivationCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // CHECK_UPDATE_ACTIVATION_COMMAND_H_INCLUDED
|
||||
|
@@ -3,13 +3,18 @@
|
||||
|
||||
ExecOpkgCommand::ExecOpkgCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
bool noaction,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout)
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout)
|
||||
, m_noaction(noaction) {
|
||||
}
|
||||
|
||||
void ExecOpkgCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void ExecOpkgCommand::readyReadStandardOutput() {
|
||||
QProcess *p = (QProcess *)sender();
|
||||
if (p) {
|
||||
|
@@ -9,11 +9,13 @@ class ExecOpkgCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit ExecOpkgCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
bool noaction,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // EXEC_OPKG_COMMAND_H_INCLUDED
|
||||
|
@@ -4,9 +4,14 @@
|
||||
|
||||
ShowSoftwareStatusCommand::ShowSoftwareStatusCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void ShowSoftwareStatusCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void ShowSoftwareStatusCommand::readyReadStandardOutput() {
|
||||
|
@@ -7,9 +7,11 @@ class ShowSoftwareStatusCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit ShowSoftwareStatusCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
#endif // SHOW_SOFTWARE_STATUS_COMMAND_H_INCLUDED
|
||||
|
@@ -6,9 +6,11 @@
|
||||
|
||||
UpdateCommand::UpdateCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: Command(command, start_timeout, finish_timeout) {
|
||||
: Command(command, start_timeout, finish_timeout)
|
||||
, m_nextCommandIndex(nextCommandIndex) {
|
||||
setWorker(worker);
|
||||
}
|
||||
|
||||
@@ -22,10 +24,15 @@ void UpdateCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
<< "exitCode" << exitCode
|
||||
<< "exitStatus" << exitStatus;
|
||||
|
||||
QProcess *p = (QProcess *)sender();
|
||||
QProcess *p = qobject_cast<QProcess *>(sender());
|
||||
if (p) {
|
||||
// read all remaining data sent to the process, just in case
|
||||
m_commandResult += p->readAllStandardOutput();
|
||||
QString s = p->readAllStandardOutput().trimmed();
|
||||
if (!s.isEmpty()) {
|
||||
qCritical() << __func__ << ":" << __LINE__ << s;
|
||||
m_commandResult += s;
|
||||
}
|
||||
qCritical() << __func__ << ":" << __LINE__ << "next command" << m_nextCommandIndex;
|
||||
|
||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardOutput()));
|
||||
disconnect(p, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(readyReadStandardError()));
|
||||
@@ -34,10 +41,12 @@ void UpdateCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
|
||||
if (!m_worker->workList().empty()) {
|
||||
if (exitCode == 0 && exitStatus == QProcess::ExitStatus::NormalExit) {
|
||||
qCritical() << __func__ << ":" << __LINE__;
|
||||
if (m_worker->workList().nextExec()) {
|
||||
m_worker->workList().exec();
|
||||
}
|
||||
} else {
|
||||
qCritical() << __func__ << ":" << __LINE__;
|
||||
bool execShowStatus = true;
|
||||
m_worker->workList().exec(execShowStatus);
|
||||
}
|
||||
|
@@ -5,11 +5,13 @@
|
||||
|
||||
class Worker;
|
||||
class UpdateCommand : public Command {
|
||||
int m_nextCommandIndex{0};
|
||||
public:
|
||||
|
||||
static constexpr const char *UPDATE_NOT_NECESSARY{"not necessary"};
|
||||
static constexpr const char *UPDATE_NOT_REQUESTED{"not requested"};
|
||||
static constexpr const char *UPDATE_REQUESTED{"requested"};
|
||||
static constexpr const char *NO_CUSTOMER_REPOSITORY{"no customer repository"};
|
||||
static constexpr const char *ISMAS_CONNECTED{"connected"};
|
||||
static constexpr const char *ISMAS_NOT_CONNECTED{"not connected"};
|
||||
static constexpr const char *ISMAS_CONNECTION_IN_PROGRESS{"connecting"};
|
||||
@@ -21,12 +23,15 @@ public:
|
||||
|
||||
explicit UpdateCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
|
||||
int nextCommandIndex() { return m_nextCommandIndex; }
|
||||
|
||||
virtual bool stopUpdateOnFailure();
|
||||
|
||||
private slots:
|
||||
public slots:
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
|
@@ -3,9 +3,14 @@
|
||||
|
||||
UpdateDCCommand::UpdateDCCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void UpdateDCCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void UpdateDCCommand::readyReadStandardOutput() {
|
||||
|
@@ -7,10 +7,12 @@ class UpdateDCCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit UpdateDCCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // UPDATE_DC_COMMAND_H_INCLUDED
|
||||
|
@@ -3,9 +3,14 @@
|
||||
|
||||
UpdateFileSystemCommand::UpdateFileSystemCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
void UpdateFileSystemCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void UpdateFileSystemCommand::readyReadStandardOutput() {
|
||||
|
@@ -7,10 +7,12 @@ class UpdateFileSystemCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit UpdateFileSystemCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // UPDATE_FS_COMMAND_H_INCLUDED
|
||||
|
@@ -6,9 +6,15 @@
|
||||
|
||||
UpdateJsonCommand::UpdateJsonCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout,
|
||||
int finish_timeout)
|
||||
: UpdateCommand(command, worker, start_timeout, finish_timeout) {
|
||||
: UpdateCommand(command, worker, nextCommandIndex, start_timeout, finish_timeout) {
|
||||
}
|
||||
|
||||
|
||||
void UpdateJsonCommand::finished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
return UpdateCommand::finished(exitCode, exitStatus);
|
||||
}
|
||||
|
||||
void UpdateJsonCommand::readyReadStandardOutput() {
|
||||
|
@@ -7,10 +7,12 @@ class UpdateJsonCommand : public UpdateCommand {
|
||||
public:
|
||||
explicit UpdateJsonCommand(QString const &command,
|
||||
Worker *worker,
|
||||
int nextCommandIndex,
|
||||
int start_timeout = 100000,
|
||||
int finish_timeout = 100000);
|
||||
protected slots:
|
||||
public slots:
|
||||
virtual void readyReadStandardOutput() override;
|
||||
virtual void finished(int exitCode, QProcess::ExitStatus exitStatus) override;
|
||||
};
|
||||
|
||||
#endif // UPDATE_JSON_HANDLER_H_INCLUDED
|
||||
|
@@ -27,7 +27,8 @@
|
||||
#include "ismas/ismas_client.h"
|
||||
#include "progress_event.h"
|
||||
#include "mainwindow.h"
|
||||
#include "utils.h"
|
||||
#include "utils.h" // deprecated
|
||||
#include "utils_internal.h"
|
||||
#include "process/command.h"
|
||||
#include "process/update_command.h"
|
||||
#include "process/check_ismas_connectivity_command.h"
|
||||
@@ -194,61 +195,75 @@ Worker::Worker(int customerNr,
|
||||
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
|
||||
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
|
||||
|
||||
// check ISMAS connectivity
|
||||
// *** check ISMAS connectivity ***
|
||||
// NOTE: if the customer repository does not exist, then it does not matter
|
||||
// if there is a connection to ISMAS (via APISM).
|
||||
// NOTE: the several processes will be started WorkList::exec().
|
||||
int next = 1;
|
||||
m_workList.push_back(
|
||||
std::make_unique<CheckIsmasConnectivityCommand>(
|
||||
//QString("echo CheckIsmasConnectivityCommand")
|
||||
QString("/opt/app/tools/atbupdate/ATBUpdateCheck --ismas-connected")
|
||||
, this));
|
||||
, this, ++next));
|
||||
|
||||
// check if update activated in ISMAS
|
||||
// *** check if update activated in ISMAS ***
|
||||
// NOTE: if the customer repository does not exist, then it does not matter
|
||||
// if the update has been activated via ISMAS.
|
||||
m_workList.push_back(
|
||||
std::make_unique<CheckUpdateActivationCommand>(
|
||||
QString("echo CheckUpdateActivationCommand")
|
||||
, this));
|
||||
//QString("echo CheckUpdateActivationCommand")
|
||||
QString("/opt/app/tools/atbupdate/ATBUpdateCheck --update-requested")
|
||||
, this, ++next));
|
||||
|
||||
// check and fetch git-customer repository
|
||||
// *** check and fetch git-customer repository ***
|
||||
// (1): if the customer repository does not exist, clone the repository.
|
||||
// (2): if the repository exists, pull the repository. Optionally, checkout
|
||||
// the corresponding branch, and check the integrity of the repository.
|
||||
m_workList.push_back(
|
||||
std::make_unique<CheckAndFetchCustomerRepositoryCommand>(
|
||||
QString("echo CheckAndFetchCustomerRepositoryCommand")
|
||||
, this));
|
||||
// QString("echo CheckAndFetchCustomerRepositoryCommand")
|
||||
QString("/opt/app/tools/atbupdate/ATBUpdateGit")
|
||||
, this, ++next));
|
||||
|
||||
// exec opkg-commands
|
||||
// first with no action -> dry-run
|
||||
// *** exec opkg-commands (noaction) ***
|
||||
// NOTE: first run the opkg commands with no action -> dry-run
|
||||
m_workList.push_back(
|
||||
std::make_unique<ExecOpkgCommand>(
|
||||
QString("echo ExecOpkgCommand")
|
||||
, this, true));
|
||||
QString("echo ExecOpkgCommand dry-run")
|
||||
, this, ++next, true));
|
||||
|
||||
// exec opkg-commands
|
||||
// now with action -> no dry-run
|
||||
// *** exec opkg-commands ***
|
||||
// NOTE: first run the opkg commands with action -> no dry-run
|
||||
m_workList.push_back(
|
||||
std::make_unique<ExecOpkgCommand>(
|
||||
QString("echo ExecOpkgCommand run")
|
||||
, this, ++next, true));
|
||||
|
||||
// send json files down to device controller
|
||||
// *** send json files down to device controller ***
|
||||
m_workList.push_back(
|
||||
std::make_unique<UpdateJsonCommand>(
|
||||
QString("echo UpdateJsonCommand")
|
||||
//QString("/opt/app/tools/atbupdate/ATBDownloadDCJsonFiles --set-ppid %1").arg(QCoreApplication::applicationPid())
|
||||
, this, false));
|
||||
, this, ++next, false));
|
||||
|
||||
// sync json files in repo etc-directory with /etc fs-directory
|
||||
m_workList.push_back(
|
||||
std::make_unique<UpdateFileSystemCommand>(
|
||||
QString("echo UpdateFileSystemCommand")
|
||||
, this));
|
||||
|
||||
, this, ++next));
|
||||
|
||||
// send device-controller firmware down to device-controller-hardware
|
||||
m_workList.push_back(
|
||||
std::make_unique<UpdateDCCommand>(
|
||||
QString("echo UpdateDCCommand")
|
||||
// QString("/opt/app/tools/atbupdate/ATBDownloadDCFirmware --read-dc-version true")
|
||||
, this));
|
||||
, this, ++next));
|
||||
|
||||
// show/send software-status
|
||||
m_workList.push_back(
|
||||
std::make_unique<ShowSoftwareStatusCommand>(
|
||||
QString("echo ShowSoftwareStatusCommand")
|
||||
, this));
|
||||
, this, -1));
|
||||
|
||||
// reboot machine
|
||||
///////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user