From 67e08955cfeb1cc170feedda69ed3979253ecb4c Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 2 Nov 2011 11:48:16 +0100 Subject: [PATCH] fix --- kernel_build.py | 4 ++-- kernel_persistance.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel_build.py b/kernel_build.py index 5a7828f..7ae3903 100644 --- a/kernel_build.py +++ b/kernel_build.py @@ -137,9 +137,9 @@ def exit_error(): if __name__ == '__main__': logger.debug('running with this enviroment: %s', os.environ) atexit.register(remove_git_target_workspace) - kernel_revision_obj = get_last_kernel_revision_obj() + kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj() new_version = kernel_revision_obj.last_version + 1 - if not update_kernel_revision_obj(kernel_revision_obj, new_version): + if not kernel_persistance.update_kernel_revision_obj(kernel_revision_obj, new_version): logger.info( 'Could not update persistence version to %s for %s' %(new_version, GIT_BRANCH_NAME) diff --git a/kernel_persistance.py b/kernel_persistance.py index 58ae796..e0d9c9a 100644 --- a/kernel_persistance.py +++ b/kernel_persistance.py @@ -12,9 +12,9 @@ CWD = os.environ.get('WORKSPACE') PERSISTENCE_FILE = os.path.join(CWD, '..', '.persistence') Base = declarative_base() - engine = create_engine('sqlite:///%s' %(PERSISTENCE_FILE)) Session = sessionmaker(bind=engine) +Base.metadata.create_all(engine) class KernelVersion(Base): __tablename__ = 'branch_kernel_version' @@ -35,8 +35,6 @@ class KernelVersion(Base): self.identifier, self.last_version ) -Base.metadata.create_all(engine) - def get_last_kernel_revision_obj(): session = Session() logger.debug('Getting kernel revision from persistence') @@ -79,5 +77,3 @@ def update_kernel_revision_obj(kernel_version_obj, new_revision): return True finally: session.close() - - -- 2.39.5