Exemplo n.º 1
0
def clean():
    if base.is_dir("depot_tools"):
        base.delete_dir_with_access_error("depot_tools")
        base.delete_dir("depot_tools")
    if base.is_dir("v8"):
        base.delete_dir_with_access_error("v8")
        base.delete_dir("v8")
    if base.is_exist("./.gclient"):
        base.delete_file("./.gclient")
    if base.is_exist("./.gclient_entries"):
        base.delete_file("./.gclient_entries")
    if base.is_exist("./.cipd"):
        base.delete_dir("./.cipd")
    return
Exemplo n.º 2
0
def check_erlang():
    dependence = CDependencies()
    base.print_info('Check installed Erlang')

    erlangBitness = ""
    erlang_path_home = get_erlang_path_to_bin()
    if base.is_exist(erlang_path_home) == False:
        dependence.append_uninstall('Erlang')
        dependence.append_uninstall('RabbitMQ')
        return dependence

    if ("" != erlang_path_home or host_platform != 'windows'):
        erlangBitness = base.run_command_in_dir(
            erlang_path_home,
            'erl -eval "erlang:display(erlang:system_info(wordsize)), halt()." -noshell'
        )['stdout']

    if (erlangBitness == '8'):
        print("Installed Erlang is valid")
        return dependence

    print('Need Erlang with bitness x64')

    if (host_platform == 'windows'):
        dependence.append_removepath(os.environ['AppData'] + '\\RabbitMQ\\db')
        dependence.append_uninstall('Erlang')
        dependence.append_uninstall('RabbitMQ')
    else:
        dependence.append_uninstall('erlang')
        dependence.append_uninstall('rabbitmq-server')
    dependence.append_install('Erlang')
    dependence.append_install('RabbitMQ')

    return dependence
Exemplo n.º 3
0
def check_mysqlServer():
    base.print_info('Check MySQL Server')
    dependence = CDependencies()
    mysqlLoginSrt = get_mysqlLoginSrting()
    connectionString = mysqlLoginSrt + ' -e "SHOW GLOBAL VARIABLES LIKE ' + r"'PORT';" + '"'

    if (host_platform != 'windows'):
        result = os.system(mysqlLoginSrt + ' -e "exit"')
        if (result == 0):
            connectionResult = base.run_command(connectionString)['stdout']
            if (connectionResult.find('port') != -1 and connectionResult.find(
                    install_params['MySQLServer']['port']) != -1):
                print('MySQL configuration is valid')
                dependence.sqlPath = 'mysql'
                return dependence
        print('Valid MySQL Server not found')
        dependence.append_install('MySQLServer')
        dependence.append_uninstall('mysql-server')
        return dependence

    arrInfo = get_mysqlServersInfo()
    for info in arrInfo:
        if (base.is_dir(info['Location']) == False):
            continue

        mysql_full_name = 'MySQL Server ' + info['Version'] + ' '

        connectionResult = base.run_command_in_dir(
            get_mysql_path_to_bin(info['Location']),
            connectionString)['stdout']
        if (connectionResult.find('port') != -1 and connectionResult.find(
                install_params['MySQLServer']['port']) != -1):
            print(mysql_full_name + 'configuration is valid')
            dependence.sqlPath = info['Location']
            return dependence
        print(mysql_full_name + 'configuration is not valid')

    print('Valid MySQL Server not found')
    dependence.append_uninstall('MySQL Server')
    dependence.append_uninstall('MySQL Installer')
    dependence.append_install('MySQLInstaller')
    dependence.append_install('MySQLServer')

    MySQLData = os.environ['ProgramData'] + '\\MySQL\\'
    if base.is_exist(MySQLData) == False:
        return dependence

    dir = os.listdir(MySQLData)
    for path in dir:
        if (path.find('MySQL Server') != -1) and (base.is_file(MySQLData +
                                                               path) == False):
            dependence.append_removepath(MySQLData + path)

    return dependence
Exemplo n.º 4
0
def make():
    #check server module to build
    if (not config.check_option("module", "server")):
        return

    git_dir = base.get_script_dir() + "/../.."
    server_dir = base.get_script_dir() + "/../../server"
    branding_dir = server_dir + "/branding"

    if ("" != config.option("branding")):
        branding_dir = git_dir + '/' + config.option("branding") + '/server'

    base.cmd_in_dir(server_dir, "npm", ["install"])
    base.cmd_in_dir(server_dir, "grunt",
                    ["--no-color", "-v"] + base.server_addons_param())

    #env variables
    product_version = base.get_env('PRODUCT_VERSION')
    if (not product_version):
        product_version = "0.0.0"

    build_number = base.get_env('BUILD_NUMBER')
    if (not build_number):
        build_number = "0"

    cur_date = datetime.date.today().strftime("%m/%d/%Y")

    server_build_dir = server_dir + "/build/server"

    base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js",
                         "const buildNumber = [0-9]*",
                         "const buildNumber = " + build_number)
    base.replaceInFileRE(server_build_dir + "/Common/sources/license.js",
                         "const buildDate = '[0-9-/]*'",
                         "const buildDate = '" + cur_date + "'")
    base.replaceInFileRE(server_build_dir + "/Common/sources/commondefines.js",
                         "const buildVersion = '[0-9.]*'",
                         "const buildVersion = '" + product_version + "'")

    custom_public_key = branding_dir + '/debug.js'

    if (base.is_exist(custom_public_key)):
        base.copy_file(custom_public_key, server_build_dir + '/Common/sources')

    pkg_target = "node14"

    if ("linux" == base.host_platform()):
        pkg_target += "-linux"

    if ("windows" == base.host_platform()):
        pkg_target += "-win"

    base.cmd_in_dir(server_build_dir + "/DocService", "pkg", [
        ".", "-t", pkg_target, "--options", "max_old_space_size=4096", "-o",
        "docservice"
    ])
    base.cmd_in_dir(server_build_dir + "/FileConverter", "pkg",
                    [".", "-t", pkg_target, "-o", "converter"])
    base.cmd_in_dir(server_build_dir + "/Metrics", "pkg",
                    [".", "-t", pkg_target, "-o", "metrics"])

    example_dir = base.get_script_dir(
    ) + "/../../document-server-integration/web/documentserver-example/nodejs"
    base.delete_dir(example_dir + "/node_modules")
    base.cmd_in_dir(example_dir, "npm", ["install"])
    base.cmd_in_dir(example_dir, "pkg",
                    [".", "-t", pkg_target, "-o", "example"])
Exemplo n.º 5
0
def make(packages):
    base_dir = base.get_script_dir() + "/../out"
    git_dir = base.get_script_dir() + "/../.."

    for package in packages:

        if -1 != package.find("diskimage"):
            macos_dir = os.path.abspath(git_dir + "/desktop-apps/macos")
            update_dir = macos_dir + "/build/update"
            changes_dir = macos_dir + "/ONLYOFFICE/update/updates/ONLYOFFICE/changes"

            if (package == "diskimage-x86_64"):
                lane = "release_x86_64"
                scheme = "ONLYOFFICE-x86_64"
            elif (package == "diskimage-v8-x86_64"):
                lane = "release_v8"
                scheme = "ONLYOFFICE-v8"
            elif (package == "diskimage-arm64"):
                lane = "release_arm"
                scheme = "ONLYOFFICE-arm"
            else:
                exit(1)

            print("Build package " + scheme)

            print("$ bundler exec fastlane " + lane + " skip_git_bump:true")
            base.cmd_in_dir(macos_dir, "bundler",
                            ["exec", "fastlane", lane, "skip_git_bump:true"])

            print("Build updates")

            app_version = base.run_command(
                "/usr/libexec/PlistBuddy -c 'print :CFBundleShortVersionString' "
                + macos_dir +
                "/build/ONLYOFFICE.app/Contents/Info.plist")['stdout']
            zip_filename = scheme + "-" + app_version
            macos_zip = macos_dir + "/build/" + zip_filename + ".zip"
            update_storage_dir = base.get_env(
                "ARCHIVES_DIR") + "/" + scheme + "/_updates"

            base.create_dir(update_dir)
            base.copy_dir_content(update_storage_dir, update_dir, ".zip")
            base.copy_dir_content(update_storage_dir, update_dir, ".html")
            base.copy_file(macos_zip, update_dir)

            notes_src = changes_dir + "/" + app_version + "/ReleaseNotes.html"
            notes_dst = update_dir + "/" + zip_filename + ".html"
            cur_date = base.run_command(
                "LC_ALL=en_US.UTF-8 date -u \"+%B %e, %Y\"")['stdout']
            if base.is_exist(notes_src):
                base.copy_file(notes_src, notes_dst)
                base.replaceInFileRE(
                    notes_dst, r"(<span class=\"releasedate\">).+(</span>)",
                    "\\1 - " + cur_date + "\\2")
            else:
                base.writeFile(notes_dst, "placeholder\n")

            notes_src = changes_dir + "/" + app_version + "/ReleaseNotesRU.html"
            notes_dst = update_dir + "/" + zip_filename + ".ru.html"
            cur_date = base.run_command(
                "LC_ALL=ru_RU.UTF-8 date -u \"+%e %B %Y\"")['stdout']
            if base.is_exist(notes_src):
                base.copy_file(notes_src, notes_dst)
                base.replaceInFileRE(
                    notes_dst, r"(<span class=\"releasedate\">).+(</span>)",
                    "\\1 - " + cur_date + "\\2")
            else:
                base.writeFile(notes_dst, "placeholder\n")

            print("$ ./generate_appcast " + update_dir)
            base.cmd(macos_dir + "/Vendor/Sparkle/bin/generate_appcast",
                     [update_dir])

            print("Edit Sparkle appcast links")

            sparkle_base_url = "https://download.onlyoffice.com/install/desktop/editors/mac"
            if (package == "diskimage-x86_64"): sparkle_base_url += "/x86_64"
            elif (package == "diskimage-v8-x86_64"): sparkle_base_url += "/v8"
            elif (package == "diskimage-arm64"): sparkle_base_url += "/arm"

            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink>)(?:.+ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + sparkle_base_url +
                "/updates/changes/\\2/ReleaseNotes.html\\3")
            base.replaceInFileRE(
                update_dir + "/onlyoffice.xml",
                r"(<sparkle:releaseNotesLink xml:lang=\"ru\">)(?:ONLYOFFICE-(?:x86|x86_64|v8|arm)-([0-9.]+)\..+)(</sparkle:releaseNotesLink>)",
                "\\1" + sparkle_base_url +
                "/updates/changes/\\2/ReleaseNotesRU.html\\3")
            base.replaceInFileRE(update_dir + "/onlyoffice.xml",
                                 r"(url=\")(?:.+/)(ONLYOFFICE.+\")",
                                 "\\1" + sparkle_base_url + "/updates/\\2")

            print("Delete unnecessary files")

            for file in os.listdir(update_dir):
                if (-1 == file.find(app_version)) and (file.endswith(".zip") or
                                                       file.endswith(".html")):
                    base.delete_file(update_dir + "/" + file)

    return
Exemplo n.º 6
0
def make():
  base_dir = base.get_script_dir() + "/../out"
  git_dir = base.get_script_dir() + "/../.."
  core_dir = git_dir + "/core"
  plugins_dir = git_dir + "/sdkjs-plugins"
  branding = config.branding()

  platforms = config.option("platform").split()
  for native_platform in platforms:
    if not native_platform in config.platforms:
      continue

    if (-1 != native_platform.find("_xp")):
      print("Server module not supported on Windows XP")
      continue

    if (-1 != native_platform.find("ios")):
      print("Server module not supported on iOS")
      continue

    if (-1 != native_platform.find("android")):
      print("Server module not supported on Android")
      continue

    root_dir = base_dir + ("/" + native_platform + "/" + branding + "/documentserver")
    if (base.is_dir(root_dir)):
      base.delete_dir(root_dir)
    base.create_dir(root_dir)

    build_server_dir = root_dir + '/server'
    server_dir = base.get_script_dir() + "/../../server"
    bin_server_dir = server_dir + "/build/server"

    base.create_dir(build_server_dir + '/DocService')

    base.copy_dir(bin_server_dir + '/Common/config', build_server_dir + '/Common/config')

    base.create_dir(build_server_dir + '/DocService')
    base.copy_exe(bin_server_dir + "/DocService", build_server_dir + '/DocService', "docservice")

    base.create_dir(build_server_dir + '/FileConverter')
    base.copy_exe(bin_server_dir + "/FileConverter", build_server_dir + '/FileConverter', "converter")

    base.create_dir(build_server_dir + '/Metrics')
    base.copy_exe(bin_server_dir + "/Metrics", build_server_dir + '/Metrics', "metrics")
    base.copy_dir(bin_server_dir + '/Metrics/config', build_server_dir + '/Metrics/config')
    base.create_dir(build_server_dir + '/Metrics/node_modules/modern-syslog/build/Release')
    base.copy_file(bin_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node", build_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node")

    base.create_dir(build_server_dir + '/SpellChecker')
    base.copy_exe(bin_server_dir + "/SpellChecker", build_server_dir + '/SpellChecker', "spellchecker")
    base.create_dir(build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release')
    base.copy_file(bin_server_dir + "/SpellChecker/node_modules/nodehun/build/Release/nodehun.node", build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release/nodehun.node')
    

    qt_dir = base.qt_setup(native_platform)
    platform = native_platform

    core_build_dir = core_dir + "/build"
    if ("" != config.option("branding")):
      core_build_dir += ("/" + config.option("branding"))

    platform_postfix = platform + base.qt_dst_postfix()

    converter_dir = root_dir + "/server/FileConverter/bin"
    base.create_dir(converter_dir)

    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "kernel")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "UnicodeConverter")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "graphics")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfWriter")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfReader")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "DjVuFile")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "XpsFile")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlFile")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlRenderer")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "doctrenderer")
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "x2t")

    base.generate_doctrenderer_config(converter_dir + "/DoctRenderer.config", "../../../", "server")

    # icu
    if (0 == platform.find("win")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/icudt58.dll", converter_dir + "/icudt58.dll")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/icuuc58.dll", converter_dir + "/icuuc58.dll")

    if (0 == platform.find("linux")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.so.58", converter_dir + "/libicudata.so.58")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.so.58", converter_dir + "/libicuuc.so.58")

    if (0 == platform.find("mac")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.58.dylib", converter_dir + "/libicudata.58.dylib")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.58.dylib", converter_dir + "/libicuuc.58.dylib")

    if (0 == platform.find("win")):
      base.copy_files(core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/release/icudt*.dat", converter_dir + "/")
    else:
      base.copy_file(core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/icudtl.dat", converter_dir + "/icudtl.dat")

    # builder
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "docbuilder")
    base.copy_dir(git_dir + "/DocumentBuilder/empty", converter_dir + "/empty")

    # html
    base.create_dir(converter_dir + "/HtmlFileInternal")
    base.copy_exe(core_build_dir + "/lib/" + platform_postfix, converter_dir + "/HtmlFileInternal", "HtmlFileInternal")
    base.copy_files(core_dir + "/Common/3dParty/cef/" + platform + "/build/*", converter_dir + "/HtmlFileInternal")
    if (0 == platform.find("win")):
      base.delete_file(root_dir + "/HtmlFileInternal/cef_sandbox.lib")
      base.delete_file(root_dir + "/HtmlFileInternal/libcef.lib")

    # js
    js_dir = root_dir
    base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs")
    base.copy_dir(base_dir + "/js/" + branding + "/builder/web-apps", js_dir + "/web-apps")
    
    # plugins
    base.create_dir(js_dir + "/sdkjs-plugins")
    
    # base.copy_dir(plugins_dir + "/clipart", js_dir + "/sdkjs-plugins/clipart")
    base.copy_dir(plugins_dir + "/code", js_dir + "/sdkjs-plugins/code")
    base.copy_dir(plugins_dir + "/macros", js_dir + "/sdkjs-plugins/macros")
    base.copy_dir(plugins_dir + "/ocr", js_dir + "/sdkjs-plugins/ocr")
    base.copy_dir(plugins_dir + "/photoeditor", js_dir + "/sdkjs-plugins/photoeditor")
    base.copy_dir(plugins_dir + "/speech", js_dir + "/sdkjs-plugins/speech")
    base.copy_dir(plugins_dir + "/synonim", js_dir + "/sdkjs-plugins/synonim")
    base.copy_dir(plugins_dir + "/translate", js_dir + "/sdkjs-plugins/translate")
    base.copy_dir(plugins_dir + "/youtube", js_dir + "/sdkjs-plugins/youtube")
    base.copy_file(plugins_dir + "/pluginBase.js", js_dir + "/sdkjs-plugins/pluginBase.js")
    base.copy_file(plugins_dir + "/plugins.css", js_dir + "/sdkjs-plugins/plugins.css")
    
    # tools
    tools_dir = root_dir + "/server/tools"
    base.create_dir(tools_dir)
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, tools_dir, "allfontsgen")
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, tools_dir, "allthemesgen")

    branding_dir = server_dir + "/branding"
    if("" != config.option("branding")):
      branding_dir = git_dir + '/' + config.option("branding") + '/server'

    #dictionaries
    spellchecker_dictionaries = build_server_dir + '/SpellChecker/dictionaries'
    spellchecker_dictionaries_files = server_dir + '/../dictionaries/*_*'
    base.create_dir(spellchecker_dictionaries)
    base.copy_files(spellchecker_dictionaries_files, spellchecker_dictionaries)

    if (0 == platform.find("win")):
      exec_ext = '.exe'
    else:
      exec_ext = ''

    #schema
    schema_files = server_dir + '/schema'
    schema = build_server_dir + '/schema'
    base.create_dir(schema)
    base.copy_dir(schema_files, schema)

    #core-fonts
    core_fonts_files = server_dir + '/../core-fonts'
    core_fonts = build_server_dir + '/../core-fonts'
    base.create_dir(core_fonts)
    base.copy_dir_content(core_fonts_files, core_fonts, "", ".git")

    #license
    license_file1 = server_dir + '/LICENSE.txt'
    license_file2 = server_dir + '/3rd-Party.txt'
    license_dir = server_dir + '/license'
    license = build_server_dir + '/license'
    base.copy_file(license_file1, build_server_dir)
    base.copy_file(license_file2, build_server_dir)
    base.copy_dir(license_dir, license)

    #branding
    welcome_files = branding_dir + '/welcome'
    welcome = build_server_dir + '/welcome'
    base.create_dir(welcome)
    base.copy_dir(welcome_files, welcome)

    info_files = branding_dir + '/info'
    info = build_server_dir + '/info'
    base.create_dir(info)
    base.copy_dir(info_files, info)

    custom_public_key = branding_dir + '/licenseKey.pem'

    if(base.is_exist(custom_public_key)):
      base.copy_file(custom_public_key, build_server_dir + '/Common/sources')

    # example
    build_example_dir = root_dir + '-example'
    bin_example_dir = base.get_script_dir() + "/../../document-server-integration/web/documentserver-example/nodejs"

    base.create_dir(build_example_dir)
    base.copy_exe(bin_example_dir, build_example_dir, "example")
    base.copy_dir(bin_example_dir + "/config", build_example_dir + "/config")

  return