diff options
author | Rodrigo Pedra Brum <rodrigo.pedra@gmail.com> | 2022-04-17 03:07:17 -0300 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2022-06-09 10:15:21 +0100 |
commit | 1640e277aae5cf7ee46711e365581565ecd3ed8a (patch) | |
tree | d8aa57b6068a3e46d7fa88aa455f60208756867d | |
parent | 23b0fbd92a68dddb709d4d277ae36198a9ac3ea5 (diff) |
zypp: ignore locked packages
Closes #325
Currently if a package is locked on ZYpp PackageKit ignores the lock and silently updates or installs it.
This PR adds a check if a package is locked a before adding it to the packages to be updated list.
Implementation and comment in code was inspired by the one in aptcc backend
https://github.com/PackageKit/PackageKit/blob/9339249866d44f06d713e92f2abf90b470b5deb3/backends/aptcc/apt-intf.cpp#L1303-L1308
-rw-r--r-- | backends/zypp/pk-backend-zypp.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp index c58fb0a55..4466b86c6 100644 --- a/backends/zypp/pk-backend-zypp.cpp +++ b/backends/zypp/pk-backend-zypp.cpp @@ -1239,13 +1239,19 @@ zypp_get_package_updates (string repo, set<PoolItem> &pks) resolver->doUpdate (); } - for (; it != e; ++it) - if (it->status().isToBeInstalled()) { + for (; it != e; ++it) { + if (it->status().isLocked()) { + // We pretend locked packages are not upgradable at all since + // we can't represent the concept of holds in PackageKit. + // https://github.com/PackageKit/PackageKit/issues/325 + continue; + } else if (it->status().isToBeInstalled()) { ui::Selectable::constPtr s = ui::Selectable::get((*it)->kind(), (*it)->name()); if (s->hasInstalledObj()) pks.insert(*it); } + } if (is_tumbleweed ()) { resolver->setUpgradeMode (FALSE); |