checkin for saving current state
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user