Skip to content

Instantly share code, notes, and snippets.

@aleasto
Last active March 31, 2022 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleasto/b4300dc624fb67b249c3d4f1b62abb6e to your computer and use it in GitHub Desktop.
Save aleasto/b4300dc624fb67b249c3d4f1b62abb6e to your computer and use it in GitHub Desktop.
======= installed packages =======
"mylib-1.0-1.x86_64"
"mylib-1.0-1.i686"
==================================
--->
PackageKitBackend::fetchUpdates()
<---
PackageKitBackend::addPackageToUpdate packageId="mylib;1.1-1;x86_64;updates"
m_updatesPackageId += packageId;
m_packagesToAdd.insert(new PackageKitResource("mylib")) // we lose information on the arch
<---
PackageKitBackend::addPackageToUpdate packageId="mylib;1.1-1;i686;updates"
m_updatesPackageId += packageId;
m_packagesToAdd.insert(new PackageKitResource("mylib")) // we lose information on the arch
<---
PackageKitBackend::getUpdatesFinished
m_packages.packages["mylib"] = m_packagesToAdd[0];
m_packages.packages["mylib"] = m_packagesToAdd[1];
// we overwrite one of the two Resources here because they have the same package name.
// doesn't really affect the result because neither was tied to a specific architecture
============ state ============
m_updatesPackageId = [
"mylib;1.1-1;x86_64;updates",
"mylib;1.1-1;i686;updates"
]
m_packages.packages = [
("mylib", PackageKitResource*{name="mylib"} )
]
===============================
--->
PackageKitUpdater::prepare
--->
PackagKitBackend::upgradeablePackages
QSet ret;
// loops over m_updatesPackageId
pkgname = PackageKit::Daemon::packageName("mylib;1.1-1;x86_64;updates"); // "mylib"
ret.unite(m_packages.packages[pkgname]);
pkgname = PackageKit::Daemon::packageName("mylib;1.1-1;i686;updates"); // "mylib"
ret.unite(m_packages.packages[pkgname]);
// once again we lose one of the two packages and any information on the architecture
return ret;
--->
PackageKitUpdater::involvedPackages packages=[ PackageKitResource*{name="mylib"} ]
QSet packageIds;
// loops over packages, in this case only once
app = packages[0];
for (const QString &pkgid : m_updatesPackageId) {
if (TransactionpackageName(pkgid) == app.packageName()) {
// Depending on the order of the iterator over the QSet m_updatesPackageId we either match the i686 or the x86_64 package ID
packageIds += pkgid;
break;
}
}
return packageIds; // [ "mylib;1.1-1;i686;updates" ]
--->
PackageKit::Daemon::updatePackages pkgs=[ "mylib;1.1-1;i686;updates" ]
// this silently fails in the dnf backend, nothing gets updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment