chiark
/
gitweb
/
~mdw
/
rcheck
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ff90728
)
check.d/50.updates: Maintain sets of packages, rather than lists.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 10 May 2015 10:13:30 +0000
(11:13 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sun, 10 May 2015 10:13:30 +0000
(11:13 +0100)
check.d/50.updates
patch
|
blob
|
blame
|
history
diff --git
a/check.d/50.updates
b/check.d/50.updates
index 9eb27a4c26c24834ff4dfe32694fcd0742e31b45..0444fa188b26b6442d6d68c94f415a7c4e4c8667 100755
(executable)
--- a/
check.d/50.updates
+++ b/
check.d/50.updates
@@
-26,9
+26,9
@@
def cache_up_to_date_p():
return now - last < 86400
def upgradable_packages():
return now - last < 86400
def upgradable_packages():
- """Return a
lis
t of packages for which updates are available."""
+ """Return a
se
t of packages for which updates are available."""
cache = AC.Cache()
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."""
def security_updates_p(pkg):
"""Answer whether any update for PKG is security-relevant."""
@@
-59,7
+59,7
@@
if updates:
plural = len(updates) != 1
print 'I: updates available for %d %s' % \
(len(updates), plural and 'packages' or 'package')
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' % \
if sec:
plural = len(sec) != 1
print 'W: security updates available for %d %s' % \