示例#1
0
def create_packages_unix():
    global THIS_SYSTEM
    global ALUSUS_ROOT
    global PACKAGES_PATH
    global ARCHITECTURE
    global PACKAGE_NAME
    global PACKAGE_DESCRIPTION
    global PACKAGE_URL
    global PACKAGE_MAINTAINER
    global RELEASE_INSTALL_PATH
    global INSTALL_PATH

    old_path = os.path.realpath(os.getcwd())
    os.chdir(PACKAGES_PATH)

    input_type = "dir"
    version, revision, _, _ = get_version_info()
    after_install_script = os.path.join(ALUSUS_ROOT, "Tools", "BuildSrc",
                                        "Package_Scripts", "post_install.sh")
    after_remove_script = os.path.join(ALUSUS_ROOT, "Tools", "BuildSrc",
                                       "Package_Scripts", "post_remove.sh")

    current_cmd = [
        "fpm", "-s", input_type, "-t",
        "deb" if THIS_SYSTEM == "Linux" else "osxpkg", "-a", ARCHITECTURE,
        "-n", PACKAGE_NAME, "-v", version, "--description",
        PACKAGE_DESCRIPTION, "--url", PACKAGE_URL, "-m", PACKAGE_MAINTAINER,
        "--after-install", after_install_script, "--after-remove",
        after_remove_script, "-f", "--prefix", RELEASE_INSTALL_PATH, "-C",
        INSTALL_PATH
    ]

    if revision != "":
        # Insert just before "--description".
        idx = current_cmd.index("--description")
        current_cmd.insert(idx, revision)
        current_cmd.insert(idx, "--iteration")

    ret = subprocess.call(current_cmd)
    if ret != 0:
        failMsg("Creating {} Package.".format("DEB" if THIS_SYSTEM ==
                                              "Linux" else "OSXPKG"))
        exit(1)

    # Create additional package of type RPM for Linux systems.
    if THIS_SYSTEM == "Linux":
        # Replace "deb" with "rpm".
        current_cmd[current_cmd.index("-t") + 1] = "rpm"

        ret = subprocess.call(current_cmd)
        if ret != 0:
            failMsg("Creating RPM Package.")
            exit(1)

    os.chdir(old_path)
示例#2
0
文件: build.py 项目: xlmnxp/Alusus
def create_zip():
    global ALUSUS_ROOT
    global PACKAGES_PATH
    global ARCHITECTURE
    global PACKAGE_NAME
    global PACKAGE_DESCRIPTION
    global PACKAGE_URL
    global PACKAGE_MAINTAINER
    global RELEASE_INSTALL_PATH
    global INSTALL_PATH

    old_path = os.path.realpath(os.getcwd())
    os.chdir(BUILDS_PATH)

    subprocess.call(["rm", "-rf", "Alusus"])
    shutil.copytree(INSTALL_PATH, "Alusus", True)

    if is_linux():
        postfix = "linux"
    else:
        postfix = "macos"

    version, revision, _, _ = get_version_info()

    if revision != "":
        filename = "alusus_" + version + "-" + revision + "_x86_64_" + postfix + ".zip"
    else:
        filename = "alusus_" + version + "_x86_64_" + postfix + ".zip"

    current_cmd = [
        "zip", "--symlinks", "-r",
        os.path.join(PACKAGES_PATH, filename), "Alusus/"
    ]
    ret = subprocess.call(current_cmd)
    if ret != 0:
        failMsg("Creating Zip Package.")
        exit(1)

    os.chdir(old_path)