summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pym/kernelcheck/lib/kernellib.py')
-rw-r--r--pym/kernelcheck/lib/kernellib.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/pym/kernelcheck/lib/kernellib.py b/pym/kernelcheck/lib/kernellib.py
index 972b2d0..da69c0d 100644
--- a/pym/kernelcheck/lib/kernellib.py
+++ b/pym/kernelcheck/lib/kernellib.py
@@ -3,17 +3,10 @@
# Copyright 2009-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-from __future__ import with_statement
-from contextlib import closing
-import cStringIO
-import datetime
-import inspect
-import logging
import mmap
import os
import portage
import re
-import urllib
import xml.etree.cElementTree
@@ -61,8 +54,8 @@ DIR = {
def BUG_ON(msg, e):
if DEBUG:
- print '[DEBUG] line %s in %s(): %s -> %s' % (inspect.stack()[1][2],
- inspect.stack()[1][3], msg, e)
+ print('[DEBUG] line %s in %s(): %s -> %s' % (inspect.stack()[1][2],
+ inspect.stack()[1][3], msg, e))
class Evaluation:
@@ -276,13 +269,13 @@ class Interval:
interval = str(self.name)
interval += ' '
if self.lower and self.lower_i:
- interval += '>=%s ' % (self.lower)
+ interval += '>=%s ' % self.lower
if self.lower and not self.lower_i:
- interval += '>%s ' % (self.lower)
+ interval += '>%s ' % self.lower
if self.upper and self.upper_i:
- interval += '<=%s' % (self.upper)
+ interval += '<=%s' % self.upper
if self.upper and not self.upper_i:
- interval += '<%s' % (self.upper)
+ interval += '<%s' % self.upper
return interval
@@ -308,7 +301,7 @@ def interval_from_xml(root):
return Interval(name, lower, upper, lower_i, upper_i)
-#TODO Use exceptions
+#TODO Add more kernel
def is_in_interval(interval, kernel, bugid=None):
'Returns True if the given version is inside our specified interval'
@@ -386,7 +379,7 @@ def extract_genpatch(ebuild, directory, sources):
try:
genpatch_v = REGEX['gp_version'].findall(content)[0]
genpatch_w = REGEX['gp_want'].findall(content)[0]
- except:
+ except: #FIXME
return None
kernel = Kernel(pkg[1].replace('-sources', ''))
@@ -599,8 +592,7 @@ def extract_version(release):
match = REGEX['k_version'].match(release)
if not match:
- BUG_ON('[Error] Release %s does not contain any valid information' %
- release)
+ BUG_ON('[Error] Release %s contains no valid information' % release)
return None
version, rest = match.groups()
@@ -659,14 +651,14 @@ def gather_configuration():
try:
mmap_min_addr = open('/proc/sys/vm/mmap_min_addr').read().strip()
- except:
+ except: #FIXME
mmap_min_addr = '?'
config['Mmap_min_addr'] = mmap_min_addr
try:
for line in open('/proc/modules').readlines():
modules += '%s ' % line.split(' ')[0]
- except:
+ except: #FIXME
modules = '?'
config['Loaded modules'] = modules