]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
use correct spelling
authorHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 10:54:37 +0000 (11:54 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 10:54:37 +0000 (11:54 +0100)
kernel_build.py
kernel_persistance.py [deleted file]
kernel_persistence.py [new file with mode: 0644]

index 7ae390308a5261dd5d5bfe3223105c81746d81f0..b9b6eec6aacf10d605464ebb63d2e16eb7ee2733 100644 (file)
@@ -11,7 +11,7 @@ import logging
 import smtplib
 from glob import glob
 from logging import Formatter
-import kernel_persistance
+import kernel_persistence
 
 CWD = os.environ.get('WORKSPACE')
 BUILD_NUMBER = os.environ.get('BUILD_NUMBER')
@@ -139,7 +139,7 @@ if __name__ == '__main__':
     atexit.register(remove_git_target_workspace)
     kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj()
     new_version = kernel_revision_obj.last_version + 1
-    if not kernel_persistance.update_kernel_revision_obj(kernel_revision_obj, new_version):
+    if not kernel_persistence.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
deleted file mode 100644 (file)
index e0d9c9a..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os
-from sqlalchemy import create_engine
-from sqlalchemy.orm import sessionmaker
-from sqlalchemy import Table, Column, Integer, String, MetaData, Sequence
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm.exc import NoResultFound
-
-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'
-    id = Column(Integer, Sequence('branch_id'), primary_key=True)
-    identifier = Column(String(255), unique=True, nullable=False)
-    branch_name = Column(String(255), unique=True, nullable=False)
-    last_version = Column(Integer, nullable=False)
-    pb_modules = Column(String(255), unique=True, nullable=False)
-
-    def __init__(self, branch_name, last_version):
-        self.identifier = identifier
-        self.last_version = last_version
-        self.branch_name = branch_name
-        self.pb_modules = pb_modules
-
-    def __repr__(self):
-        return '<KernelVersion(identifier=\'%s\', last_version=\'%s\')>' %(
-                self.identifier, self.last_version
-        )
-
-def get_last_kernel_revision_obj():
-    session = Session()
-    logger.debug('Getting kernel revision from persistence')
-    if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix'):
-      persistance_identifier = 'master'
-    elif GIT_BRANCH_NAME.startswith('release'):
-      persistance_identifier = 'release'
-    else:
-      # FIXME: feature branch handling
-      persistance_identifier = 'develop'
-
-    try:
-        answ = session.query(KernelVersion).filter(
-                KernelVersion.identifier == persistance_identifier).one()
-    except NoResultFound:
-        session.add(KernelVersion(persistance_identifier, 0))
-        session.commit()
-        answ = session.query(KernelVersion).filter(
-                KernelVersion.identifier == persistance_identifier).one()
-    finally:
-        session.close()
-
-    logger.info(
-            'Got this Kernel revision for persistance_identifier %s: %s'
-            %(persistance_identifier, answ)
-    )
-    return answ
-
-def update_kernel_revision_obj(kernel_version_obj, new_revision):
-    session = Session()
-    kernel_version_obj.last_version = new_revision
-    session.add(kernel_version_obj)
-    try:
-        session.commit()
-    except Exception, error:
-        logger.error('Some error happend while commiting new revision')
-        logger.exception(error)
-        return False
-    else:
-        return True
-    finally:
-        session.close()
diff --git a/kernel_persistence.py b/kernel_persistence.py
new file mode 100644 (file)
index 0000000..b5542ae
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+from sqlalchemy import Table, Column, Integer, String, MetaData, Sequence
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.orm.exc import NoResultFound
+
+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'
+    id = Column(Integer, Sequence('branch_id'), primary_key=True)
+    identifier = Column(String(255), unique=True, nullable=False)
+    branch_name = Column(String(255), unique=True, nullable=False)
+    last_version = Column(Integer, nullable=False)
+    pb_modules = Column(String(255), unique=True, nullable=False)
+
+    def __init__(self, branch_name, last_version):
+        self.identifier = identifier
+        self.last_version = last_version
+        self.branch_name = branch_name
+        self.pb_modules = pb_modules
+
+    def __repr__(self):
+        return '<KernelVersion(identifier=\'%s\', last_version=\'%s\')>' %(
+                self.identifier, self.last_version
+        )
+
+def get_last_kernel_revision_obj():
+    session = Session()
+    logger.debug('Getting kernel revision from persistence')
+    if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix'):
+      persistence_identifier = 'master'
+    elif GIT_BRANCH_NAME.startswith('release'):
+      persistence_identifier = 'release'
+    else:
+      # FIXME: feature branch handling
+      persistence_identifier = 'develop'
+
+    try:
+        answ = session.query(KernelVersion).filter(
+                KernelVersion.identifier == persistence_identifier).one()
+    except NoResultFound:
+        session.add(KernelVersion(persistence_identifier, 0))
+        session.commit()
+        answ = session.query(KernelVersion).filter(
+                KernelVersion.identifier == persistence_identifier).one()
+    finally:
+        session.close()
+
+    logger.info(
+            'Got this Kernel revision for persistence_identifier %s: %s'
+            %(persistence_identifier, answ)
+    )
+    return answ
+
+def update_kernel_revision_obj(kernel_version_obj, new_revision):
+    session = Session()
+    kernel_version_obj.last_version = new_revision
+    session.add(kernel_version_obj)
+    try:
+        session.commit()
+    except Exception, error:
+        logger.error('Some error happend while commiting new revision')
+        logger.exception(error)
+        return False
+    else:
+        return True
+    finally:
+        session.close()