Compare commits

...

7 Commits

6 changed files with 35 additions and 9 deletions

View File

@ -34,6 +34,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
# too small when updating apism.
# Fix display of UPDATE_SUCCESS when opkg_command fails. Detected when
# updating apsim failed.
# 1.3.11: Integrate version of ATBUpdateTool in SendLastVersion-ISMAS-message.
win32 {
BUILD_DATE=$$system("date /t")
@ -43,7 +44,10 @@ win32 {
BUILD_TIME=$$system("date +%H:%M:%S")
}
VERSION="1.3.10"
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
VERSION="1.3.11"
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
INCLUDEPATH += plugins
@ -53,6 +57,7 @@ CONFIG += c++17
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
QMAKE_CXXFLAGS += -g
QMAKE_CXXFLAGS += -Wno-deprecated-copy

View File

@ -631,6 +631,9 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
"},"
"\"ATBQT\" : {"
"\"VERSION\" : \"%s\""
"},"
"\"ATB-UPDATE-TOOL\" : {"
"\"VERSION\" : \"%s\""
"}"
"},"
"\"PLUGINS\" : {"
@ -758,6 +761,7 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
psa.sw.apismVersion.toStdString().c_str(),
psa.sw.atbQTVersion.toStdString().c_str(),
psa.sw.atbUpdateToolVersion.toStdString().c_str(),
psa.pluginVersion.deviceController.toStdString().c_str(),
psa.pluginVersion.ingenicoISelfCC.toStdString().c_str(),

View File

@ -48,6 +48,7 @@ struct PSAInstalled {
struct SoftWare {
QString apismVersion;
QString atbQTVersion;
QString atbUpdateToolVersion;
} sw;
struct PluginVersion {
@ -98,6 +99,7 @@ struct PSAInstalled {
sw.apismVersion = "N/A";
sw.atbQTVersion = "N/A";
sw.atbUpdateToolVersion = "N/A";
pluginVersion.deviceController = "N/A";
pluginVersion.ingenicoISelfCC = "N/A";

View File

@ -112,14 +112,24 @@ int main(int argc, char *argv[]) {
QCoreApplication::translate("main", "Start ATBUpdateTool in dry-run-mode. No actual actions."));
parser.addOption(dryRunOption);
QCommandLineOption extendedVersionOption(QStringList() << "V" << "extended-version",
QCoreApplication::translate("main", "Show extended version (including last git commit)."));
parser.addOption(extendedVersionOption);
// Process the actual command line arguments given by the user
parser.process(a);
QString plugInDir = parser.value(pluginDirectoryOption);
QString plugInName = parser.value(pluginNameOption);
QString workingDir = parser.value(workingDirectoryOption);
bool dryRun = parser.isSet(dryRunOption);
bool const dryRun = parser.isSet(dryRunOption);
bool const showExtendedVersion = parser.isSet(extendedVersionOption);
QString const rtPath = QCoreApplication::applicationDirPath();
if (showExtendedVersion) {
printf(APP_EXTENDED_VERSION"\n");
return 0;
}
if (!QDir(plugInDir).exists()) {
qCritical() << plugInDir
<< "does not exists, but has to contain dc-library";

View File

@ -58,6 +58,7 @@ Worker::Worker(int customerNr,
, m_gc(m_customerNrStr, m_customerRepository, m_workingDirectory, m_branchName, this)
, m_osVersion(getOsVersion())
, m_atbqtVersion(getATBQTVersion())
, m_atbUpdateToolVersion(getATBUpdateToolVersion())
, m_cpuSerial(getCPUSerial())
, m_pluginVersionATBDeciceController(getPluginVersion("/opt/app/ATBAPP/plugins/libATBDeviceControllerPlugin.so"))
, m_pluginVersionIngenicoISelf(getPluginVersion("/opt/app/ATBAPP/plugins/libIngenicoISelf_CCPlugin.so"))
@ -71,6 +72,7 @@ Worker::Worker(int customerNr,
, m_filesToUpdate()
, m_updateProcessRunning(true)
, m_returnCode(0)
, m_mainWindow(nullptr) /* contains plugin */
, m_progressValue(0)
//, m_withoutIsmasDirectPort(true) /* useful for testing */ {
, m_withoutIsmasDirectPort(false) /* useful for testing */ {
@ -78,12 +80,6 @@ Worker::Worker(int customerNr,
this->setObjectName("worker-object");
QDir::setCurrent(m_workingDirectory);
// restart apism to make sure it is running ?
// Command c("systemctl restart apism");
// if (c.execute("/tmp")) {
// QThread::sleep(10); // give APISM some time to reconnect
// }
if (std::optional<QString> v = getApismVersion()) {
m_apismVersion = v.value();
}
@ -103,6 +99,7 @@ Worker::Worker(int customerNr,
qInfo() << "PLUGIN_NAME ................" << m_pluginName;
qInfo() << "WORKING_DIRECTORY .........." << m_workingDirectory;
qInfo() << "APISM VERSION .............." << m_apismVersion;
qInfo() << "ATB UPDATE TOOL VERSION ...." << m_atbUpdateToolVersion;
this->moveToThread(&m_workerThread);
m_workerThread.start();
@ -993,6 +990,10 @@ QString Worker::getATBQTVersion() const {
return "N/A";
}
QString Worker::getATBUpdateToolVersion() const {
return APP_EXTENDED_VERSION;
}
QString Worker::getCPUSerial() const {
QString const cmd = QString("echo -n $(cat /proc/cpuinfo | grep -i Serial | cut -d':' -f2)");
Command c("bash");
@ -1136,7 +1137,8 @@ PSAInstalled Worker::getPSAInstalled() {
if (std::optional<QString> v = getApismVersion()) {
psaInstalled.sw.apismVersion = v.value();
}
psaInstalled.sw.atbQTVersion = m_atbqtVersion;
psaInstalled.sw.atbQTVersion = getATBQTVersion();
psaInstalled.sw.atbUpdateToolVersion = m_atbUpdateToolVersion;
psaInstalled.pluginVersion.deviceController = m_pluginVersionATBDeciceController;
psaInstalled.pluginVersion.ingenicoISelfCC = m_pluginVersionIngenicoISelf;

View File

@ -92,6 +92,7 @@ class Worker : public QObject {
GitClient m_gc;
QString const m_osVersion;
QString const m_atbqtVersion;
QString const m_atbUpdateToolVersion;
QString const m_cpuSerial;
QString const m_pluginVersionATBDeciceController;
QString const m_pluginVersionIngenicoISelf;
@ -119,6 +120,7 @@ class Worker : public QObject {
bool executeOpkgCommand(QString opkgCommand);
QString getOsVersion() const;
QString getATBQTVersion() const;
QString getATBUpdateToolVersion() const;
QString getCPUSerial() const;
QString getRaucVersion() const;
QString getOpkgVersion() const;
@ -162,6 +164,7 @@ public:
int customerNr() const { return m_customerNr; }
int zoneNr() const { return m_zoneNr; }
QString apismVersion() const { return m_apismVersion; }
QString atbUpdateToolVersion() const { return m_atbUpdateToolVersion; }
MainWindow *mainWindow() { return m_mainWindow; }
MainWindow const *mainWindow() const { return m_mainWindow; }