Commit c2a9f15b authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

rpm-ostree: Simplify remote refs fetching

parent 20d1cf08
......@@ -209,24 +209,18 @@ void RpmOstreeBackend::readUpdateOutput(QIODevice *device)
void RpmOstreeBackend::executeRemoteRefsProcess()
{
if (!m_remoteRefsList.isEmpty())
m_remoteRefsList.clear();
QProcess *process = new QProcess(this);
connect(process, &QProcess::readyReadStandardError, [process]() {
QByteArray readError = process->readAllStandardError();
});
// catch data output
connect(process, &QProcess::readyReadStandardOutput, this, [process, this]() {
readRefsOutput(process);
});
// delete process instance when done, and get the exit status to handle errors.
QObject::connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
qWarning() << "process exited with code " << exitCode;
settingRemoteRefsDeploymentResource();
qWarning() << "process exited with code " << exitCode << exitStatus;
if (exitCode == 0) {
readRefsOutput(process);
}
process->deleteLater();
});
......@@ -239,17 +233,14 @@ void RpmOstreeBackend::readRefsOutput(QIODevice *device)
{
const QString kinoite = QStringLiteral("/kinoite");
QStringList remoteRefs;
QTextStream stream(device);
for (QString ref = stream.readLine(); stream.readLineInto(&ref);) {
if (ref.endsWith(kinoite))
continue;
m_remoteRefsList.push_back(ref);
remoteRefs.push_back(ref);
}
}
void RpmOstreeBackend::settingRemoteRefsDeploymentResource()
{
m_resources[0]->setRemoteRefsList(m_remoteRefsList);
m_resources[0]->setRemoteRefsList(remoteRefs);
}
int RpmOstreeBackend::updatesCount() const
......
......@@ -66,11 +66,6 @@ public:
*/
void readRefsOutput(QIODevice *device);
/*
* Setting the current remote refs list to the current running deployment resource.
*/
void settingRemoteRefsDeploymentResource();
/*
* Calling Rebase method from the rpm-ostree DBus class when
* there is a new kinoite refs.
......@@ -117,7 +112,6 @@ private:
QVector<RpmOstreeResource *> m_resources;
QVector<DeploymentInformation> m_deployments;
QStringList m_remoteRefsList;
QString m_transactionUpdatePath;
bool m_fetching;
QString m_newVersion;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment