The unified diff between revisions [d9a62be7..] and [e9c49693..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "client/plugins/softwareupdate.py"
# content [30def4450f3953b0b385d5046dac570773ed94b9]
#
# patch "client/phonehome.py"
# from [840853bf50a490d9c338b9ed3a04dde04aad09c7]
# to [4d77df56103433b3068cf90d6541826a4c6f73d7]
#
============================================================
--- client/plugins/softwareupdate.py 30def4450f3953b0b385d5046dac570773ed94b9
+++ client/plugins/softwareupdate.py 30def4450f3953b0b385d5046dac570773ed94b9
@@ -0,0 +1,39 @@
+
+from phonehome import urgency
+import os, sys, re
+
+def run():
+ results = []
+ software_update_prog = "/usr/sbin/softwareupdate"
+ if not os.access(software_update_prog, os.X_OK):
+ return [(urgency['info'], 'softwareupdate not available (not a Mac, or not >= 10.5)')]
+ update_re = re.compile(r'^\s*\* (.*)$')
+ descr_re = re.compile(r'^\t(.*)$')
+ fd = os.popen("%s --list" % software_update_prog)
+ descr_for = None
+ updates = {}
+ for line in fd:
+ m = update_re.match(line)
+ if m:
+ descr_for = m.groups()[0]
+ updates[descr_for] = None
+ continue
+ m = descr_re.match(line)
+ if m:
+ if descr_for is None:
+ result.append((urgency['alert'], 'something wrong with parser, description with no package.'))
+ else:
+ updates[descr_for] = m.groups()[0]
+ update_names = updates.keys()
+ update_names.sort()
+ for name in update_names:
+ descr = updates[name]
+ if descr is None:
+ results.append((urgency['alert'], '%s (no description found [parser problem?])' % name))
+ else:
+ if descr.find('[recommended]') != -1:
+ urgency_str = 'alert'
+ else:
+ urgency_str = 'warning'
+ results.append((urgency[urgency_str], descr))
+ return results
============================================================
--- client/phonehome.py 840853bf50a490d9c338b9ed3a04dde04aad09c7
+++ client/phonehome.py 4d77df56103433b3068cf90d6541826a4c6f73d7
@@ -51,6 +51,8 @@ if __name__ == '__main__':
exception = '\n'.join(traceback.format_exception(exc_info[0], exc_info[1], exc_info[2]))
sys.stderr.write("Exception in plugin %s\n" % plugin_name + exception)
result = [ (urgency['alert'], exception) ]
+ if result is None:
+ result = [(urgency['alert'], 'plugin programming error: returned None!')]
result = [(plugin_name,) + t for t in result]
results += result