From: Holger Levsen Date: Thu, 3 Nov 2011 15:52:44 +0000 (+0100) Subject: build only kernel_source if --source-only=True X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=5b42f5b0e6f8a20e09549410ba6d72f450a37bdf;p=profitbricks%2Fjenkins-build-scripts.git build only kernel_source if --source-only=True --- diff --git a/kernel_inpbuilder.py b/kernel_inpbuilder.py index 20a37ea..b0c6769 100644 --- a/kernel_inpbuilder.py +++ b/kernel_inpbuilder.py @@ -386,9 +386,6 @@ if __name__ == '__main__': OVERLAY_DIR = options.overlay_dir or '/usr/share/kernel-package' - if options.source_only: - logger.info('Lets build only sources') - # add current dir to python search path cmd_folder = os.path.join(os.path.abspath(OVERLAY_DIR), '..') sys.path.insert(0, cmd_folder) @@ -461,47 +458,55 @@ if __name__ == '__main__': logger.info('Running %s' % cmd) os.system(cmd) - if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'kernel_debug', 'kernel_image' ]): - exit(ERROR) - if has_extra_modules(): - if not install_extra_modules(): - logger.error('Error during installation of extra kernel modules') + if options.source_only: + # only build source + logger.info('Lets build only sources') + if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'kernel_source' ]): exit(ERROR) - if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'modules' ]): - exit(ERROR) else: - try: - ftp = FTP( - 'alexandria.profitbricks.localdomain', - 'debian-uploader', - 'vae6tooZe1ec' - ) - except: - logger.error('Cannot login via ftp...') + # build binaries and modules + if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'kernel_debug', 'kernel_image' ]): + exit(ERROR) + if has_extra_modules(): + if not install_extra_modules(): + logger.error('Error during installation of extra kernel modules') + exit(ERROR) + if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'modules' ]): exit(ERROR) - ftp.cwd('/srv/profitbricks-repository/incoming') + try: + ftp = FTP( + 'alexandria.profitbricks.localdomain', + 'debian-uploader', + 'vae6tooZe1ec' + ) + except: + logger.error('Cannot login via ftp...') + exit(ERROR) - logger.info('FTP Login on %s successful' %(ftp.host)) + ftp.cwd('/srv/profitbricks-repository/incoming') + + logger.info('FTP Login on %s successful' %(ftp.host)) + + if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/'): + ftp.cwd('production-proposed-updates') + elif GIT_BRANCH_NAME.startswith('release/'): + ftp.cwd('staging'); + else: + ftp.cwd('pre-staging'); + + for package in glob( + os.path.join(GIT_TARGET_WORKSPACE, '*.deb') + ): + fh = open(package, 'rb', 1) + ftp.storbinary( + 'STOR %s' %(os.path.basename(package)), + fh + ) + fh.close() + logger.info('Successfully uploaded %s' %(package)) + ftp.quit() + logger.info('Build successful') + logger.info('dirlist: %s' %(os.listdir(GIT_TARGET_WORKSPACE))) - if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/'): - ftp.cwd('production-proposed-updates') - elif GIT_BRANCH_NAME.startswith('release/'): - ftp.cwd('staging'); - else: - ftp.cwd('pre-staging'); - - for package in glob( - os.path.join(GIT_TARGET_WORKSPACE, '*.deb') - ): - fh = open(package, 'rb', 1) - ftp.storbinary( - 'STOR %s' %(os.path.basename(package)), - fh - ) - fh.close() - logger.info('Successfully uploaded %s' %(package)) - ftp.quit() - logger.info('Build successful') - logger.info('dirlist: %s' %(os.listdir(GIT_TARGET_WORKSPACE))) exit(OK)