summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2016-12-19 16:28:44 +0100
committerGatis Paeglis <gatis.paeglis@qt.io>2016-12-21 11:34:52 +0000
commitffc7a483fba2b2e902550072780c87c6f066e947 (patch)
tree7b75fcb6faacd8fb99fbc6f4017329d7894d3907
parenta679f5f5605c250fd5dcc4c9d14f1c41068b38d1 (diff)
Rename info -> metadata
Using "metadata" in this context fits better. The meaning behind "info" can be confusing and ambiguous. The 1.0 release is around the corner, rename now, before APIs are set in stone. Change-Id: Ia346b4037ae24cca378e522ffd55c68ac535bff7 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
-rw-r--r--doc/ota.qdoc2
-rw-r--r--examples/cpp/basic-daemon/main.cpp6
-rw-r--r--examples/qml/basic/main.qml20
-rw-r--r--src/imports/pluginmain.cpp52
-rw-r--r--src/lib/qotaclient.cpp120
-rw-r--r--src/lib/qotaclient.h38
-rw-r--r--src/lib/qotaclient_p.h12
-rw-r--r--src/lib/qotaclientasync.cpp48
-rw-r--r--src/lib/qotaclientasync_p.h20
9 files changed, 159 insertions, 159 deletions
diff --git a/doc/ota.qdoc b/doc/ota.qdoc
index 0f2fb58..fcf5283 100644
--- a/doc/ota.qdoc
+++ b/doc/ota.qdoc
@@ -321,7 +321,7 @@
\li A JSON file containing arbitrary metadata about the system.
The following top-level fields have convenience methods in
the Qt/QML OTA API: \c version and \c description. Use
- OtaClient::remoteInfo to fetch the entire JSON file for
+ OtaClient::remoteMetadata to access the entire JSON file for
manual parsing.
\endlist
diff --git a/examples/cpp/basic-daemon/main.cpp b/examples/cpp/basic-daemon/main.cpp
index 1f0657d..3a41b62 100644
--- a/examples/cpp/basic-daemon/main.cpp
+++ b/examples/cpp/basic-daemon/main.cpp
@@ -44,7 +44,7 @@ public:
m_device(&QOtaClient::instance()),
m_guiUpdaterPath(guiUpdater)
{
- connect(m_device, &QOtaClient::fetchRemoteInfoFinished, this, &UpdateChecker::fetchFinished);
+ connect(m_device, &QOtaClient::fetchRemoteMetadataFinished, this, &UpdateChecker::fetchFinished);
connect(m_device, &QOtaClient::statusStringChanged, this, &UpdateChecker::log);
connect(m_device, &QOtaClient::errorOccurred, this, &UpdateChecker::logError);
connect(&m_fetchTimer, &QTimer::timeout, this, &UpdateChecker::startFetch);
@@ -65,7 +65,7 @@ public:
void startFetch()
{
log(QStringLiteral("verifying remote server for system updates..."));
- m_device->fetchRemoteInfo();
+ m_device->fetchRemoteMetadata();
}
void fetchFinished(bool success)
@@ -76,7 +76,7 @@ public:
// simply launch a GUI that can be used to execute the update commands (such as examples/qml/basic/).
// A more sophisticated approach would be to use IPC (such as a push notification) to let the
// already running UI know that there is an system update available. Then this UI can open
- // OTA control view or call OtaClient::refreshInfo() if it is already at the OTA control view.
+ // OTA control view or call OtaClient::refreshMetadata() if it is already at the OTA control view.
QString cmd = QString(m_guiUpdaterPath).prepend(QStringLiteral("/usr/bin/appcontroller "));
log(QString(cmd).prepend(QStringLiteral("starting GUI: ")));
bool ok = QProcess::startDetached(cmd);
diff --git a/examples/qml/basic/main.qml b/examples/qml/basic/main.qml
index 2021ecf..62da0f6 100644
--- a/examples/qml/basic/main.qml
+++ b/examples/qml/basic/main.qml
@@ -102,13 +102,13 @@ Window {
label.text += "<b>Revision: </b>" + rev
}
function updateBootedMetadataLabel() {
- updateMetadataLabel(bootedMetadataLabel, OtaClient.bootedInfo, OtaClient.bootedRevision)
+ updateMetadataLabel(bootedMetadataLabel, OtaClient.bootedMetadata, OtaClient.bootedRevision)
}
function updateRemoteMetadataLabel() {
- updateMetadataLabel(remoteMetadataLabel, OtaClient.remoteInfo, OtaClient.remoteRevision)
+ updateMetadataLabel(remoteMetadataLabel, OtaClient.remoteMetadata, OtaClient.remoteRevision)
}
function updateRollbackMetadataLabel() {
- updateMetadataLabel(rollbackMetadataLabel, OtaClient.rollbackInfo, OtaClient.rollbackRevision)
+ updateMetadataLabel(rollbackMetadataLabel, OtaClient.rollbackMetadata, OtaClient.rollbackRevision)
}
Flickable {
@@ -156,12 +156,12 @@ Window {
}
}
Button {
- text: "Fetch OTA info"
+ text: "Fetch OTA Metadata"
onClicked: {
if (!otaEnabled())
return;
- log("Fetcing OTA info...")
- OtaClient.fetchRemoteInfo()
+ log("Fetcing OTA Metadata...")
+ OtaClient.fetchRemoteMetadata()
}
}
Button {
@@ -246,8 +246,8 @@ Window {
target: OtaClient
onErrorChanged: logError(error)
onStatusChanged: log(status)
- onFetchRemoteInfoFinished: {
- logWithCondition("Fetching info from a remote server", success)
+ onFetchRemoteMetadataFinished: {
+ logWithCondition("Fetching metadata from a remote server", success)
if (success)
log("Update available: " + OtaClient.updateAvailable)
}
@@ -255,8 +255,8 @@ Window {
onRollbackFinished: logWithCondition("Rollback", success)
onUpdateFinished: logWithCondition("Update", success)
onRepositoryConfigChanged: updateConfigView(config)
- onRemoteInfoChanged: updateRemoteMetadataLabel()
- onRollbackInfoChanged: updateRollbackMetadataLabel()
+ onRemoteMetadataChanged: updateRemoteMetadataLabel()
+ onRollbackMetadataChanged: updateRollbackMetadataLabel()
}
Component.onCompleted: {
diff --git a/src/imports/pluginmain.cpp b/src/imports/pluginmain.cpp
index 25f3a36..ab0f453 100644
--- a/src/imports/pluginmain.cpp
+++ b/src/imports/pluginmain.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the booted
system's version.
- \sa bootedInfo
+ \sa bootedMetadata
*/
/*!
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the booted
system's description.
- \sa bootedInfo
+ \sa bootedMetadata
*/
/*!
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty string OtaClient::bootedInfo
+ \qmlproperty string OtaClient::bootedMetadata
\readonly
This property holds a JSON-formatted string containing the booted system's
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the system's
version on a server.
- \sa remoteInfo
+ \sa remoteMetadata
*/
/*!
@@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the system's
description on a server.
- \sa remoteInfo
+ \sa remoteMetadata
*/
/*!
@@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty string OtaClient::remoteInfo
+ \qmlproperty string OtaClient::remoteMetadata
\readonly
This property holds a JSON-formatted string containing OTA metadata for the
@@ -121,7 +121,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the rollback
system's version.
- \sa rollbackInfo
+ \sa rollbackMetadata
*/
/*!
@@ -131,7 +131,7 @@ QT_BEGIN_NAMESPACE
This is a convenience property that holds a string containing the rollback
system's description.
- \sa rollbackInfo
+ \sa rollbackMetadata
*/
/*!
@@ -143,7 +143,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty string OtaClient::rollbackInfo
+ \qmlproperty string OtaClient::rollbackMetadata
\readonly
This property holds a JSON-formatted string containing the rollback
@@ -153,31 +153,31 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlsignal OtaClient::rollbackInfoChanged()
+ \qmlsignal OtaClient::rollbackMetadataChanged()
- This signal is emitted when the rollback info changes. Rollback info
+ This signal is emitted when the rollback metadata changes. Rollback metadata
changes when calling rollback().
*/
/*!
- \qmlmethod bool OtaClient::fetchRemoteInfo()
+ \qmlmethod bool OtaClient::fetchRemoteMetadata()
- \include qotaclient.cpp fetchremoteinfo-description
+ \include qotaclient.cpp fetchremotemetadata-description
- \sa fetchRemoteInfoFinished(), updateAvailable, remoteInfo
+ \sa fetchRemoteMetadataFinished(), updateAvailable, remoteMetadata
*/
/*!
- \qmlsignal OtaClient::fetchRemoteInfoFinished(bool success)
+ \qmlsignal OtaClient::fetchRemoteMetadataFinished(bool success)
- This is a notifier signal for fetchRemoteInfo(). The \a success argument
+ This is a notifier signal for fetchRemoteMetadata(). The \a success argument
indicates whether the operation was successful.
*/
/*!
- \qmlsignal OtaClient::remoteInfoChanged()
+ \qmlsignal OtaClient::remoteMetadataChanged()
- \include qotaclient.cpp remoteinfochanged-description
+ \include qotaclient.cpp remotemetadatachanged-description
*/
/*!
@@ -185,7 +185,7 @@ QT_BEGIN_NAMESPACE
\include qotaclient.cpp update-description
- \sa updateFinished(), fetchRemoteInfo, restartRequired, setRepositoryConfig
+ \sa updateFinished(), fetchRemoteMetadata, restartRequired, setRepositoryConfig
*/
/*!
@@ -230,24 +230,24 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlmethod bool OtaClient::updateRemoteInfoOffline(string packagePath)
+ \qmlmethod bool OtaClient::updateRemoteMetadataOffline(string packagePath)
\include qotaclient.cpp update-remote-offline
- \sa remoteInfoChanged()
+ \sa remoteMetadataChanged()
*/
/*!
- \qmlsignal OtaClient::updateRemoteInfoOfflineFinished(bool success)
+ \qmlsignal OtaClient::updateRemoteMetadataOfflineFinished(bool success)
- This is a notifier signal for updateRemoteInfoOffline(). The \a success argument
+ This is a notifier signal for updateRemoteMetadataOffline(). The \a success argument
indicates whether the operation was successful.
*/
/*!
- \qmlmethod bool OtaClient::refreshInfo()
+ \qmlmethod bool OtaClient::refreshMetadata()
- \include qotaclient.cpp refresh-info
+ \include qotaclient.cpp refresh-metadata
*/
/*!
@@ -290,7 +290,7 @@ QT_BEGIN_NAMESPACE
\readonly
Holds a bool indicating the availability of a system update. This
- information is cached; to update the local cache, call fetchRemoteInfo().
+ information is cached; to update the local cache, call fetchRemoteMetadata().
\sa update()
*/
diff --git a/src/lib/qotaclient.cpp b/src/lib/qotaclient.cpp
index feb5bb0..00c4b2b 100644
--- a/src/lib/qotaclient.cpp
+++ b/src/lib/qotaclient.cpp
@@ -71,12 +71,12 @@ QOtaClientPrivate::~QOtaClientPrivate()
}
}
-static void updateInfoMembers(const QJsonDocument &json, QByteArray *info, QString *version, QString *description)
+static void setMetadataMembers(const QJsonDocument &json, QByteArray *metadata, QString *version, QString *description)
{
if (json.isNull())
return;
- *info = json.toJson();
+ *metadata = json.toJson();
QJsonObject root = json.object();
*version = root.value(QStringLiteral("version")).toString(QStringLiteral("unknown"));
*description = root.value(QStringLiteral("description")).toString(QStringLiteral("unknown"));
@@ -99,11 +99,11 @@ void QOtaClientPrivate::handleStateChanges()
}
}
-void QOtaClientPrivate::setBootedInfo(QString &bootedRev, const QJsonDocument &bootedInfo)
+void QOtaClientPrivate::setBootedMetadata(QString &bootedRev, const QJsonDocument &bootedMetadata)
{
Q_Q(QOtaClient);
m_bootedRev = bootedRev;
- updateInfoMembers(bootedInfo, &m_bootedInfo, &m_bootedVersion, &m_bootedDescription);
+ setMetadataMembers(bootedMetadata, &m_bootedMetadata, &m_bootedVersion, &m_bootedDescription);
}
void QOtaClientPrivate::statusStringChanged(const QString &status)
@@ -129,7 +129,7 @@ bool QOtaClientPrivate::verifyPathExist(const QString &path)
return true;
}
-void QOtaClientPrivate::rollbackInfoChanged(const QString &rollbackRev, const QJsonDocument &rollbackInfo, int treeCount)
+void QOtaClientPrivate::rollbackMetadataChanged(const QString &rollbackRev, const QJsonDocument &rollbackMetadata, int treeCount)
{
Q_Q(QOtaClient);
if (!m_rollbackAvailable && treeCount > 1) {
@@ -137,21 +137,21 @@ void QOtaClientPrivate::rollbackInfoChanged(const QString &rollbackRev, const QJ
emit q->rollbackAvailableChanged();
}
m_rollbackRev = rollbackRev;
- updateInfoMembers(rollbackInfo, &m_rollbackInfo, &m_rollbackVersion, &m_rollbackDescription);
- q->rollbackInfoChanged();
+ setMetadataMembers(rollbackMetadata, &m_rollbackMetadata, &m_rollbackVersion, &m_rollbackDescription);
+ q->rollbackMetadataChanged();
}
-void QOtaClientPrivate::remoteInfoChanged(const QString &remoteRev, const QJsonDocument &remoteInfo)
+void QOtaClientPrivate::remoteMetadataChanged(const QString &remoteRev, const QJsonDocument &remoteMetadata)
{
Q_Q(QOtaClient);
if (m_remoteRev == remoteRev)
return;
m_remoteRev = remoteRev;
- updateInfoMembers(remoteInfo, &m_remoteInfo, &m_remoteVersion, &m_remoteDescription);
+ setMetadataMembers(remoteMetadata, &m_remoteMetadata, &m_remoteVersion, &m_remoteDescription);
handleStateChanges();
- emit q->remoteInfoChanged();
+ emit q->remoteMetadataChanged();
}
void QOtaClientPrivate::defaultRevisionChanged(const QString &defaultRevision)
@@ -186,18 +186,18 @@ void QOtaClientPrivate::defaultRevisionChanged(const QString &defaultRevision)
information is being modified by only a single process at a time.
Methods that modify the system's state and/or metadata are marked as such. In a
- multi-process scenario, refreshInfo() updates the processes' view of the system state
+ multi-process scenario, refreshMetadata() updates the processes' view of the system state
and metadata. A typical example would be a daemon that periodically checks a remote
- server (with fetchRemoteInfo()) for system updates, and then uses IPC (such as a push
+ server (with fetchRemoteMetadata()) for system updates, and then uses IPC (such as a push
notification) to let the system's main GUI know when a new version is available.
//! [client-description]
*/
/*!
- \fn void QOtaClient::fetchRemoteInfoFinished(bool success)
+ \fn void QOtaClient::fetchRemoteMetadataFinished(bool success)
- A notifier signal for fetchRemoteInfo(). The \a success argument indicates
+ A notifier signal for fetchRemoteMetadata(). The \a success argument indicates
whether the operation was successful.
*/
@@ -223,25 +223,25 @@ void QOtaClientPrivate::defaultRevisionChanged(const QString &defaultRevision)
*/
/*!
- \fn void QOtaClient::updateRemoteInfoOfflineFinished(bool success)
+ \fn void QOtaClient::updateRemoteMetadataOfflineFinished(bool success)
- This is a notifier signal for updateRemoteInfoOffline(). The \a success argument
+ This is a notifier signal for updateRemoteMetadataOffline(). The \a success argument
indicates whether the operation was successful.
*/
/*!
- \fn void QOtaClient::remoteInfoChanged()
-//! [remoteinfochanged-description]
- Remote info can change when calling fetchRemoteInfo() or updateRemoteInfoOffline().
+ \fn void QOtaClient::remoteMetadataChanged()
+//! [remotemetadatachanged-description]
+ Remote metadata can change when calling fetchRemoteMetadata() or updateRemoteMetadataOffline().
If OTA metadata on the remote server is different from the local cache, the local
cache is updated and this signal is emitted.
-//! [remoteinfochanged-description]
+//! [remotemetadatachanged-description]
*/
/*!
- \fn void QOtaClient::rollbackInfoChanged()
+ \fn void QOtaClient::rollbackMetadataChanged()
- This signal is emitted when rollback info changes. Rollback info changes
+ This signal is emitted when rollback metadata changes. Rollback metadata changes
when calling rollback().
*/
@@ -297,17 +297,17 @@ QOtaClient::QOtaClient() :
Q_D(QOtaClient);
if (d->m_otaEnabled) {
QOtaClientAsync *async = d->m_otaAsync.data();
- connect(async, &QOtaClientAsync::fetchRemoteInfoFinished, this, &QOtaClient::fetchRemoteInfoFinished);
+ connect(async, &QOtaClientAsync::fetchRemoteMetadataFinished, this, &QOtaClient::fetchRemoteMetadataFinished);
connect(async, &QOtaClientAsync::updateFinished, this, &QOtaClient::updateFinished);
connect(async, &QOtaClientAsync::rollbackFinished, this, &QOtaClient::rollbackFinished);
connect(async, &QOtaClientAsync::updateOfflineFinished, this, &QOtaClient::updateOfflineFinished);
- connect(async, &QOtaClientAsync::updateRemoteInfoOfflineFinished, this, &QOtaClient::updateRemoteInfoOfflineFinished);
+ connect(async, &QOtaClientAsync::updateRemoteMetadataOfflineFinished, this, &QOtaClient::updateRemoteMetadataOfflineFinished);
connect(async, &QOtaClientAsync::errorOccurred, d, &QOtaClientPrivate::errorOccurred);
connect(async, &QOtaClientAsync::statusStringChanged, d, &QOtaClientPrivate::statusStringChanged);
- connect(async, &QOtaClientAsync::rollbackInfoChanged, d, &QOtaClientPrivate::rollbackInfoChanged);
- connect(async, &QOtaClientAsync::remoteInfoChanged, d, &QOtaClientPrivate::remoteInfoChanged);
+ connect(async, &QOtaClientAsync::rollbackMetadataChanged, d, &QOtaClientPrivate::rollbackMetadataChanged);
+ connect(async, &QOtaClientAsync::remoteMetadataChanged, d, &QOtaClientPrivate::remoteMetadataChanged);
connect(async, &QOtaClientAsync::defaultRevisionChanged, d, &QOtaClientPrivate::defaultRevisionChanged);
- d->m_otaAsync->refreshInfo(d);
+ d->m_otaAsync->refreshMetadata(d);
}
}
@@ -326,7 +326,7 @@ QOtaClient& QOtaClient::instance()
}
/*!
-//! [fetchremoteinfo-description]
+//! [fetchremotemetadata-description]
Fetches OTA metadata from a remote server and updates the local metadata
cache. This metadata contains information on what system version is available
on a server. The cache is persistent as it is stored on the disk.
@@ -335,17 +335,17 @@ QOtaClient& QOtaClient::instance()
holds whether the operation was started successfully.
\note This method mutates system's state/metadata.
-//! [fetchremoteinfo-description]
+//! [fetchremotemetadata-description]
- \sa fetchRemoteInfoFinished(), updateAvailable, remoteInfo
+ \sa fetchRemoteMetadataFinished(), updateAvailable, remoteMetadata
*/
-bool QOtaClient::fetchRemoteInfo()
+bool QOtaClient::fetchRemoteMetadata()
{
Q_D(QOtaClient);
if (!d->m_otaEnabled)
return false;
- d->m_otaAsync->fetchRemoteInfo();
+ d->m_otaAsync->fetchRemoteMetadata();
return true;
}
@@ -359,7 +359,7 @@ bool QOtaClient::fetchRemoteInfo()
\note This method mutates system's state/metadata.
//! [update-description]
- \sa updateFinished(), fetchRemoteInfo, restartRequired, setRepositoryConfig
+ \sa updateFinished(), fetchRemoteMetadata, restartRequired, setRepositoryConfig
*/
bool QOtaClient::update()
{
@@ -395,7 +395,7 @@ bool QOtaClient::rollback()
//! [update-offline]
Uses the provided self-contained update package to update the system.
Updates the local metadata cache, if it has not been already updated
- by calling updateRemoteInfoOffline().
+ by calling updateRemoteMetadataOffline().
This method is asynchronous and returns immediately. The return value
holds whether the operation was started successfully. The \a packagePath
@@ -425,7 +425,7 @@ bool QOtaClient::updateOffline(const QString &packagePath)
Uses the provided self-contained update package to update local metadata cache.
This metadata contains information on what system version is available on a server.
The cache is persistent as it is stored on the disk. This method is an offline
- counterpart for fetchRemoteInfo().
+ counterpart for fetchRemoteMetadata().
This method is asynchronous and returns immediately. The return value
holds whether the operation was started successfully. The \a packagePath
@@ -434,9 +434,9 @@ bool QOtaClient::updateOffline(const QString &packagePath)
\note This method mutates system's state/metadata.
//! [update-remote-offline]
- \sa remoteInfoChanged
+ \sa remoteMetadataChanged
*/
-bool QOtaClient::updateRemoteInfoOffline(const QString &packagePath)
+bool QOtaClient::updateRemoteMetadataOffline(const QString &packagePath)
{
Q_D(QOtaClient);
if (!d->m_otaEnabled)
@@ -449,26 +449,26 @@ bool QOtaClient::updateRemoteInfoOffline(const QString &packagePath)
return false;
}
- d->m_otaAsync->updateRemoteInfoOffline(package.absoluteFilePath());
+ d->m_otaAsync->updateRemoteMetadataOffline(package.absoluteFilePath());
return true;
}
/*!
-//! [refresh-info]
+//! [refresh-metadata]
Refreshes the instances view of the system's state from the local metadata cache.
- Returns \c true if info is refreshed successfully; otherwise returns \c false.
+ Returns \c true if metadata is refreshed successfully; otherwise returns \c false.
Using this method is not required when only one process is responsible for all OTA tasks.
-//! [refresh-info]
+//! [refresh-metadata]
*/
-bool QOtaClient::refreshInfo()
+bool QOtaClient::refreshMetadata()
{
Q_D(QOtaClient);
if (!d->m_otaEnabled)
return false;
- return d->m_otaAsync->refreshInfo();
+ return d->m_otaAsync->refreshMetadata();
}
/*!
@@ -650,7 +650,7 @@ QString QOtaClient::statusString() const
\brief whether a system update is available.
This information is cached; to update the local cache, call
- fetchRemoteInfo().
+ fetchRemoteMetadata().
*/
bool QOtaClient::updateAvailable() const
{
@@ -692,7 +692,7 @@ bool QOtaClient::restartRequired() const
This is a convenience method.
- \sa bootedInfo
+ \sa bootedMetadata
*/
QString QOtaClient::bootedVersion() const
{
@@ -705,7 +705,7 @@ QString QOtaClient::bootedVersion() const
This is a convenience method.
- \sa bootedInfo
+ \sa bootedMetadata
*/
QString QOtaClient::bootedDescription() const
{
@@ -724,15 +724,15 @@ QString QOtaClient::bootedRevision() const
}
/*!
- \property QOtaClient::bootedInfo
+ \property QOtaClient::bootedMetadata
\brief a QByteArray containing the booted system's OTA metadata.
Returns a JSON-formatted QByteArray containing OTA metadata for the booted
system. Metadata is bundled with each system's version.
*/
-QByteArray QOtaClient::bootedInfo() const
+QByteArray QOtaClient::bootedMetadata() const
{
- return d_func()->m_bootedInfo;
+ return d_func()->m_bootedMetadata;
}
/*!
@@ -741,7 +741,7 @@ QByteArray QOtaClient::bootedInfo() const
This is a convenience method.
- \sa remoteInfo
+ \sa remoteMetadata
*/
QString QOtaClient::remoteVersion() const
{
@@ -754,7 +754,7 @@ QString QOtaClient::remoteVersion() const
This is a convenience method.
- \sa remoteInfo
+ \sa remoteMetadata
*/
QString QOtaClient::remoteDescription() const
{
@@ -773,17 +773,17 @@ QString QOtaClient::remoteRevision() const
}
/*!
- \property QOtaClient::remoteInfo
+ \property QOtaClient::remoteMetadata
\brief a QByteArray containing the system's OTA metadata on a server.
Returns a JSON-formatted QByteArray containing OTA metadata for the system
on a server. Metadata is bundled with each system's version.
- \sa fetchRemoteInfo()
+ \sa fetchRemoteMetadata()
*/
-QByteArray QOtaClient::remoteInfo() const
+QByteArray QOtaClient::remoteMetadata() const
{
- return d_func()->m_remoteInfo;
+ return d_func()->m_remoteMetadata;
}
/*!
@@ -792,7 +792,7 @@ QByteArray QOtaClient::remoteInfo() const
This is a convenience method.
- \sa rollbackInfo
+ \sa rollbackMetadata
*/
QString QOtaClient::rollbackVersion() const
{
@@ -805,7 +805,7 @@ QString QOtaClient::rollbackVersion() const
This is a convenience method.
- \sa rollbackInfo
+ \sa rollbackMetadata
*/
QString QOtaClient::rollbackDescription() const
{
@@ -824,7 +824,7 @@ QString QOtaClient::rollbackRevision() const
}
/*!
- \property QOtaClient::rollbackInfo
+ \property QOtaClient::rollbackMetadata
\brief a QByteArray containing the rollback system's OTA metadata.
Returns a JSON-formatted QByteArray containing OTA metadata for the rollback
@@ -832,9 +832,9 @@ QString QOtaClient::rollbackRevision() const
\sa rollback()
*/
-QByteArray QOtaClient::rollbackInfo() const
+QByteArray QOtaClient::rollbackMetadata() const
{
- return d_func()->m_rollbackInfo;
+ return d_func()->m_rollbackMetadata;
}
QT_END_NAMESPACE
diff --git a/src/lib/qotaclient.h b/src/lib/qotaclient.h
index 901c1ae..96632a7 100644
--- a/src/lib/qotaclient.h
+++ b/src/lib/qotaclient.h
@@ -50,15 +50,15 @@ class Q_DECL_EXPORT QOtaClient : public QObject
Q_PROPERTY(QString bootedVersion READ bootedVersion)
Q_PROPERTY(QString bootedDescription READ bootedDescription)
Q_PROPERTY(QString bootedRevision READ bootedRevision)
- Q_PROPERTY(QByteArray bootedInfo READ bootedInfo)
- Q_PROPERTY(QString remoteVersion READ remoteVersion NOTIFY remoteInfoChanged)
- Q_PROPERTY(QString remoteDescription READ remoteDescription NOTIFY remoteInfoChanged)
- Q_PROPERTY(QString remoteRevision READ remoteRevision NOTIFY remoteInfoChanged)
- Q_PROPERTY(QByteArray remoteInfo READ remoteInfo NOTIFY remoteInfoChanged)
- Q_PROPERTY(QString rollbackVersion READ rollbackVersion NOTIFY rollbackInfoChanged)
- Q_PROPERTY(QString rollbackDescription READ rollbackDescription NOTIFY rollbackInfoChanged)
- Q_PROPERTY(QString rollbackRevision READ rollbackRevision NOTIFY rollbackInfoChanged)
- Q_PROPERTY(QByteArray rollbackInfo READ rollbackInfo NOTIFY rollbackInfoChanged)
+ Q_PROPERTY(QByteArray bootedMetadata READ bootedMetadata)
+ Q_PROPERTY(QString remoteVersion READ remoteVersion NOTIFY remoteMetadataChanged)
+ Q_PROPERTY(QString remoteDescription READ remoteDescription NOTIFY remoteMetadataChanged)
+ Q_PROPERTY(QString remoteRevision READ remoteRevision NOTIFY remoteMetadataChanged)
+ Q_PROPERTY(QByteArray remoteMetadata READ remoteMetadata NOTIFY remoteMetadataChanged)
+ Q_PROPERTY(QString rollbackVersion READ rollbackVersion NOTIFY rollbackMetadataChanged)
+ Q_PROPERTY(QString rollbackDescription READ rollbackDescription NOTIFY rollbackMetadataChanged)
+ Q_PROPERTY(QString rollbackRevision READ rollbackRevision NOTIFY rollbackMetadataChanged)
+ Q_PROPERTY(QByteArray rollbackMetadata READ rollbackMetadata NOTIFY rollbackMetadataChanged)
public:
static QOtaClient& instance();
virtual ~QOtaClient();
@@ -70,12 +70,12 @@ public:
QString errorString() const;
QString statusString() const;
- Q_INVOKABLE bool fetchRemoteInfo();
+ Q_INVOKABLE bool fetchRemoteMetadata();
Q_INVOKABLE bool update();
Q_INVOKABLE bool rollback();
Q_INVOKABLE bool updateOffline(const QString &packagePath);
- Q_INVOKABLE bool updateRemoteInfoOffline(const QString &packagePath);
- Q_INVOKABLE bool refreshInfo();
+ Q_INVOKABLE bool updateRemoteMetadataOffline(const QString &packagePath);
+ Q_INVOKABLE bool refreshMetadata();
Q_INVOKABLE bool setRepositoryConfig(QOtaRepositoryConfig *config);
Q_INVOKABLE bool removeRepositoryConfig();
Q_INVOKABLE bool isRepositoryConfigSet(QOtaRepositoryConfig *config) const;
@@ -84,21 +84,21 @@ public:
QString bootedVersion() const;
QString bootedDescription() const;
QString bootedRevision() const;
- QByteArray bootedInfo() const;
+ QByteArray bootedMetadata() const;
QString remoteVersion() const;
QString remoteDescription() const;
QString remoteRevision() const;
- QByteArray remoteInfo() const;
+ QByteArray remoteMetadata() const;
QString rollbackVersion() const;
QString rollbackDescription() const;
QString rollbackRevision() const;
- QByteArray rollbackInfo() const;
+ QByteArray rollbackMetadata() const;
Q_SIGNALS:
- void remoteInfoChanged();
- void rollbackInfoChanged();
+ void remoteMetadataChanged();
+ void rollbackMetadataChanged();
void updateAvailableChanged(bool available);
void rollbackAvailableChanged();
void restartRequiredChanged(bool required);
@@ -106,11 +106,11 @@ Q_SIGNALS:
void errorOccurred(const QString &error);
void repositoryConfigChanged(QOtaRepositoryConfig *config);
- void fetchRemoteInfoFinished(bool success);
+ void fetchRemoteMetadataFinished(bool success);
void updateFinished(bool success);
void rollbackFinished(bool success);
void updateOfflineFinished(bool success);
- void updateRemoteInfoOfflineFinished(bool success);
+ void updateRemoteMetadataOfflineFinished(bool success);
private:
QOtaClient();
diff --git a/src/lib/qotaclient_p.h b/src/lib/qotaclient_p.h
index f4e5c90..8f0a8dc 100644
--- a/src/lib/qotaclient_p.h
+++ b/src/lib/qotaclient_p.h
@@ -56,9 +56,9 @@ public:
void statusStringChanged(const QString &status);
void errorOccurred(const QString &error);
bool verifyPathExist(const QString &path);
- void setBootedInfo(QString &bootedRev, const QJsonDocument &bootedInfo);
- void rollbackInfoChanged(const QString &rollbackRev, const QJsonDocument &rollbackInfo, int treeCount);
- void remoteInfoChanged(const QString &remoteRev, const QJsonDocument &remoteInfo);
+ void setBootedMetadata(QString &bootedRev, const QJsonDocument &bootedMetadata);
+ void rollbackMetadataChanged(const QString &rollbackRev, const QJsonDocument &rollbackMetadata, int treeCount);
+ void remoteMetadataChanged(const QString &remoteRev, const QJsonDocument &remoteMetadata);
void defaultRevisionChanged(const QString &defaultRevision);
// members
@@ -76,17 +76,17 @@ public:
QString m_bootedVersion;
QString m_bootedDescription;
QString m_bootedRev;
- QByteArray m_bootedInfo;
+ QByteArray m_bootedMetadata;
QString m_remoteVersion;
QString m_remoteDescription;
QString m_remoteRev;
- QByteArray m_remoteInfo;
+ QByteArray m_remoteMetadata;
QString m_rollbackVersion;
QString m_rollbackDescription;
QString m_rollbackRev;
- QByteArray m_rollbackInfo;
+ QByteArray m_rollbackMetadata;
};
QT_END_NAMESPACE
diff --git a/src/lib/qotaclientasync.cpp b/src/lib/qotaclientasync.cpp
index 73f0f04..d1ca6bc 100644
--- a/src/lib/qotaclientasync.cpp
+++ b/src/lib/qotaclientasync.cpp
@@ -51,11 +51,11 @@ GLNX_DEFINE_CLEANUP_FUNCTION0(GObject*, glnx_local_obj_unref, g_object_unref)
QOtaClientAsync::QOtaClientAsync()
{
// async mapper
- connect(this, &QOtaClientAsync::fetchRemoteInfo, this, &QOtaClientAsync::_fetchRemoteInfo);
+ connect(this, &QOtaClientAsync::fetchRemoteMetadata, this, &QOtaClientAsync::_fetchRemoteMetadata);
connect(this, &QOtaClientAsync::update, this, &QOtaClientAsync::_update);
connect(this, &QOtaClientAsync::rollback, this, &QOtaClientAsync::_rollback);
connect(this, &QOtaClientAsync::updateOffline, this, &QOtaClientAsync::_updateOffline);
- connect(this, &QOtaClientAsync::updateRemoteInfoOffline, this, &QOtaClientAsync::_updateRemoteInfoOffline);
+ connect(this, &QOtaClientAsync::updateRemoteMetadataOffline, this, &QOtaClientAsync::_updateRemoteMetadataOffline);
}
QOtaClientAsync::~QOtaClientAsync()
@@ -123,7 +123,7 @@ OstreeSysroot* QOtaClientAsync::defaultSysroot()
return sysroot;
}
-QJsonDocument QOtaClientAsync::infoFromRev(const QString &rev, bool *ok)
+QJsonDocument QOtaClientAsync::metadataFromRev(const QString &rev, bool *ok)
{
QString jsonData;
jsonData = ostree(QString(QStringLiteral("ostree cat %1 /usr/etc/qt-ota.json")).arg(rev), ok);
@@ -131,18 +131,18 @@ QJsonDocument QOtaClientAsync::infoFromRev(const QString &rev, bool *ok)
return QJsonDocument();
QJsonParseError parseError;
- QJsonDocument jsonInfo = QJsonDocument::fromJson(jsonData.toLatin1(), &parseError);
- if (jsonInfo.isNull()) {
+ QJsonDocument jsonMetadata = QJsonDocument::fromJson(jsonData.toLatin1(), &parseError);
+ if (jsonMetadata.isNull()) {
*ok = false;
QString error = QString(QStringLiteral("failed to parse JSON file, error: %1, data: %2"))
.arg(parseError.errorString()).arg(jsonData);
emit errorOccurred(error);
}
- return jsonInfo;
+ return jsonMetadata;
}
-bool QOtaClientAsync::refreshInfo(QOtaClientPrivate *d)
+bool QOtaClientAsync::refreshMetadata(QOtaClientPrivate *d)
{
glnx_unref_object OstreeSysroot *sysroot = defaultSysroot();
if (!sysroot)
@@ -154,35 +154,35 @@ bool QOtaClientAsync::refreshInfo(QOtaClientPrivate *d)
// Booted revision can change only when a device is rebooted.
OstreeDeployment *bootedDeployment = (OstreeDeployment*)ostree_sysroot_get_booted_deployment (sysroot);
QString bootedRev = QLatin1String(ostree_deployment_get_csum (bootedDeployment));
- QJsonDocument bootedInfo = infoFromRev(bootedRev, &ok);
+ QJsonDocument bootedMetadata = metadataFromRev(bootedRev, &ok);
if (!ok)
return false;
- d->setBootedInfo(bootedRev, bootedInfo);
+ d->setBootedMetadata(bootedRev, bootedMetadata);
}
// prepopulate with what we think is on the remote server (head of the local repo)
QString remoteRev = ostree(QStringLiteral("ostree rev-parse linux/qt"), &ok);
- QJsonDocument remoteInfo;
- if (ok) remoteInfo = infoFromRev(remoteRev, &ok);
+ QJsonDocument remoteMetadata;
+ if (ok) remoteMetadata = metadataFromRev(remoteRev, &ok);
if (!ok)
return false;
- emit remoteInfoChanged(remoteRev, remoteInfo);
+ emit remoteMetadataChanged(remoteRev, remoteMetadata);
ok = handleRevisionChanges(sysroot);
return ok;
}
-void QOtaClientAsync::_fetchRemoteInfo()
+void QOtaClientAsync::_fetchRemoteMetadata()
{
QString remoteRev;
- QJsonDocument remoteInfo;
+ QJsonDocument remoteMetadata;
bool ok = true;
ostree(QStringLiteral("ostree pull --commit-metadata-only --disable-static-deltas qt-os linux/qt"), &ok);
if (ok) remoteRev = ostree(QStringLiteral("ostree rev-parse linux/qt"), &ok);
if (ok) ostree(QString(QStringLiteral("ostree pull --subpath=/usr/etc/qt-ota.json qt-os %1")).arg(remoteRev), &ok);
- if (ok) remoteInfo = infoFromRev(remoteRev, &ok);
- if (ok) emit remoteInfoChanged(remoteRev, remoteInfo);
- emit fetchRemoteInfoFinished(ok);
+ if (ok) remoteMetadata = metadataFromRev(remoteRev, &ok);
+ if (ok) emit remoteMetadataChanged(remoteRev, remoteMetadata);
+ emit fetchRemoteMetadataFinished(ok);
}
bool QOtaClientAsync::deployCommit(const QString &commit, OstreeSysroot *sysroot)
@@ -263,10 +263,10 @@ bool QOtaClientAsync::handleRevisionChanges(OstreeSysroot *sysroot, bool reloadS
OstreeDeployment *rollbackDeployment = (OstreeDeployment*)deployments->pdata[index];
QString rollbackRev(QLatin1String(ostree_deployment_get_csum (rollbackDeployment)));
bool ok = true;
- QJsonDocument rollbackInfo = infoFromRev(rollbackRev, &ok);
+ QJsonDocument rollbackMetadata = metadataFromRev(rollbackRev, &ok);
if (!ok)
return false;
- emit rollbackInfoChanged(rollbackRev, rollbackInfo, deployments->len);
+ emit rollbackMetadataChanged(rollbackRev, rollbackMetadata, deployments->len);
}
return true;
@@ -376,19 +376,19 @@ bool QOtaClientAsync::extractPackage(const QString &packagePath, OstreeSysroot *
g_autofree char *toCsum = ostree_checksum_from_bytes_v (toCsumV);
*updateToRev = QString::fromLatin1(toCsum);
- QJsonDocument remoteInfo;
+ QJsonDocument remoteMetadata;
ostree(QString(QStringLiteral("ostree reset qt-os:linux/qt %1")).arg(*updateToRev), &ok);
- if (ok) remoteInfo = infoFromRev(*updateToRev, &ok);
- if (ok) emit remoteInfoChanged(*updateToRev, remoteInfo);
+ if (ok) remoteMetadata = metadataFromRev(*updateToRev, &ok);
+ if (ok) emit remoteMetadataChanged(*updateToRev, remoteMetadata);
return ok;
}
-void QOtaClientAsync::_updateRemoteInfoOffline(const QString &packagePath)
+void QOtaClientAsync::_updateRemoteMetadataOffline(const QString &packagePath)
{
QString rev;
glnx_unref_object OstreeSysroot *sysroot = defaultSysroot();
bool ok = sysroot && extractPackage(packagePath, sysroot, &rev);
- emit updateRemoteInfoOfflineFinished(ok);
+ emit updateRemoteMetadataOfflineFinished(ok);
}
void QOtaClientAsync::_updateOffline(const QString &packagePath)
diff --git a/src/lib/qotaclientasync_p.h b/src/lib/qotaclientasync_p.h
index 6f1dd48..c511507 100644
--- a/src/lib/qotaclientasync_p.h
+++ b/src/lib/qotaclientasync_p.h
@@ -52,39 +52,39 @@ public:
virtual ~QOtaClientAsync();
QString ostree(const QString &command, bool *ok, bool updateStatus = false);
- bool refreshInfo(QOtaClientPrivate *d = nullptr);
+ bool refreshMetadata(QOtaClientPrivate *d = nullptr);
signals:
- void fetchRemoteInfo();
- void fetchRemoteInfoFinished(bool success);
+ void fetchRemoteMetadata();
+ void fetchRemoteMetadataFinished(bool success);
void update(const QString &updateToRev);
void updateFinished(bool success);
void rollback();
void rollbackFinished(bool success);
void updateOffline(const QString &packagePath);
void updateOfflineFinished(bool success);
- void updateRemoteInfoOffline(const QString &packagePath);
- void updateRemoteInfoOfflineFinished(bool success);
- void rollbackInfoChanged(const QString &rollbackRev, const QJsonDocument &rollbackInfo, int treeCount);
+ void updateRemoteMetadataOffline(const QString &packagePath);
+ void updateRemoteMetadataOfflineFinished(bool success);
+ void rollbackMetadataChanged(const QString &rollbackRev, const QJsonDocument &rollbackMetadata, int treeCount);
void errorOccurred(const QString &error);
void statusStringChanged(const QString &status);
- void remoteInfoChanged(const QString &remoteRev, const QJsonDocument &remoteInfo);
+ void remoteMetadataChanged(const QString &remoteRev, const QJsonDocument &remoteMetadata);
void defaultRevisionChanged(const QString &defaultRevision);
protected:
OstreeSysroot* defaultSysroot();
- QJsonDocument infoFromRev(const QString &rev, bool *ok);
+ QJsonDocument metadataFromRev(const QString &rev, bool *ok);
int rollbackIndex(OstreeSysroot *sysroot);
bool handleRevisionChanges(OstreeSysroot *sysroot, bool reloadSysroot = false);
void emitGError(GError *error);
bool deployCommit(const QString &commit, OstreeSysroot *sysroot);
bool extractPackage(const QString &packagePath, OstreeSysroot *sysroot, QString *updateToRev);
- void _fetchRemoteInfo();
+ void _fetchRemoteMetadata();
void _update(const QString &updateToRev);
void _rollback();
void _updateOffline(const QString &packagePath);
- void _updateRemoteInfoOffline(const QString &packagePath);
+ void _updateRemoteMetadataOffline(const QString &packagePath);
};
QT_END_NAMESPACE