From 8cd18ad7b7d2b8392453b62f108035509c80b0e5 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sun, 18 Sep 2011 17:13:45 +0200 Subject: [PATCH] refactoring in progress --- kernel_inpbuilder.py | 52 ++------------------------------------------ 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/kernel_inpbuilder.py b/kernel_inpbuilder.py index 3d8a976..123705c 100644 --- a/kernel_inpbuilder.py +++ b/kernel_inpbuilder.py @@ -217,8 +217,6 @@ def build_kernel(version, revision, parallel_jobs='auto', distcc=False): 'calling "%s" for compiling the kernel' %(' '.join(cmd)) ) - os.putenv('LOCALVERSION', '') - os.environ['LOCALVERSION'] = '' if distcc: os.environ['MAKEFLAGS'] = 'CC=distcc' os.putenv('MAKEFLAGS', 'CC=distcc') @@ -244,11 +242,6 @@ def read_file(path): return result def add_local_version_to_config(kernel_build_revision): - if not os.path.exists(KERNEL_CONFIG_PATH): - raise Exception( - 'No config file found at %s' %(KERNEL_CONFIG_PATH) - ) - kernel_config = read_file(KERNEL_CONFIG_PATH) # don't put the branch names into the packages names if GIT_BRANCH_NAME.startswith('master-'): flavour = GIT_BRANCH_NAME[7:] @@ -263,39 +256,6 @@ def add_local_version_to_config(kernel_build_revision): flavour = 'none' localversion = 'profitbricks-%s' % flavour -# for lino, line in kernel_config.iteritems(): -# try: -# key, value = CREG_KERNEL_CONFIG_DELIM.split(line) -# except ValueError: -# # found a comment line or something else -# # we dont want. -# continue -# if key == 'CONFIG_LOCALVERSION': -# value = localversion -# kernel_config.update(((lino, '%s="%s"\n' %(key, value)),)) -# break -# else: -# # no CONFIG_LOCALVERSION in kernel config -# lino += 1 -# kernel_config.setdefault( -# lino, -# 'CONFIG_LOCALVERSION="%s"\n' %(localversion) -# ) -# logger.info('CONFIG_LOCALVERSION set to %s' % localversion) -# -# try: -# fh = open(KERNEL_CONFIG_PATH, 'w', 1) -# except: -# raise -# else: -# for lino, line in sorted( -# kernel_config.iteritems(), -# key=lambda x: x[0] -# ): -# fh.write(line) -# fh.close() -# return localversion -# return False return localversion def exit(retcode): @@ -416,16 +376,8 @@ if __name__ == '__main__': exit(ERROR) new_version = REVISION - try: - kernel_version = add_local_version_to_config(new_version) - except Exception, error: - logger.exception(error) - exit(ERROR) - else: - logger.info( - 'updated CONFIG_LOCALVERSION in %s to %s' - %(KERNEL_CONFIG_PATH, new_version) - ) + kernel_version = add_local_version_to_config(new_version) + logger.info('REVISION = %s, kernel_version = %s' %(REVISION,kernel_version)) logger.debug('changing dir to %s' %(GIT_TARGET_DIR)) os.chdir(GIT_TARGET_DIR) -- 2.39.5