]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
build only kernel_source if --source-only=True
authorHolger Levsen <holger@layer-acht.org>
Thu, 3 Nov 2011 15:52:44 +0000 (16:52 +0100)
committerHolger Levsen <holger@layer-acht.org>
Thu, 3 Nov 2011 15:52:44 +0000 (16:52 +0100)
kernel_inpbuilder.py

index 20a37ea5d955f0938c49b3e63f3dcd7a4afb49a5..b0c676913ed48ac7466ba42cedb3850465d42f76 100644 (file)
@@ -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)