From: Holger Levsen Date: Sun, 18 Sep 2011 16:06:30 +0000 (+0200) Subject: put flavour into version number to support upgrades + more refactoring X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=e293f33e88eec6c03411b58f022c55e418989964;p=profitbricks%2Fjenkins-build-scripts.git put flavour into version number to support upgrades + more refactoring --- diff --git a/kernel_build.py b/kernel_build.py index 2a581c7..5b01597 100644 --- a/kernel_build.py +++ b/kernel_build.py @@ -194,6 +194,7 @@ if __name__ == '__main__': atexit.register(remove_git_target_workspace) kernel_revision_obj = get_last_kernel_revision_obj() new_version = kernel_revision_obj.last_version + 1 + # FIXME: hotfix branch needs same persistance as master branch if not update_kernel_revision_obj(kernel_revision_obj, new_version): logger.info( 'Could not update persistence version to %s for %s' diff --git a/kernel_inpbuilder.py b/kernel_inpbuilder.py index 5e34400..8cc5450 100644 --- a/kernel_inpbuilder.py +++ b/kernel_inpbuilder.py @@ -202,12 +202,11 @@ def build_kernel(version, revision, parallel_jobs='auto', distcc=False): else: parallel_jobs = int(parallel_jobs) - create_file('/etc/kernel-pkg.conf', 'maintainer := Profitbricks GmbH\nemail := %s\npriority := Low\ndebian = $(version)-%s' % (GIT_COMMITTER_EMAIL, revision)) cmd = [MAKE_KPKG, '-j', '%s' %(parallel_jobs), '--arch', '%s' %(BUILD_ARCH), '--rootcmd', 'fakeroot', '--append-to-version', '-%s' %(version), - '--initrd', '--arch-in-name', + '--initrd', '--arch_in_name', 'kernel_image' ] #'kernel_debug', @@ -252,8 +251,9 @@ def create_file(path,data): except: raise -def add_local_version_to_config(kernel_build_revision): +def determine_kernel_flavour(): # don't put the branch names into the packages names + # instead just use the flavour part: if GIT_BRANCH_NAME.startswith('master-'): flavour = GIT_BRANCH_NAME[7:] elif GIT_BRANCH_NAME.startswith('develop-'): @@ -266,6 +266,20 @@ def add_local_version_to_config(kernel_build_revision): logger.error('GIT_BRANCH_NAME is %s, flavour is none.' % GIT_BRANCH_NAME) flavour = 'none' + # slightly different version numbers per branch + if flavour in ('master', 'hotfix'): + debian_version = '$(version)-build%s' % REVISION + elif flavour == 'release': + debian_version = '$(version)~rc%s' % REVISION + else: + debian_version = '$(version)~develop%s' % REVISION + + # create appropriate /etc/kernel-pkg.conf + content = 'maintainer := Profitbricks GmbH\nemail := %s\npriority := Low\ndebian = %s\n' % (GIT_COMMITTER_EMAIL, debian_version) + create_file('/etc/kernel-pkg.conf', content) + logger.info('/etc/kernel-pkg.conf created with this content: %s' % content) + + # return safely localversion = 'profitbricks-%s' % flavour return localversion @@ -386,9 +400,8 @@ if __name__ == '__main__': if not git_checkout_branch(): exit(ERROR) - new_version = REVISION - kernel_version = add_local_version_to_config(new_version) - logger.info('REVISION = %s, kernel_version = %s' %(REVISION,kernel_version)) + kernel_flavour = determine_kernel_flavour() + logger.info('REVISION = %s, kernel_flavour = %s' %(REVISION,kernel_flavour)) logger.debug('changing dir to %s' %(GIT_TARGET_DIR)) os.chdir(GIT_TARGET_DIR) @@ -398,7 +411,7 @@ if __name__ == '__main__': logger.error('Error during installation of extra kernel modules') exit(ERROR) - if not build_kernel(kernel_version, new_version): + if not build_kernel(kernel_flavour, REVISION): exit(ERROR) else: ftp = FTP(