Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
c2a9f15b
Commit
c2a9f15b
authored
Apr 15, 2021
by
Aleix Pol Gonzalez
🐧
Committed by
Aleix Pol Gonzalez
Apr 15, 2021
Browse files
rpm-ostree: Simplify remote refs fetching
parent
20d1cf08
Changes
2
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.cpp
View file @
c2a9f15b
...
...
@@ -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_
remoteRefs
List
.
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
...
...
libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.h
View file @
c2a9f15b
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment