return now - last < 86400
def upgradable_packages():
- """Return a list of packages for which updates are available."""
+ """Return a set of packages for which updates are available."""
cache = AC.Cache()
- return [pkg for pkg in cache if pkg.is_upgradable]
+ return set([pkg for pkg in cache if pkg.is_upgradable])
def security_updates_p(pkg):
"""Answer whether any update for PKG is security-relevant."""
plural = len(updates) != 1
print 'I: updates available for %d %s' % \
(len(updates), plural and 'packages' or 'package')
-sec = [pkg for pkg in updates if security_updates_p(pkg)]
+sec = set(pkg for pkg in updates if security_updates_p(pkg))
if sec:
plural = len(sec) != 1
print 'W: security updates available for %d %s' % \
(len(sec), plural and 'packages' or 'package')
+for pkg in sorted(updates, key = lambda p: p.name):
+ print 'I: %s %s' % (pkg in sec and '!' or ' ', pkg.name)
###----- That's all, folks --------------------------------------------------