From 977ec603c4016211f02096d4306ae4ca2213273c Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 2 Nov 2011 12:15:54 +0100 Subject: [PATCH] no global variables --- kernel_build.py | 2 +- kernel_persistence.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel_build.py b/kernel_build.py index f94e027..1aa91fa 100644 --- a/kernel_build.py +++ b/kernel_build.py @@ -138,7 +138,7 @@ def exit_error(): if __name__ == '__main__': logger.debug('running with this enviroment: %s', os.environ) atexit.register(remove_git_target_workspace) - kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj() + kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj(GIT_BRANCH_NAME) new_version = kernel_revision_obj.last_version + 1 if not kernel_persistence.update_kernel_revision_obj(kernel_revision_obj, new_version): logger.info( diff --git a/kernel_persistence.py b/kernel_persistence.py index e3679d8..4810f65 100644 --- a/kernel_persistence.py +++ b/kernel_persistence.py @@ -36,7 +36,7 @@ class KernelVersion(Base): last_version = Column(Integer, nullable=False) pb_modules = Column(String(255), unique=True, nullable=False) - def __init__(self, branch_name, last_version): + def __init__(self, identifier, last_version, branch_name, pb_modules): self.identifier = identifier self.last_version = last_version self.branch_name = branch_name @@ -47,12 +47,12 @@ class KernelVersion(Base): self.identifier, self.last_version ) -def get_last_kernel_revision_obj(): +def get_last_kernel_revision_obj(branch): session = Session() logger.debug('Getting kernel revision from persistence') - if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix'): + if branch == 'master' or branch.startswith('hotfix'): persistence_identifier = 'master' - elif GIT_BRANCH_NAME.startswith('release'): + elif branch.startswith('release'): persistence_identifier = 'release' else: # FIXME: feature branch handling -- 2.39.5