예제 #1
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
			s3UploadDataPublicWithContentType(stats.rel_build_log, s3dir + "release_build_log.txt")

	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)
		s3UploadDataPublicWithContentType(html, s3dir + "analyze.html")

	stats_txt = stats.to_s()
	s3UploadDataPublicWithContentType(stats_txt, s3dir + "stats.txt")
	build_sizes_json()
	build_index_html()
예제 #2
0
def build_sizes_json():
	files = os.listdir(get_stats_cache_dir())
	versions = [int(f.split(".")[0]) for f in files]
	versions.sort()
	print(versions)
	sumatra_sizes = []
	installer_sizes = []
	prev_sumatra_size = 0
	prev_installer_size = 0
	for ver in versions:
		stats = stats_for_ver(str(ver))
		sumatra_size = stats.rel_sumatrapdf_exe_size
		installer_size = stats.rel_installer_exe_size
		if sumatra_size == prev_sumatra_size and installer_size == prev_installer_size:
			continue
		sumatra_sizes.append(sumatra_size)
		installer_sizes.append(installer_size)
		prev_sumatra_size = sumatra_size
		prev_installer_size = installer_size
	sumatra_json = json.dumps(sumatra_sizes)
	installer_json = json.dumps(installer_sizes)
	s = "var g_sumatra_sizes = %s;\nvar g_installer_sizes = %s;\n" % (sumatra_json, installer_json)
	s3UploadDataPublicWithContentType(s, "sumatrapdf/buildbot/sizes.js")
예제 #3
0
def build_index_html():
	s3_dir = "sumatrapdf/buildbot/"
	html = "<html><head>%s</head><body>\n" % g_index_html_css
	html += "<p>SumatraPDF buildbot results:</p>\n"
	names = [n.name for n in s3List(s3_dir)]
	# filter out top-level files like index.html and sizes.js
	names = [n[len(s3_dir):] for n in names if len(n.split("/")) == 4]
	names.sort(reverse=True, key=lambda name: int(name.split("/")[0]))

	html += '<table id="table-5"><tr><th>build</th><th>/analyze</th><th>release</th>'
	html += '<th style="font-size:80%">SumatraPDF.exe size</th><th style="font-size:80%"">Installer.exe size</th></tr>\n'
	files_by_ver = group_by_ver(names)
	for arr in files_by_ver:
		(ver, files) = arr
		if "stats.txt" not in files:
			print("stats.txt missing in %s (%s)" % (ver, str(files)))
			assert("stats.txt" in files)
		try:
			stats = stats_for_ver(ver)
		except:
			print("names: %s" % str(names))
			print("ver:   %s" % str(ver))
			print("files: %s" % str(files))
			raise
		total_warnings = stats.analyze_sumatra_warnings_count + stats.analyze_mupdf_warnings_count + stats.analyze_ext_warnings_count
		if int(ver) >= g_first_analyze_build and total_warnings > 0 and not stats.rel_failed:
			assert("analyze.html" in files)

		s3_ver_url = "http://kjkpub.s3.amazonaws.com/" + s3_dir + ver + "/"
		html += "  <tr>\n"

		# build number
		url = "https://code.google.com/p/sumatrapdf/source/detail?r=" + ver
		html += td(a(url, ver), 4) + "\n"

		# TODO: this must group several revisions on one line to actually be shorter
		if not build_files_changed(ver):
			html += '<td colspan=4>unchanged</td>'
			continue

		# /analyze warnings count
		if int(ver) >= g_first_analyze_build and total_warnings > 0:
			url = s3_ver_url + "analyze.html"
			s = "%d %d %d warnings" % (stats.analyze_sumatra_warnings_count, stats.analyze_mupdf_warnings_count, stats.analyze_ext_warnings_count)
			html += td(a(url, s), 4)
		else:
			html += td("", 4)

		# release build status
		if stats.rel_failed:
			url =  s3_ver_url + "release_build_log.txt"
			s = '<font color="red"><b>fail</b></font> (' + a(url, "log") + ')'
		else:
			s = '<font color="green"<b>ok!</b></font>'
		html += td(s, 4) + "\n"

		# SumatraPDF.exe, Installer.exe size
		if stats.rel_failed:
			html += td("", 4) + "\n" + td("", 4) + "\n"
		else:
			prev_stats = stats_for_previous_build(ver)
			if None == prev_stats:
				html += td(str(stats.rel_sumatrapdf_exe_size), 4) + "\n"
				html += td(str(stats.rel_installer_exe_size), 4) + "\n"
			else:
				s = size_diff_html(stats.rel_sumatrapdf_exe_size - prev_stats.rel_sumatrapdf_exe_size)
				s = str(stats.rel_sumatrapdf_exe_size) + s
				html += td(s, 4) + "\n"
				s = size_diff_html(stats.rel_installer_exe_size - prev_stats.rel_installer_exe_size)
				s = str(stats.rel_installer_exe_size) + s
				html += td(s, 4) + "\n"
		html += "  </tr>\n"
	html += "</table>"
	html += "</body></html>\n"
	#print(html)
	s3UploadDataPublicWithContentType(html, "sumatrapdf/buildbot/index.html")