Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 012bd024 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

pk: change strategy for updating the installed package state

Use the information offered by the transaction instead of clearing the
package and resolving the packages again. PackageKit apt backend is
really slow and issues happen eventually.

BUG: 401961
BUG: 401971
parent 11b74142
......@@ -230,20 +230,21 @@ void PKTransaction::packageResolved(PackageKit::Transaction::Info info, const QS
void PKTransaction::submitResolve()
{
const auto backend = qobject_cast<PackageKitBackend*>(resource()->backend());
QStringList needResolving;
foreach(const auto &pkgids, m_newPackageStates) {
foreach(const auto &pkgid, pkgids) {
needResolving += PackageKit::Daemon::packageName(pkgid);
for(auto it = m_newPackageStates.constBegin(), itEnd = m_newPackageStates.constEnd(); it != itEnd; ++it) {
if (it.key() != PackageKit::Transaction::InfoInstalled && it.key() != PackageKit::Transaction::InfoAvailable)
continue;
foreach(const auto &pkgid, it.value()) {
const auto resources = backend->resourcesByPackageName(PackageKit::Daemon::packageName(pkgid));
for(auto res: resources) {
auto r = qobject_cast<PackageKitResource*>(res);
r->clearPackageIds();
r->addPackageId(it.key(), pkgid, true);
}
}
}
if (!needResolving.isEmpty()) {
needResolving.removeDuplicates();
const auto backend = qobject_cast<PackageKitBackend*>(resource()->backend());
backend->clearPackages(needResolving);
backend->resolvePackages(needResolving);
backend->fetchUpdates();
}
}
PackageKit::Transaction* PKTransaction::transaction()
......
......@@ -247,14 +247,6 @@ AppPackageKitResource* PackageKitBackend::addComponent(const AppStream::Componen
return res;
}
void PackageKitBackend::clearPackages(const QStringList& packageNames)
{
const auto resources = resourcesByPackageNames<QVector<AbstractResource*>>(packageNames);
for(auto res: resources) {
qobject_cast<PackageKitResource*>(res)->clearPackageIds();
}
}
void PackageKitBackend::resolvePackages(const QStringList &packageNames)
{
PackageKit::Transaction * tArch = PackageKit::Daemon::resolve(packageNames, PackageKit::Transaction::FilterArch);
......
......@@ -63,7 +63,6 @@ class DISCOVERCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend
QString upgradeablePackageId(const PackageKitResource* res) const;
QVector<AppPackageKitResource*> extendedBy(const QString& id) const;
void clearPackages(const QStringList &packageNames);
void resolvePackages(const QStringList &packageNames);
void fetchDetails(const QString& pkgid) { fetchDetails(QSet<QString>{pkgid}); }
void fetchDetails(const QSet<QString>& pkgid);
......
Markdown is supported
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