Skip to content

Commit

Permalink
dnf: clear updates-available flag when dnf update yields no updates
Browse files Browse the repository at this point in the history
Fixes QubesOS/qubes-issues#2009

(cherry picked from commit 40652b7)
  • Loading branch information
marmarek committed Sep 7, 2019
1 parent 8dca3c4 commit 54117e6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions misc/dnf-qubes-hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ def __init__(self, base, cli):
self.base = base
self.log = logging.getLogger('dnf')

def resolved(self):
# in case of no action to do, transaction() hook won't be called;
# report updates availability here - especially when everything is up
# to date - to clear updates-available flag
if not self.base.transaction:
query = self.base.sack.query()
query = query.upgrades()
updates = set(query.run())
subprocess.call([
'/usr/lib/qubes/qrexec-client-vm',
'dom0',
'qubes.NotifyUpdates',
'/bin/echo',
str(len(updates))
])

def transaction(self):
if LooseVersion(dnf.const.VERSION) < '2.0.0':
config = self.read_config(self.base.conf, PLUGIN_CONF)
Expand Down

0 comments on commit 54117e6

Please sign in to comment.