def main(): if len(sys.argv) < 2: usage_and_exit() #print("top_dir: '%s'" % get_top_dir()) ensure_7z_exists() conf = util.load_config() cert_pwd = conf.GetCertPwdMustExist() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") ver = sys.argv[1] #print("ver: '%s'" % ver) svn_url = "https://sumatrapdf.googlecode.com/svn/tags/%srel" % ver src_dir_name = "SumatraPDF-%s-src" % ver archive_name = src_dir_name + ".7z" s3_path = "sumatrapdf/rel/" + archive_name print("svn_url: '%s'\ndir_name: '%s'\narchive_name: %s\ns3_path: %s" % (svn_url, src_dir_name, archive_name, s3_path)) s3.verify_doesnt_exist(s3_path) os.chdir(get_top_dir()) util.run_cmd_throw("svn", "export", svn_url, src_dir_name) util.run_cmd_throw("7z", "a", "-r", archive_name, src_dir_name) s3.upload_file_public(archive_name, s3_path) shutil.rmtree(src_dir_name) os.remove(archive_name)
def fix(): verify_started_in_right_directory() conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") d = get_stats_cache_dir() files = os.listdir(d) all_vers = [stats_txt_name_to_svn_no(f) for f in files] all_vers_s3 = get_s3_vers() get_s3_files() for ver in all_vers_s3: if not valid_s3_ver(ver): fix_from_ver(ver, all_vers, all_vers_s3) prev_ver = all_vers[0] to_check = all_vers[1:-1] for ver in to_check: if ver != prev_ver + 1: missing_ver = prev_ver + 1 print("missing ver %d" % missing_ver) fix_from_ver(missing_ver, all_vers, all_vers_s3) return prev_ver = ver print("All are ok!")
def main(): url_update = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-update.txt" url_latest = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-latest.txt" conf = load_config() assert conf.aws_access != "" and conf.aws_secret != "" s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") v1 = get_latest_version(url_latest) (v2, ver) = get_update_versions(url_update) validate_ver(ver) assert not v2 or v1 == v2, "sumpdf-update.txt and sumpdf-latest.txt don't agree on Stable version, run build.py -release first" verify_version_not_lower(ver, v1, v2) sys.stdout.write("Going to update auto-update version to %s. Are you sure? [y/N] " % ver) sys.stdout.flush() ch = getch() print() if ch not in ['y', 'Y']: print("Didn't update because you didn't press 'y'") sys.exit(1) # remove the Stable version from sumpdf-update.txt s = "[SumatraPDF]\nLatest %s\n" % ver s3.upload_data_public(s, "sumatrapdf/sumpdf-update.txt") # keep updating the legacy file for now s = "%s\n" % ver s3.upload_data_public(s, "sumatrapdf/sumpdf-latest.txt") v1 = get_latest_version(url_latest) (v2, v3) = get_update_versions(url_update) if v1 != ver or v2 != None or v3 != ver: print("Upload failed because v1 or v3 != ver ('%s' or '%s' != '%s'" % (v1, v3, ver)) sys.exit(1) print("Successfully update auto-update version to '%s'" % ver)
def main(): if len(sys.argv) < 2: usage_and_exit() #print("top_dir: '%s'" % get_top_dir()) ensure_7z_exists() conf = util.load_config() assert conf.aws_access is not None, "conf.py is missing" s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") ver = sys.argv[1] #print("ver: '%s'" % ver) upload(ver)
def main(): verify_started_in_right_directory() # to avoid problems, we build a separate source tree, just for the buildbot src_path = os.path.join("..", "sumatrapdf_buildbot") verify_path_exists(src_path) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") os.chdir(src_path) #build_version("6698", skip_release=True) #build_index_html() #build_sizes_json() #build_curr(force=True) buildbot_loop()
def main(): verify_efi_present() verify_started_in_right_directory() # to avoid problems, we build a separate source tree, just for the buildbot src_path = os.path.join("..", "sumatrapdf_buildbot") verify_path_exists(src_path) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") os.chdir(src_path) #build_version("6698", skip_release=True) #test_build_html_index() #build_sizes_json() #build_curr(force=True) buildbot_loop()
def main(): cert_path() # early check and ensures value is memoized verify_efi_present() verify_started_in_right_directory() # to avoid problems, we build a separate source tree, just for the buildbot src_path = os.path.join("..", "sumatrapdf_buildbot") verify_path_exists(src_path) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") os.chdir(src_path) # test_email_tests_failed() #build_version("8190", skip_release=True) # test_build_html_index() # build_sizes_json() # build_curr(force=True) buildbot_loop()
def main(): verify_can_send_email() cert_path() # early check and ensures value is memoized verify_started_in_right_directory() # to avoid problems, we build a separate source tree, just for the buildbot src_path = os.path.join("..", "sumatrapdf_buildbot") verify_path_exists(src_path) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") os.chdir(src_path) # test_email_tests_failed() #build_version("8190", skip_release=True) # test_build_html_index() # build_sizes_json() # build_curr(force=True) buildbot_loop()
def main(new_ver): url_update = "https://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-update.txt" url_latest = "https://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-latest.txt" conf = load_config() aws_access, aws_secret = conf.GetAwsCredsMustExist() s3.set_secrets(aws_access, aws_secret) s3.set_bucket("kjkpub") v1 = get_latest_version(url_latest) (v2, ver_4) = get_update_versions(url_update) validate_ver(ver_4) assert not v2 or v1 == v2, "sumpdf-update.txt and sumpdf-latest.txt don't agree on Stable version, run build.py -release first" if not new_ver: print("Current version: %s. To update run:\npython scripts\update_auto_update_ver.py <new_version>" % v1) return verify_version_not_lower(new_ver, v1, v2) sys.stdout.write("Current version: %s\nGoing to update auto-update version to %s. Are you sure? [y/N] " % (v1, new_ver)) sys.stdout.flush() ch = getch() print() if ch not in ['y', 'Y']: print("Didn't update because you didn't press 'y'") sys.exit(1) # remove the Stable version from sumpdf-update.txt s = "[SumatraPDF]\nLatest %s\n" % new_ver s3.upload_data_public(s, "sumatrapdf/sumpdf-update.txt") # keep updating the legacy file for now s = "%s\n" % new_ver s3.upload_data_public(s, "sumatrapdf/sumpdf-latest.txt") v1 = get_latest_version(url_latest) (v2, v3) = get_update_versions(url_update) if v1 != new_ver or v2 != None or v3 != new_ver: print("Upload failed because v1 or v3 != ver ('%s' or '%s' != '%s'" % (v1, v3, new_ver)) sys.exit(1) print("Successfully update auto-update version to '%s'" % new_ver)
def main(): url_update = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-update.txt" url_latest = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-latest.txt" conf = load_config() assert conf.aws_access != "" and conf.aws_secret != "" s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") v1 = get_latest_version(url_latest) (v2, ver) = get_update_versions(url_update) validate_ver(ver) assert not v2 or v1 == v2, "sumpdf-update.txt and sumpdf-latest.txt don't agree on Stable version, run build.py -release first" verify_version_not_lower(ver, v1, v2) sys.stdout.write( "Going to update auto-update version to %s. Are you sure? [y/N] " % ver) sys.stdout.flush() ch = getch() print() if ch not in ['y', 'Y']: print("Didn't update because you didn't press 'y'") sys.exit(1) # remove the Stable version from sumpdf-update.txt s = "[SumatraPDF]\nLatest %s\n" % ver s3.upload_data_public(s, "sumatrapdf/sumpdf-update.txt") # keep updating the legacy file for now s = "%s\n" % ver s3.upload_data_public(s, "sumatrapdf/sumpdf-latest.txt") v1 = get_latest_version(url_latest) (v2, v3) = get_update_versions(url_update) if v1 != ver or v2 != None or v3 != ver: print("Upload failed because v1 or v3 != ver ('%s' or '%s' != '%s'" % (v1, v3, ver)) sys.exit(1) print("Successfully update auto-update version to '%s'" % ver)
def build(upload, upload_tmp, testing, build_test_installer, build_rel_installer, build_prerelease, skip_transl_update, svn_revision, target_platform): verify_started_in_right_directory() try_find_config_files() if build_prerelease: if svn_revision is None: run_cmd_throw("svn", "update") (out, err) = run_cmd_throw("svn", "info") ver = str(parse_svninfo_out(out)) else: # allow to pass in an SVN revision, in case SVN itself isn't # available ver = svn_revision else: ver = extract_sumatra_version(os.path.join("src", "Version.h")) if upload: verify_correct_branch(ver) verify_not_tagged_yet(ver) log("Version: '%s'" % ver) # don't update translations for release versions to prevent Trunk changes # from messing up the compilation of a point release on a branch if build_prerelease and not skip_transl_update: trans_upload.uploadStringsIfChanged() changed = trans_download.downloadAndUpdateTranslationsIfChanged() # Note: this is not a perfect check since re-running the script will # proceed if changed: print( "\nNew translations have been downloaded from apptranslator.og" ) print( "Please verify and checkin src/Translations_txt.cpp and strings/translations.txt" ) sys.exit(1) filename_base = "SumatraPDF-%s" % ver if build_prerelease: filename_base = "SumatraPDF-prerelease-%s" % ver s3_dir = "sumatrapdf/rel" if build_prerelease: s3_dir = "sumatrapdf/prerel" if upload_tmp: upload = True s3_dir += "tmp" if upload: log("Will upload to s3 at %s" % s3_dir) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") s3_prefix = "%s/%s" % (s3_dir, filename_base) s3_exe = s3_prefix + ".exe" s3_installer = s3_prefix + "-install.exe" s3_pdb_lzsa = s3_prefix + ".pdb.lzsa" s3_pdb_zip = s3_prefix + ".pdb.zip" s3_exe_zip = s3_prefix + ".zip" s3_files = [s3_exe, s3_installer, s3_pdb_lzsa, s3_pdb_zip] if not build_prerelease: s3_files.append(s3_exe_zip) cert_pwd = None cert_path = os.path.join("scripts", "cert.pfx") if upload: map(s3.verify_doesnt_exist, s3_files) verify_path_exists(cert_path) conf = load_config() cert_pwd = conf.GetCertPwdMustExist() obj_dir = "obj-rel" if target_platform == "X64": obj_dir += "64" if not testing and not build_test_installer and not build_rel_installer: shutil.rmtree(obj_dir, ignore_errors=True) shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True) config = "CFG=rel" if build_test_installer and not build_prerelease: obj_dir = "obj-dbg" config = "CFG=dbg" extcflags = "" if build_prerelease: extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver platform = "PLATFORM=%s" % (target_platform or "X86") # build executables for signing (building the installer will build the rest) (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", config, extcflags, platform, "SumatraPDF", "Uninstaller") if build_test_installer: print_run_resp(out, err) exe = os.path.join(obj_dir, "SumatraPDF.exe") sign_retry(exe, cert_pwd) sign_retry(os.path.join(obj_dir, "SumatraPDF-no-MuPDF.exe"), cert_pwd) sign_retry(os.path.join(obj_dir, "uninstall.exe"), cert_pwd) (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", "Installer", config, platform, extcflags) if build_test_installer: print_run_resp(out, err) if build_test_installer or build_rel_installer: sys.exit(0) installer = os.path.join(obj_dir, "Installer.exe") sign_retry(installer, cert_pwd) pdb_lzsa_archive = create_pdb_lzsa_archive(obj_dir, "%s.pdb.lzsa" % filename_base) pdb_zip_archive = create_pdb_zip_archive(obj_dir, "%s.pdb.zip" % filename_base) builds_dir = os.path.join("builds", ver) if os.path.exists(builds_dir): shutil.rmtree(builds_dir) os.makedirs(builds_dir) copy_to_dst_dir(exe, builds_dir) copy_to_dst_dir(installer, builds_dir) copy_to_dst_dir(pdb_lzsa_archive, builds_dir) copy_to_dst_dir(pdb_zip_archive, builds_dir) # package portable version in a .zip file if not build_prerelease: exe_zip_name = "%s.zip" % filename_base zip_one_file(obj_dir, "SumatraPDF.exe", exe_zip_name) exe_zip_path = os.path.join(obj_dir, exe_zip_name) copy_to_dst_dir(exe_zip_path, builds_dir) if not upload: return if build_prerelease: jstxt = 'var sumLatestVer = %s;\n' % ver jstxt += 'var sumBuiltOn = "%s";\n' % time.strftime("%Y-%m-%d") jstxt += 'var sumLatestName = "%s";\n' % s3_exe.split("/")[-1] jstxt += 'var sumLatestExe = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_exe jstxt += 'var sumLatestPdb = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_pdb_zip jstxt += 'var sumLatestInstaller = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_installer s3.upload_file_public(installer, s3_installer) s3.upload_file_public(pdb_lzsa_archive, s3_pdb_lzsa) s3.upload_file_public(pdb_zip_archive, s3_pdb_zip) s3.upload_file_public(exe, s3_exe) if build_prerelease: s3.upload_data_public(jstxt, "sumatrapdf/sumatralatest.js") # don't set a Stable version for prerelease builds txt = "[SumatraPDF]\nLatest %s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-update.txt") # keep updating the legacy file for now txt = "%s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-latest.txt") delete_old_pre_release_builds() else: # update the Latest version for manual update checks but # leave the Stable version for automated update checks update_url = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-update.txt" ver_stable = get_stable_version(update_url, "2.5.2") s3.upload_file_public(exe_zip_path, s3_exe_zip) s3.upload_data_public( "[SumatraPDF]\nLatest %s\nStable %s\n" % (ver, ver_stable), "sumatrapdf/sumpdf-update.txt") if not build_prerelease: svn_tag_release(ver) upload_sources.upload(ver)
def main(): global upload if len(args) != 0: usage() verify_started_in_right_directory() if build_prerelease: if svn_revision is None: run_cmd_throw("svn", "update") (out, err) = run_cmd_throw("svn", "info") ver = str(parse_svninfo_out(out)) else: # allow to pass in an SVN revision, in case SVN itself isn't available ver = svn_revision else: ver = extract_sumatra_version(os.path.join("src", "Version.h")) log("Version: '%s'" % ver) # don't update translations for release versions to prevent Trunk changes # from messing up the compilation of a point release on a branch if g_new_translation_system and build_prerelease and not skip_transl_update: trans_upload.uploadStringsIfChanged() changed = trans_download.downloadAndUpdateTranslationsIfChanged() # Note: this is not a perfect check since re-running the script will # proceed if changed: print("\nNew translations have been downloaded from apptranslator.og") print("Please verify and checkin src/Translations_txt.cpp and strings/translations.txt") sys.exit(1) filename_base = "SumatraPDF-%s" % ver if build_prerelease: filename_base = "SumatraPDF-prerelease-%s" % ver s3_dir = "sumatrapdf/rel" if build_prerelease: s3_dir = "sumatrapdf/prerel" if upload_tmp: upload = True s3_dir += "tmp" if upload: log("Will upload to s3 at %s" % s3_dir) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") s3_prefix = "%s/%s" % (s3_dir, filename_base) s3_exe = s3_prefix + ".exe" s3_installer = s3_prefix + "-install.exe" s3_pdb_zip = s3_prefix + ".pdb.zip" s3_exe_zip = s3_prefix + ".zip" s3_files = [s3_exe, s3_installer, s3_pdb_zip] if not build_prerelease: s3_files.append(s3_exe_zip) cert_pwd = None cert_path = os.path.join("scripts", "cert.pfx") if upload: map(s3.verify_doesnt_exist, s3_files) verify_path_exists(cert_path) conf = load_config() cert_pwd = conf.GetCertPwdMustExist() obj_dir = "obj-rel" if target_platform == "X64": obj_dir += "64" if not testing and not build_test_installer and not build_rel_installer: shutil.rmtree(obj_dir, ignore_errors=True) shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True) config = "CFG=rel" if build_test_installer and not build_prerelease: obj_dir = "obj-dbg" config = "CFG=dbg" extcflags = "" if build_prerelease: extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver platform = "PLATFORM=%s" % (target_platform or "X86") run_cmd_throw("nmake", "-f", "makefile.msvc", config, extcflags, platform, "all_sumatrapdf") exe = os.path.join(obj_dir, "SumatraPDF.exe") if upload: sign(exe, cert_pwd) sign(os.path.join(obj_dir, "uninstall.exe"), cert_pwd) build_installer_data(obj_dir) run_cmd_throw("nmake", "-f", "makefile.msvc", "Installer", config, platform, extcflags) if build_test_installer or build_rel_installer: sys.exit(0) installer = os.path.join(obj_dir, "Installer.exe") if upload: sign(installer, cert_pwd) pdb_zip = os.path.join(obj_dir, "%s.pdb.zip" % filename_base) zip_file(pdb_zip, os.path.join(obj_dir, "libmupdf.pdb")) zip_file(pdb_zip, os.path.join(obj_dir, "Installer.pdb"), append=True) zip_file(pdb_zip, os.path.join(obj_dir, "SumatraPDF-no-MuPDF.pdb"), append=True) zip_file(pdb_zip, os.path.join(obj_dir, "SumatraPDF.pdb"), append=True) builds_dir = os.path.join("builds", ver) if os.path.exists(builds_dir): shutil.rmtree(builds_dir) os.makedirs(builds_dir) copy_to_dst_dir(exe, builds_dir) copy_to_dst_dir(installer, builds_dir) copy_to_dst_dir(pdb_zip, builds_dir) if not build_prerelease: exe_zip = os.path.join(obj_dir, "%s.zip" % filename_base) zip_file(exe_zip, exe, "SumatraPDF.exe", compress=True) verify_path_exists(exe_zip) copy_to_dst_dir(exe_zip, builds_dir) if not upload: return if build_prerelease: jstxt = 'var sumLatestVer = %s;\n' % ver jstxt += 'var sumBuiltOn = "%s";\n' % time.strftime("%Y-%m-%d") jstxt += 'var sumLatestName = "%s";\n' % s3_exe.split("/")[-1] jstxt += 'var sumLatestExe = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_exe jstxt += 'var sumLatestPdb = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_pdb_zip jstxt += 'var sumLatestInstaller = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_installer s3.upload_file_public(installer, s3_installer) s3.upload_file_public(pdb_zip, s3_pdb_zip) s3.upload_file_public(exe, s3_exe) if build_prerelease: s3.upload_data_public(jstxt, "sumatrapdf/sumatralatest.js") txt = "%s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-latest.txt") deleteOldPreReleaseBuilds() else: s3.upload_file_public(exe_zip, s3_exe_zip)
def build(upload, upload_tmp, testing, build_test_installer, build_rel_installer, build_prerelease, skip_transl_update, svn_revision, target_platform): verify_started_in_right_directory() try_find_config_files() if build_prerelease: if svn_revision is None: run_cmd_throw("svn", "update") (out, err) = run_cmd_throw("svn", "info") ver = str(parse_svninfo_out(out)) else: # allow to pass in an SVN revision, in case SVN itself isn't # available ver = svn_revision else: ver = extract_sumatra_version(os.path.join("src", "Version.h")) if upload: verify_correct_branch(ver) verify_not_tagged_yet(ver) log("Version: '%s'" % ver) # don't update translations for release versions to prevent Trunk changes # from messing up the compilation of a point release on a branch if build_prerelease and not skip_transl_update: trans_upload.uploadStringsIfChanged() changed = trans_download.downloadAndUpdateTranslationsIfChanged() # Note: this is not a perfect check since re-running the script will # proceed if changed: print( "\nNew translations have been downloaded from apptranslator.og") print( "Please verify and checkin src/Translations_txt.cpp and strings/translations.txt") sys.exit(1) filename_base = "SumatraPDF-%s" % ver if build_prerelease: filename_base = "SumatraPDF-prerelease-%s" % ver s3_dir = "sumatrapdf/rel" if build_prerelease: s3_dir = "sumatrapdf/prerel" if upload_tmp: upload = True s3_dir += "tmp" if upload: log("Will upload to s3 at %s" % s3_dir) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") s3_prefix = "%s/%s" % (s3_dir, filename_base) s3_exe = s3_prefix + ".exe" s3_installer = s3_prefix + "-install.exe" s3_pdb_lzsa = s3_prefix + ".pdb.lzsa" s3_pdb_zip = s3_prefix + ".pdb.zip" s3_exe_zip = s3_prefix + ".zip" s3_files = [s3_exe, s3_installer, s3_pdb_lzsa, s3_pdb_zip] if not build_prerelease: s3_files.append(s3_exe_zip) cert_pwd = None cert_path = os.path.join("scripts", "cert.pfx") if upload: map(s3.verify_doesnt_exist, s3_files) verify_path_exists(cert_path) conf = load_config() cert_pwd = conf.GetCertPwdMustExist() obj_dir = "obj-rel" if target_platform == "X64": obj_dir += "64" if not testing and not build_test_installer and not build_rel_installer: shutil.rmtree(obj_dir, ignore_errors=True) shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True) config = "CFG=rel" if build_test_installer and not build_prerelease: obj_dir = "obj-dbg" config = "CFG=dbg" extcflags = "" if build_prerelease: extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver platform = "PLATFORM=%s" % (target_platform or "X86") # build executables for signing (building the installer will build the rest) (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", config, extcflags, platform, "SumatraPDF", "Uninstaller") if build_test_installer: print_run_resp(out, err) exe = os.path.join(obj_dir, "SumatraPDF.exe") sign_retry(exe, cert_pwd) sign_retry(os.path.join(obj_dir, "SumatraPDF-no-MuPDF.exe"), cert_pwd) sign_retry(os.path.join(obj_dir, "uninstall.exe"), cert_pwd) (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", "Installer", config, platform, extcflags) if build_test_installer: print_run_resp(out, err) if build_test_installer or build_rel_installer: sys.exit(0) installer = os.path.join(obj_dir, "Installer.exe") sign_retry(installer, cert_pwd) pdb_lzsa_archive = create_pdb_lzsa_archive(obj_dir, "%s.pdb.lzsa" % filename_base) pdb_zip_archive = create_pdb_zip_archive(obj_dir, "%s.pdb.zip" % filename_base) builds_dir = os.path.join("builds", ver) if os.path.exists(builds_dir): shutil.rmtree(builds_dir) os.makedirs(builds_dir) copy_to_dst_dir(exe, builds_dir) copy_to_dst_dir(installer, builds_dir) copy_to_dst_dir(pdb_lzsa_archive, builds_dir) copy_to_dst_dir(pdb_zip_archive, builds_dir) # package portable version in a .zip file if not build_prerelease: exe_zip_name = "%s.zip" % filename_base zip_one_file(obj_dir, "SumatraPDF.exe", exe_zip_name) exe_zip_path = os.path.join(obj_dir, exe_zip_name) copy_to_dst_dir(exe_zip_path, builds_dir) if not upload: return if build_prerelease: jstxt = 'var sumLatestVer = %s;\n' % ver jstxt += 'var sumBuiltOn = "%s";\n' % time.strftime("%Y-%m-%d") jstxt += 'var sumLatestName = "%s";\n' % s3_exe.split("/")[-1] jstxt += 'var sumLatestExe = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_exe jstxt += 'var sumLatestPdb = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_pdb_zip jstxt += 'var sumLatestInstaller = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_installer s3.upload_file_public(installer, s3_installer) s3.upload_file_public(pdb_lzsa_archive, s3_pdb_lzsa) s3.upload_file_public(pdb_zip_archive, s3_pdb_zip) s3.upload_file_public(exe, s3_exe) if build_prerelease: s3.upload_data_public(jstxt, "sumatrapdf/sumatralatest.js") # don't set a Stable version for prerelease builds txt = "[SumatraPDF]\nLatest %s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-update.txt") # keep updating the legacy file for now txt = "%s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-latest.txt") delete_old_pre_release_builds() else: # update the Latest version for manual update checks but # leave the Stable version for automated update checks update_url = "http://kjkpub.s3.amazonaws.com/sumatrapdf/sumpdf-update.txt" ver_stable = get_stable_version(update_url, "2.5.2") s3.upload_file_public(exe_zip_path, s3_exe_zip) s3.upload_data_public("[SumatraPDF]\nLatest %s\nStable %s\n" % (ver, ver_stable), "sumatrapdf/sumpdf-update.txt") if not build_prerelease: svn_tag_release(ver) upload_sources.upload(ver)
def main(): args = sys.argv[1:] upload = test_for_flag(args, "-upload") upload_tmp = test_for_flag(args, "-uploadtmp") testing = test_for_flag(args, "-test") or test_for_flag(args, "-testing") build_test_installer = test_for_flag(args, "-test-installer") or test_for_flag(args, "-testinst") or test_for_flag(args, "-testinstaller") build_rel_installer = test_for_flag(args, "-testrelinst") build_prerelease = test_for_flag(args, "-prerelease") skip_transl_update = test_for_flag(args, "-noapptrans") svn_revision = test_for_flag(args, "-svn-revision", True) target_platform = test_for_flag(args, "-platform", True) if len(args) != 0: usage() verify_started_in_right_directory() if build_prerelease: if svn_revision is None: run_cmd_throw("svn", "update") (out, err) = run_cmd_throw("svn", "info") ver = str(parse_svninfo_out(out)) else: # allow to pass in an SVN revision, in case SVN itself isn't available ver = svn_revision else: ver = extract_sumatra_version(os.path.join("src", "Version.h")) log("Version: '%s'" % ver) # don't update translations for release versions to prevent Trunk changes # from messing up the compilation of a point release on a branch if build_prerelease and not skip_transl_update: trans_upload.uploadStringsIfChanged() changed = trans_download.downloadAndUpdateTranslationsIfChanged() # Note: this is not a perfect check since re-running the script will # proceed if changed: print("\nNew translations have been downloaded from apptranslator.og") print("Please verify and checkin src/Translations_txt.cpp and strings/translations.txt") sys.exit(1) filename_base = "SumatraPDF-%s" % ver if build_prerelease: filename_base = "SumatraPDF-prerelease-%s" % ver s3_dir = "sumatrapdf/rel" if build_prerelease: s3_dir = "sumatrapdf/prerel" if upload_tmp: upload = True s3_dir += "tmp" if upload: log("Will upload to s3 at %s" % s3_dir) conf = load_config() s3.set_secrets(conf.aws_access, conf.aws_secret) s3.set_bucket("kjkpub") s3_prefix = "%s/%s" % (s3_dir, filename_base) s3_exe = s3_prefix + ".exe" s3_installer = s3_prefix + "-install.exe" s3_pdb_zip = s3_prefix + ".pdb.zip" s3_exe_zip = s3_prefix + ".zip" s3_files = [s3_exe, s3_installer, s3_pdb_zip] if not build_prerelease: s3_files.append(s3_exe_zip) cert_pwd = None cert_path = os.path.join("scripts", "cert.pfx") if upload: map(s3.verify_doesnt_exist, s3_files) verify_path_exists(cert_path) conf = load_config() cert_pwd = conf.GetCertPwdMustExist() obj_dir = "obj-rel" if target_platform == "X64": obj_dir += "64" if not testing and not build_test_installer and not build_rel_installer: shutil.rmtree(obj_dir, ignore_errors=True) shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True) config = "CFG=rel" if build_test_installer and not build_prerelease: obj_dir = "obj-dbg" config = "CFG=dbg" extcflags = "" if build_prerelease: extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver platform = "PLATFORM=%s" % (target_platform or "X86") (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", config, extcflags, platform, "all_sumatrapdf") if build_test_installer: print_run_resp(out, err) exe = os.path.join(obj_dir, "SumatraPDF.exe") if upload: sign(exe, cert_pwd) sign(os.path.join(obj_dir, "uninstall.exe"), cert_pwd) build_installer_data(obj_dir) (out, err) = run_cmd_throw("nmake", "-f", "makefile.msvc", "Installer", config, platform, extcflags) if build_test_installer: print_run_resp(out, err) if build_test_installer or build_rel_installer: sys.exit(0) installer = os.path.join(obj_dir, "Installer.exe") if upload: sign(installer, cert_pwd) pdb_archive = create_pdb_archive(obj_dir, "%s.pdb.lzma" % filename_base) builds_dir = os.path.join("builds", ver) if os.path.exists(builds_dir): shutil.rmtree(builds_dir) os.makedirs(builds_dir) copy_to_dst_dir(exe, builds_dir) copy_to_dst_dir(installer, builds_dir) copy_to_dst_dir(pdb_archive, builds_dir) # package portable version in a .zip file if not build_prerelease: exe_zip_name = "%s.zip" % filename_base zip_one_file(obj_dir, "SumatraPDF.exe", exe_zip_name) exe_zip_path = os.path.join(obj_dir, exe_zip_name) copy_to_dst_dir(exe_zip_path, builds_dir) if not upload: return if build_prerelease: jstxt = 'var sumLatestVer = %s;\n' % ver jstxt += 'var sumBuiltOn = "%s";\n' % time.strftime("%Y-%m-%d") jstxt += 'var sumLatestName = "%s";\n' % s3_exe.split("/")[-1] jstxt += 'var sumLatestExe = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_exe jstxt += 'var sumLatestPdb = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_pdb_zip jstxt += 'var sumLatestInstaller = "http://kjkpub.s3.amazonaws.com/%s";\n' % s3_installer s3.upload_file_public(installer, s3_installer) s3.upload_file_public(pdb_archive, s3_pdb_zip) s3.upload_file_public(exe, s3_exe) if build_prerelease: s3.upload_data_public(jstxt, "sumatrapdf/sumatralatest.js") txt = "%s\n" % ver s3.upload_data_public(txt, "sumatrapdf/sumpdf-prerelease-latest.txt") delete_old_pre_release_builds() else: s3.upload_file_public(exe_zip_path, s3_exe_zip)