Fix build reporting to be more awesome.

refactor-builder
Eric Holscher 2014-03-14 16:53:19 +08:00
parent 7345701fe9
commit a4477997ed
4 changed files with 37 additions and 16 deletions

View File

@ -25,8 +25,7 @@ class VersionSlugFilter(django_filters.FilterSet):
class VersionFilter(django_filters.FilterSet):
project = django_filters.CharFilter(name='project__name',
lookup_type="icontains")
project = django_filters.CharFilter(name='project__slug')
slug = django_filters.CharFilter(label=_("Name"), name='slug',
lookup_type='icontains')

View File

@ -170,7 +170,7 @@ class EpubBuilder(BaseSphinx):
to_file = os.path.join(self.target, "%s.epub" % self.version.project.slug)
run('mv -f %s %s' % (from_file, to_file))
class PdfBuilder(BaseBuilder):
class PdfBuilder(BaseSphinx):
type = 'sphinx_pdf'
sphinx_build_dir = '_build/latex'

View File

@ -543,16 +543,38 @@ def create_build(version, api, record):
def record_build(api, record, build, results, state):
if not record:
return None
setup_steps = ['checkout', 'venv', 'sphinx', 'requirements', 'install']
output_steps = ['html', 'pdf', 'epub']
all_steps = setup_steps + output_steps
build['state'] = state
if results.get('checkout', False):
build['success'] = results['checkout'][0] == 0
build['setup'] = results['checkout'][1]
build['setup_error'] = results['checkout'][2]
if results.get('html', False):
build['success'] = results['html'][0] == 0
build['output'] = results['html'][1]
build['error'] = results['html'][2]
build['exit_code'] = results['html'][0]
build['success'] = True
# Set global state
for step in all_steps:
if results.get(step, False):
if results.get(step)[0] != 0:
results['success'] = False
build['exit_code'] = max([results.get(step, [0])[0] for step in all_steps])
build['setup'] = build['setup_error'] = ""
build['output'] = build['error'] = ""
for step in setup_steps:
if results.get(step, False):
build['setup'] += "\n\n%s\n-----\n\n" % step
build['setup'] += results.get(step)[1]
build['setup_error'] += "\n\n%s\n-----\n\n" % step
build['setup_error'] += results.get(step)[2]
for step in output_steps:
if results.get(step, False):
build['output'] += "\n\n%s\n-----\n\n" % step
build['output'] += results.get(step)[1]
build['error'] += "\n\n%s\n-----\n\n" % step
build['error'] += results.get(step)[2]
ret = api.build(build['id']).put(build)
return ret

View File

@ -27,12 +27,12 @@ def version_from_slug(slug, version):
return v
def symlink(project, version='latest'):
from projects import tasks
from projects import symlinks
v = version_from_slug(project, version)
log.info("Symlinking %s" % v)
tasks.symlink_subprojects(v)
tasks.symlink_cnames(v)
tasks.symlink_translations(v)
symlinks.symlink_subprojects(v)
symlinks.symlink_cnames(v)
symlinks.symlink_translations(v)
def update_static_metadata(project_pk):
from projects import tasks