]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
debian_build.py: Add debugging instructions (for sbuild).
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 22 Sep 2014 09:19:20 +0000 (11:19 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 22 Sep 2014 09:19:20 +0000 (11:19 +0200)
debian_build.py
lib/sbuild.py

index c55565355c81748e836682f8a367f1e69a30026f..69b42517b3973dc38449c3776b258599b1ae0374 100755 (executable)
@@ -9,6 +9,7 @@ import git
 import optparse
 import os
 import re
+import socket
 import subprocess
 import sys
 from pprint import pformat
@@ -684,6 +685,29 @@ def main():
     if ret:
         build_failed = True
         logger.error('sbuild failed with exitcode {code}'.format(code=ret))
+        # .. show instructions of how to get access to the build chroot
+        logger.info('''
+###
+###  In case you need to analyze the results within chroot, do the following:
+###    * login to {hostname}
+###    * become user {jenkins_user} (or a user which belongs to the sbuild group)
+###    * then execute:
+###
+
+cd {jenkins_workspace}
+{command}
+
+###  Note: sbuild builds the Debian binary packages from the corresponding Debian source,
+###  installing any missing source dependencies. The build takes place in a dedicated
+###  clean build environment (chroot), rather than on the host system. If the build
+###  fails, the chroot will be left for interrogation instead of removing it. You can
+###  access the chroot with the schroot command. Please make sure to remove the chroot
+###  after you are done.
+'''.format(hostname=socket.gethostname(),
+           jenkins_user=ENV['USER'],
+           jenkins_workspace=builder.dsc_dir,
+           command=' '.join(escape_arg(arg) for arg in builder.debug_command),
+           ))
         figlet('Build failed')
         failed_message = 'package build has failed'
         do_cidb = False
index b63729f0e7edf355714abc0c143638a20a98c274..af2e3ed9d45267d720a94360ce54d4f503b22302 100644 (file)
@@ -32,6 +32,10 @@ class Sbuild(object):
 
     @property
     def command(self):
+        return self.command([])
+
+    @property
+    def get_command(self, additional_args):
         '''
         TODO
         '''
@@ -41,10 +45,14 @@ class Sbuild(object):
             '--arch=' + self.arch,
             '-d', self.dist,
             '-c', self.chroot
-        ] + ['--extra-repository=' + repo for repo in self.additional_repos] + \
+        ] + ['--extra-repository=' + repo for repo in self.additional_repos] + additional_args + \
             [self.dsc_file]
         return result
 
+    @property
+    def debug_command(self):
+        return self.get_command(["--purge=successful"])
+
     @property
     def changes_file(self):
         changes_filename = os.path.splitext(self.dsc_file)[0] + '_' + self.arch + '.changes'