diff options
author | 2009-06-05 20:29:18 +0200 | |
---|---|---|
committer | 2009-06-05 20:29:18 +0200 | |
commit | 7995ec88f74f10f6b64578a33d43eddbdd459669 (patch) | |
tree | f6d07b646ddc850d00049f980fb6123587f9201f | |
parent | Some fixes to previous commit (diff) | |
download | kernel-check-7995ec88f74f10f6b64578a33d43eddbdd459669.tar.gz kernel-check-7995ec88f74f10f6b64578a33d43eddbdd459669.tar.bz2 kernel-check-7995ec88f74f10f6b64578a33d43eddbdd459669.zip |
Implement get_genpatch()
-rw-r--r-- | TODO | 1 | ||||
-rwxr-xr-x | collector.py | 11 | ||||
-rwxr-xr-x | kernel-check.py | 9 | ||||
-rwxr-xr-x | kernellib.py | 10 |
4 files changed, 24 insertions, 7 deletions
@@ -2,6 +2,7 @@ Todo ==== - Fix all TODO markers - Move is_in_interval to kernellib.py +- Use dict instead of list for genpatches Clean code ========== diff --git a/collector.py b/collector.py index d111a33..d5e9add 100755 --- a/collector.py +++ b/collector.py @@ -64,12 +64,17 @@ def main(argv): if not os.path.isdir(folder[directory]): os.makedirs(folder[directory]) - print('Reading available genpatches...') - read_patches = lib.read_genpatch_file(folder['out']) + + try: + print('Reading available genpatches...') + read_patches = lib.read_genpatch_file(folder['out']) + except: + read_patches = list() + pass print('Parsing genpatches from portage...') found_patches = lib.parse_genpatch_list(folder['tree']) - + new_items = 0 for item in found_patches: if item not in read_patches: diff --git a/kernel-check.py b/kernel-check.py index 12c95c6..e5de4d3 100755 --- a/kernel-check.py +++ b/kernel-check.py @@ -26,10 +26,11 @@ def main(argv): 'Main function' KERNEL = lib.extract_version(os.uname()[2]) - GENPATCH = None + ARCH = os.uname()[4] - CVE = [345, 284, 274, 0, 4] #TODO: Implement BEST = lib.best_version(KERNEL['source'] + '-sources') + CVE = [345, 284, 274, 0, 4] #TODO: Implement + GENPATCH = lib.get_genpatch(lib.read_genpatch_file('out'), KERNEL) info = portage.output.EOutput().einfo warn = portage.output.EOutput().ewarn @@ -65,12 +66,12 @@ def main(argv): sys.exit() if GENPATCH: - info('Integrated genpatch: ' + GENPATCH['version'] + ' ' + GENPATCH['want']) + info('Integrated genpatch: ' + color('GOOD', GENPATCH[2] + ' ' + GENPATCH[3])) else: warn('No genpatch information found!') if ARCH: - info('System architecture: ' + ARCH) + info('System architecture: ' + color('GOOD', ARCH)) else: error('No system architecture found!') sys.exit() diff --git a/kernellib.py b/kernellib.py index 00044d2..af15004 100755 --- a/kernellib.py +++ b/kernellib.py @@ -216,6 +216,16 @@ def write_genpatch_file(directory, genpatches): return +def get_genpatch(patches, kernel): + #TODO: Description + + for item in patches: + if kernel['source'] + '-sources' == item[0]: + if kernel['version'] + '_' + kernel['revision'] == item[1]: + return item + + return None + def parse_bugzilla_list(filename): 'Returns a list containing all bugzilla kernel bugs' |