示例#1
0
def main():
	args = sys.argv[1:]
   	moveFiles = test_for_flag(args, "-move")
   	if len(args) not in [1,2]: usage()
   	srcDir = args[0]
   	if len(args) == 2:
	   	dstDir = args[1]
	else:
		dstDir = default_dst_dir()

	verify_dirs(srcDir, dstDir)
	copy_files(srcDir, dstDir, moveFiles)
示例#2
0
def main():
    args = sys.argv[1:]
    moveFiles = test_for_flag(args, "-move")
    if len(args) not in [1, 2]: usage()
    srcDir = args[0]
    if len(args) == 2:
        dstDir = args[1]
    else:
        dstDir = default_dst_dir()

    verify_dirs(srcDir, dstDir)
    copy_files(srcDir, dstDir, moveFiles)
示例#3
0
"""
Builds a (pre)release build of SumatraPDF, including the installer,
and optionally uploads it to s3.
"""

import os, os.path, shutil, sys, time, re

from util import log, run_cmd_throw, test_for_flag, s3UploadFilePublic
from util import s3UploadDataPublic, ensure_s3_doesnt_exist, ensure_path_exists
from util import zip_file, extract_sumatra_version, verify_started_in_right_directory
from util import build_installer_data, parse_svninfo_out, s3List, s3Delete

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")
svn_revision         = test_for_flag(args, "-svn-revision", True)
target_platform      = test_for_flag(args, "-platform", True)

def usage():
  print("build-release.py [-upload][-uploadtmp][-test][-test-installer][-prerelease][-platform=X64]")
  sys.exit(1)

# Terms:
#  static build  - SumatraPDF.exe single executable with mupdf code statically
#                  linked in
#  library build - SumatraPDF.exe executable that uses libmupdf.dll
示例#4
0
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()
    build(upload, upload_tmp, testing, build_test_installer,
          build_rel_installer, build_prerelease, skip_transl_update,
          svn_revision, target_platform)
示例#5
0
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()
    build(
        upload, upload_tmp, testing, build_test_installer, build_rel_installer,
        build_prerelease, skip_transl_update, svn_revision, target_platform)
示例#6
0
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")

  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")
    delete_old_pre_release_builds()
  else:
    s3.upload_file_public(exe_zip, s3_exe_zip)
示例#7
0
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)
示例#8
0
"""

import os
import os.path
import shutil
import sys
import time
import re

from util import log, run_cmd_throw, test_for_flag, s3UploadFilePublic
from util import s3UploadDataPublic, ensure_s3_doesnt_exist, ensure_path_exists
from util import zip_file, extract_sumatra_version, verify_started_in_right_directory
from util import build_installer_data, parse_svninfo_out, s3List, s3Delete

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")
svn_revision = test_for_flag(args, "-svn-revision", True)
target_platform = test_for_flag(args, "-platform", True)


def usage():
    print(
        "build-release.py [-upload][-uploadtmp][-test][-test-installer][-prerelease][-platform=X64]"
    )
    sys.exit(1)
示例#9
0
gVer = "%s rev %d" % (gVersion, gRevision)

# The format of release notes is:
# - a list for each version
# - first element of the list is version
# - second element is a date on which the release was made
# - rest are html fragments that will be displayed as <li> items on a html page
gReleaseNotes = [
  ["1.2 rev 1", "2011-??-??",
  "first release",
  "based on <a href='http://code.google.com/p/leveldb/source/detail?r=299ccedfeca1fb3497978c288e76008a5c08e899'>http://code.google.com/p/leveldb/source/detail?r=299ccedfeca1fb3497978c288e76008a5c08e899</a>",
  "<a href='http://kjkpub.s3.amazonaws.com/software/leveldb/rel/LevelDB-1.2-rev-1.zip'>LevelDB-1.2-rev-1.zip</a>"]
]

args = sys.argv[1:]
upload = test_for_flag(args, "-upload") or test_for_flag(args, "upload")
# we force test if we're uploading
test   = test_for_flag(args, "-test") or test_for_flag(args, "test") or upload

def usage():
  print("build.py [-test][-upload]")
  sys.exit(1)

s3_dir = "software/leveldb/rel"

def s3_zip_name():
  return "%s/LevelDB-%s-rev-%d.zip" % (s3_dir, gVersion, gRevision)

def zip_name():
  return "LevelDB-%s-rev-%d.zip" % (gVersion, gRevision)