summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Tropf <asymmail@googlemail.com>2009-06-08 15:49:08 +0200
committerBjoern Tropf <asymmail@googlemail.com>2009-06-08 15:49:08 +0200
commitb903c5a2dd4f4696f4d77411ec8848615c3da3bc (patch)
tree68c1131345fc28733209f7ff6f788bf5942b68ef
parentSome insignificant changes (diff)
downloadkernel-check-b903c5a2dd4f4696f4d77411ec8848615c3da3bc.tar.gz
kernel-check-b903c5a2dd4f4696f4d77411ec8848615c3da3bc.tar.bz2
kernel-check-b903c5a2dd4f4696f4d77411ec8848615c3da3bc.zip
Edit string concatenation
-rwxr-xr-xcollector.py2
-rwxr-xr-xkernel-check.py32
-rwxr-xr-xkernellib.py4
3 files changed, 19 insertions, 19 deletions
diff --git a/collector.py b/collector.py
index cd214ef..0b455bf 100755
--- a/collector.py
+++ b/collector.py
@@ -77,7 +77,7 @@ def main(argv):
for item in found_patches:
if item not in read_patches:
read_patches.append(item)
- new_items = new_items + 1
+ new_items += 1
print('Added %i new genpatches!\n' % new_items)
lib.write_genpatch_file(folder['out'], read_patches)
diff --git a/kernel-check.py b/kernel-check.py
index dd4a269..91e40e2 100755
--- a/kernel-check.py
+++ b/kernel-check.py
@@ -53,21 +53,21 @@ def main(argv):
kernel = lib.extract_version(os.uname()[2])
if kernel:
- info('Kernel version: ' + color('GOOD', kernel['version'] + '-' + kernel['revision']))
- info('Kernel sources: ' + color('GOOD', kernel['source']))
+ info('Kernel version: %s' % (color('GOOD', '%s-%s' % (kernel['version'], kernel['revision']))))
+ info('Kernel sources: %s' % color('GOOD', kernel['source']))
else:
error('No kernel information found!')
sys.exit()
genpatch = lib.get_genpatch(lib.read_genpatch_file('out'), kernel)
if genpatch:
- info('Integrated genpatch: ' + color('GOOD', genpatch['version'] + ' ' + genpatch['want']))
+ info('Integrated genpatch: %s' % color('GOOD', '%s %s' % (genpatch['version'], genpatch['want'])))
else:
warn('No genpatch information found!')
arch = os.uname()[4]
if arch:
- info('System architecture: ' + color('GOOD', arch))
+ info('System architecture: %s' % color('GOOD', arch))
else:
error('No system architecture found!')
sys.exit()
@@ -79,22 +79,22 @@ def main(argv):
'read' : 345,
'match' : 284,
'fixed' : 274,
- 'canfix' : 0,
- 'notfix' : 2
+ 'canfix' : [1, 2, 3],
+ 'notfix' : [1, 2]
}
if cve:
- info(color('GOOD', str(cve['read'])) + ' files read')
- info(color('GOOD', str(cve['match'])) + ' match this system')
- info(color('GOOD', str(cve['fixed'])) + ' haven been fixed')
+ info('%s files read' % color('GOOD', str(cve['read'])))
+ info('%s match this system' % color('GOOD', str(cve['match'])))
+ info('%s have been fixed' % color('GOOD', str(cve['fixed'])))
- if cve['canfix']: #FIXME: Color
- warn(str(cve['canfix']) + ' can be fixed by upgrading')
+ if len(cve['canfix']):
+ error('%s can be fixed by upgrading' % color('BAD', str(len(cve['canfix']))))
else:
info('No vulnerability can be fixed by upgrading')
- if cve['notfix']: #FIXME: Color
- warn(str(cve['notfix']) + ' have not been fixed yet')
+ if len(cve['notfix']):
+ warn('%s have not been fixed yet' % color('WARN', str(len(cve['notfix']))))
else:
info('No vulnerability have not been fixed yet')
@@ -103,7 +103,7 @@ def main(argv):
sys.exit()
- if cve['canfix']:
+ if len(cve['canfix']):
info('')
info('These could be fixed by upgrading:')
info('')
@@ -111,11 +111,11 @@ def main(argv):
'''200000 - This is a insidious kernel bug... - critical'''
info('')
info('To print information about a vulnerability try:')
- info('$ ' + sys.argv[0] + ' -i [id]')
+ info('$ %s -i [id]' % sys.argv[0])
info('')
info('Upgrading to the latest version')
best = lib.best_version(kernel['source'])
- info('[' + color('GOOD', best) + ']')
+ info('[%s]' % color('GOOD', best))
info('is recommended!')
else:
info('')
diff --git a/kernellib.py b/kernellib.py
index b7a9c00..eb263e3 100755
--- a/kernellib.py
+++ b/kernellib.py
@@ -248,7 +248,7 @@ def parse_genpatch_list(directory):
for ebuild in os.listdir(os.path.join(directory, sources)):
if '.ebuild' in ebuild:
- pkg = portage.versions.catpkgsplit('sys-kernel/' + ebuild[:-7])
+ pkg = portage.versions.catpkgsplit('sys-kernel/%s' % ebuild[:-7])
with open(os.path.join(directory, sources, ebuild), 'r') as ebuild_file:
content = ebuild_file.read()
@@ -358,7 +358,7 @@ def parse_bugzilla_dict(directory, bugid):
dic['cves'] = cves
else:
error('Invalid cve for bugid [%s]' % root.find('bug_id').text)
- error('-> ' + root.find(item).text)
+ error('-> %s' % root.find(item).text)
try:
dic[item] = root.find(item).text
except AttributeError: