]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
no global variables
authorHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 11:15:54 +0000 (12:15 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 11:15:54 +0000 (12:15 +0100)
kernel_build.py
kernel_persistence.py

index f94e027326f2c08f0e49a43420d22771e51a3f6e..1aa91fa74f38275dd8e2493855644feddffe39db 100644 (file)
@@ -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(
index e3679d8060edde03b6841d7b6ce8d199f59c772c..4810f6563553ace48c094c32e0e03ff008ec1957 100644 (file)
@@ -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