def build_version(ver, skip_release=False):
    print("Building version %s" % ver)
    svn_update_to_ver(ver)
    s3dir = "sumatrapdf/buildbot/%s/" % ver

    stats = Stats()
    # only run /analyze on newer builds since we didn't have the necessary
    # makefile logic before
    run_analyze = int(ver) >= g_first_analyze_build

    if not skip_release:
        start_time = datetime.datetime.now()
        build_release(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for release build" % str(dur))
        if stats.rel_failed:
            run_analyze = False  # don't bother running analyze if release failed
            s3.upload_data_public_with_content_type(stats.rel_build_log,
                                                    s3dir +
                                                    "release_build_log.txt",
                                                    silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_out(ver)

    if run_analyze:
        start_time = datetime.datetime.now()
        build_analyze(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for analyze build" % str(dur))
        html = gen_analyze_html(stats, ver)
        p = os.path.join(get_logs_cache_dir(), "%s_analyze.html" % str(ver))
        open(p, "w").write(html)
        s3.upload_data_public_with_content_type(html,
                                                s3dir + "analyze.html",
                                                silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_txt_diff(ver)

    # TODO: it appears we might throw an exception after uploading analyze.html but
    # before/dufing uploading stats.txt. Would have to implement transactional
    # multi-upload to be robust aginst that, so will just let it be
    stats_txt = stats.to_s()
    s3.upload_data_public_with_content_type(stats_txt,
                                            s3dir + "stats.txt",
                                            silent=True)
    html = build_index_html(stats_for_ver, checkin_comment_for_ver)
    s3.upload_data_public_with_content_type(html,
                                            "sumatrapdf/buildbot/index.html",
                                            silent=True)
    json_s = build_sizes_json(get_stats_cache_dir, stats_for_ver)
    s3.upload_data_public_with_content_type(json_s,
                                            "sumatrapdf/buildbot/sizes.js",
                                            silent=True)
    if stats.rel_failed:
        email_build_failed(ver)
Example #2
0
def build_version(ver, skip_release=False):
	print("Building version %s" % ver)
	svn_update_to_ver(ver)
	s3dir = "sumatrapdf/buildbot/%s/" % ver

	stats = Stats()
	# only run /analyze on newer builds since we didn't have the necessary
	# makefile logic before
	run_analyze = int(ver) >= g_first_analyze_build

	if not skip_release:
		start_time = datetime.datetime.now()
		build_release(stats, ver)
		dur = datetime.datetime.now() - start_time
		print("%s for release build" % str(dur))
		if stats.rel_failed:
			run_analyze = False # don't bother running analyze if release failed
			s3.upload_data_public_with_content_type(stats.rel_build_log, s3dir + "release_build_log.txt", silent=True)

	if not stats.rel_failed:
		build_and_upload_efi_out(ver)

	if run_analyze:
		start_time = datetime.datetime.now()
		build_analyze(stats, ver)
		dur = datetime.datetime.now() - start_time
		print("%s for analyze build" % str(dur))
		html = gen_analyze_html(stats, ver)
		p = os.path.join(get_logs_cache_dir(), "%s_analyze.html" % str(ver))
		open(p, "w").write(html)
		s3.upload_data_public_with_content_type(html, s3dir + "analyze.html", silent=True)

	if not stats.rel_failed:
		build_and_upload_efi_txt_diff(ver)

	# TODO: it appears we might throw an exception after uploading analyze.html but
	# before/dufing uploading stats.txt. Would have to implement transactional
	# multi-upload to be robust aginst that, so will just let it be
	stats_txt = stats.to_s()
	s3.upload_data_public_with_content_type(stats_txt, s3dir + "stats.txt", silent=True)
	html = build_index_html(stats_for_ver, checkin_comment_for_ver)
	s3.upload_data_public_with_content_type(html, "sumatrapdf/buildbot/index.html", silent=True)
	json_s = build_sizes_json(get_stats_cache_dir, stats_for_ver)
	s3.upload_data_public_with_content_type(json_s, "sumatrapdf/buildbot/sizes.js", silent=True)
	if stats.rel_failed:
		email_build_failed(ver)
Example #3
0
def build_and_upload_efi_txt_diff(ver):
	prev_ver = previous_successful_build_ver(ver)
	if 0 == prev_ver:
		return
	efi_path_curr = get_efi_out(ver)
	if not efi_path_curr:
		print("didn't find efi output for %s" % str(ver))
		return
	efi_path_prev = get_efi_out(prev_ver)
	if not efi_path_prev:
		print("didn't find efi output for %s" % str(prev_ver))
		return
	obj_file_splitters = ["obj-rel\\", "INTEL\\"]
	efi1 = efiparse.parse_file(efi_path_prev, obj_file_splitters)
	efi2 = efiparse.parse_file(efi_path_curr, obj_file_splitters)
	diff = efiparse.diff(efi1, efi2)
	s = str(diff)
	s = s + "\n" + efi_diff_as_txt(diff)
	s3dir = "sumatrapdf/buildbot/%s/" % str(ver)
	s3.upload_data_public_with_content_type(s, s3dir + "efi_diff.txt", silent=True)
Example #4
0
def build_and_upload_efi_txt_diff(ver):
	prev_ver = previous_successful_build_ver(ver)
	if 0 == prev_ver:
		return
	efi_path_curr = get_efi_out(ver)
	if not efi_path_curr:
		print("didn't find efi output for %s" % str(ver))
		return
	efi_path_prev = get_efi_out(prev_ver)
	if not efi_path_prev:
		print("didn't find efi output for %s" % str(prev_ver))
		return
	obj_file_splitters = ["obj-rel\\", "INTEL\\"]
	efi1 = efiparse.parse_file(efi_path_prev, obj_file_splitters)
	efi2 = efiparse.parse_file(efi_path_curr, obj_file_splitters)
	diff = efiparse.diff(efi1, efi2)
	s = str(diff)
	s = s + "\n" + efi_diff_as_txt(diff)
	s3dir = "sumatrapdf/buildbot/%s/" % str(ver)
	s3.upload_data_public_with_content_type(s, s3dir + "efi_diff.txt", silent=True)
Example #5
0
def build_version(ver, skip_release=False):
    print("Building version %s" % ver)

    clean_release()
    # a hack: checkin_comment_for_ver() might call svn log, which doesn't like
    # unversioning directories (like obj-rel or vs-premake), so we call it here,
    # after clean, to cache the result
    checkin_comment_for_ver(ver)

    svn_update_to_ver(ver)
    s3dir = "sumatrapdf/buildbot/%s/" % ver

    stats = Stats()
    # only run /analyze on newer builds since we didn't have the necessary
    # makefile logic before
    run_analyze = int(ver) >= g_first_analyze_build

    if not skip_release:
        start_time = datetime.datetime.now()
        build_release(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for release build" % str(dur))
        if stats.rel_failed:
            # don't bother running analyze if release failed
            run_analyze = False
            s3.upload_data_public_with_content_type(
                stats.rel_build_log, s3dir + "release_build_log.txt", silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_out(ver)

    if run_analyze:
        start_time = datetime.datetime.now()
        build_analyze(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for analyze build" % str(dur))
        html = gen_analyze_html(stats, ver)
        p = os.path.join(get_logs_cache_dir(), "%s_analyze.html" % str(ver))
        open(p, "w").write(html)
        s3.upload_data_public_with_content_type(
            html, s3dir + "analyze.html", silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_txt_diff(ver)

    # TODO: it appears we might throw an exception after uploading analyze.html but
    # before/dufing uploading stats.txt. Would have to implement transactional
    # multi-upload to be robust aginst that, so will just let it be
    stats_txt = stats.to_s()
    s3.upload_data_public_with_content_type(
        stats_txt, s3dir + "stats.txt", silent=True)
    html = build_index_html(stats_for_ver, checkin_comment_for_ver)
    s3.upload_data_public_with_content_type(
        html, "sumatrapdf/buildbot/index.html", silent=True)
    json_s = build_sizes_json(get_stats_cache_dir, stats_for_ver)
    s3.upload_data_public_with_content_type(
        json_s, "sumatrapdf/buildbot/sizes.js", silent=True)
    if stats.rel_failed:
        email_build_failed(ver)
        return  # don't run tests if build fails

    err = runtests.run_tests()
    if err != None:
        s3.upload_data_public_with_content_type(
            err, s3dir + "tests_error.txt", silent=True)
        email_tests_failed(ver, err)
        print("Tests failed. Error message:\n" + err)
    else:
        print("Tests passed!")
Example #6
0
def build_version(ver, skip_release=False):
    print("Building version %s" % ver)

    clean_release()
    # a hack: checkin_comment_for_ver() might call svn log, which doesn't like
    # unversioning directories (like obj-rel or vs-premake), so we call it here,
    # after clean, to cache the result
    checkin_comment_for_ver(ver)

    svn_update_to_ver(ver)
    s3dir = "sumatrapdf/buildbot/%s/" % ver

    stats = Stats()
    # only run /analyze on newer builds since we didn't have the necessary
    # makefile logic before
    run_analyze = int(ver) >= g_first_analyze_build

    if not skip_release:
        start_time = datetime.datetime.now()
        build_release(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for release build" % str(dur))
        if stats.rel_failed:
            # don't bother running analyze if release failed
            run_analyze = False
            s3.upload_data_public_with_content_type(
                stats.rel_build_log, s3dir + "release_build_log.txt", silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_out(ver)

    if run_analyze:
        start_time = datetime.datetime.now()
        build_analyze(stats, ver)
        dur = datetime.datetime.now() - start_time
        print("%s for analyze build" % str(dur))
        html = gen_analyze_html(stats, ver)
        p = os.path.join(get_logs_cache_dir(), "%s_analyze.html" % str(ver))
        open(p, "w").write(html)
        s3.upload_data_public_with_content_type(
            html, s3dir + "analyze.html", silent=True)

    if not stats.rel_failed:
        build_and_upload_efi_txt_diff(ver)

    # TODO: it appears we might throw an exception after uploading analyze.html but
    # before/dufing uploading stats.txt. Would have to implement transactional
    # multi-upload to be robust aginst that, so will just let it be
    stats_txt = stats.to_s()
    s3.upload_data_public_with_content_type(
        stats_txt, s3dir + "stats.txt", silent=True)
    html = build_index_html(stats_for_ver, checkin_comment_for_ver)
    s3.upload_data_public_with_content_type(
        html, "sumatrapdf/buildbot/index.html", silent=True)
    json_s = build_sizes_json(get_stats_cache_dir, stats_for_ver)
    s3.upload_data_public_with_content_type(
        json_s, "sumatrapdf/buildbot/sizes.js", silent=True)
    if stats.rel_failed:
        email_build_failed(ver)
        return  # don't run tests if build fails

    err = runtests.run_tests()
    if err != None:
        s3.upload_data_public_with_content_type(
            err, s3dir + "tests_error.txt", silent=True)
        email_tests_failed(ver, err)
        print("Tests failed. Error message:\n" + err)
    else:
        print("Tests passed!")