Exemplo n.º 1
0
def build(file = None):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "python --version"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, arch = "all")

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_ver = atm.conf("name_ver")
    name_src = atm.conf("name_src")

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")

    # clones the current repository using the git command and then
    # copies the resulting directory to the result and temporary
    # directories, to be used latter in the build
    atm.git(clean = True)
    atm.copy(repo_f, result_f)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))

    # changes the current directory to the repository one and runs
    # the python tests and source build on it, then copies the
    # resulting source build file to the distribution directory
    os.chdir(repo_f)
    atm.pytest()
    atm.pysdist()
    atm.copy(os.path.join("dist", name_ver + ".zip"), dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()
Exemplo n.º 2
0
def build(file = None, build_m = True, arch = "win32", mode = "Release"):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "msbuild", "capsule test"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, arch = arch)

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")
    build_f = atm.path("build")
    base_f = repo_f
    bin_f = os.path.join(base_f, "bin/viriatum/i386/win32/%s" % mode)
    solution_f = os.path.join(base_f, "win32/vs2008ex")
    modules_f = os.path.join(repo_f, "modules")

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_arc = atm.conf("name_arc")
    name_raw = atm.conf("name_raw")
    name_src = atm.conf("name_src")

    # clones the current repository using the git command and then
    # copies the resulting directory to the temporary directory
    atm.git(clean = True)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))

    # lists the modules directory so that all the modules are
    # discovered (module folder names) this will be used to
    # build the various modules (iteration trigger)
    modules = build_m and os.listdir(modules_f) or []

    # constructs the path to the solution file and uses it for
    # the msbuild command to build the project
    sln_path = os.path.join(solution_f, "viriatum.sln")
    atm.msbuild(sln_path)

    # changes to the binary directory and copies the built files
    # to the result directory
    os.chdir(bin_f)
    atm.copy("viriatum.exe", result_f)
    atm.copy("config", os.path.join(result_f, "config"))
    atm.copy("htdocs", os.path.join(result_f, "htdocs"))

    # constructs the path to the solution file and uses it for
    # the msbuild command to build the project
    mod_sln_path = os.path.join(solution_f, "viriatum_mod.sln")
    build_m and atm.msbuild(mod_sln_path, includes = INCLUDES)

    # iterates over all the modules to copy their resulting files
    # into the appropriate modules directory
    for module in modules:
        module_bin_f = os.path.join(
            base_f,
            "bin/viriatum_%s/i386/win32/%s" % (module, mode)
        )
        os.chdir(module_bin_f)
        atm.copy(
            "viriatum_%s.dll" % module,
            os.path.join(result_f, "modules"),
            replace = False
        )

    # copies the resulting files to the temporary directory with
    # the name of the build for later compression
    atm.copy(result_f, os.path.join(tmp_f, name_arc))

    # changes the current directory to the result directory and
    # creates a tar based file with the binary contents
    os.chdir(result_f)
    atm.tar(name_raw + ".tar", build_m and FILES_M or FILES)
    atm.move(name_raw + ".tar", dist_f)

    # changes to build directory and creates the capsule file for the
    # current configuration, the metadata values will be used from the
    # context that is currently defined
    os.chdir(build_f)
    atm.capsule(
        os.path.join(dist_f, name_arc + ".exe"),
        os.path.join(dist_f, name_raw + ".tar")
    )

    # creates the various compressed files for both the archive and
    # source directories (distribution files)
    os.chdir(tmp_f)
    atm.compress(name_arc, target = dist_f)
    atm.compress(name_src, target = dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()
Exemplo n.º 3
0
def build(file = None):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "python --version"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, arch = "all")

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_ver = atm.conf("name_ver")
    name_arc = atm.conf("name_arc")
    name_raw = atm.conf("name_raw")
    name_src = atm.conf("name_src")

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")
    build_f = atm.path("build")

    # clones the current repository using the git command and then
    # copies the resulting directory to the result and temporary
    # directories, to be used latter in the build
    atm.git(clean = True)
    atm.copy(repo_f, result_f)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))

    # changes the current directory to the repository one and runs
    # the python tests and source build on it, then copies the
    # resulting source build file to the distribution directory
    os.chdir(repo_f)
    atm.pytest()
    atm.pysdist(process = True)
    atm.copy(os.path.join("dist", name_ver + ".zip"), dist_f)

    # changes the current directory to the source directory of the
    # repository and runs the colony container builder then copies
    # the result from it to the distribution folder
    os.chdir(os.path.join(repo_f, "src"))
    atm.colony(descriptor = "container.json")
    atm.move("pt.hive.colony.ccx", dist_f)

    # changes the current directory to the source one in the result
    # directory (contents are considered the "binaries") and then
    # creates a tar file with its contents (contents should be raw)
    os.chdir(os.path.join(result_f, "src"))
    atm.tar(name_raw + ".tar")
    atm.move(name_raw + ".tar", dist_f)

    # changes the current directory to the build one and creates a
    # capsule executable using the "just" created raw tar file, the
    # metadata values will be used from the current context
    os.chdir(build_f)
    atm.capsule(
        os.path.join(dist_f, name_arc + ".exe"),
        os.path.join(dist_f, name_raw + ".tar")
    )

    # creates the various compressed files for both the archive and
    # source directories (distribution files)
    os.chdir(tmp_f)
    atm.compress(name_src, target = dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()
Exemplo n.º 4
0
def build(file = None, build_m = True, cflags = None, cross = None):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "make", "dpkg-deb"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, cross = cross)

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_arc = atm.conf("name_arc")
    name_raw = atm.conf("name_raw")
    name_src = atm.conf("name_src")
    name_deb = name_arc.replace("-", "_")

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")
    target_f = atm.path("target")
    modules_f = os.path.join(repo_f, "modules")
    deb_base_f = os.path.join(target_f, "deb")
    deb_f = os.path.join(deb_base_f, name_deb)
    script_f = os.path.dirname(__file__)
    script_f = os.path.abspath(script_f)

    # clones the current repository using the git command this
    # should retrieve all the source data from the server
    atm.git(clean = True)

    # lists the modules directory so that all the modules are
    # discovered (module folder names) this will be used to
    # build the various modules (iteration trigger)
    modules = build_m and os.listdir(modules_f) or []

    # changes the current directory into the repository one and
    # runs the auto generation process for the creation of the
    # configuration files
    os.chdir(repo_f)
    atm.autogen(clean = True)

    # iterates over all the modules to prepare their source code
    # for compilation distribution
    for module in modules:
        module_f = os.path.join(modules_f, module)
        os.chdir(module_f)
        atm.autogen(clean = True)

    # changes the current directory to the repository one and
    # copies the contents of it into the temporary folder named
    # after the project name, then runs the configuration program
    # and the build process (compilation of the project)
    os.chdir(repo_f)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))
    atm.configure(
        args = (
            "--prefix=" + result_f,
            "--with-wwwroot=" + result_f + "/var/viriatum/www",
            "--enable-defaults"
        ),
        cflags = cflags,
        cross = cross
    )
    atm.make()

    # iterates over each of the modules to run the build process
    # operations for each of them
    for module in modules:
        module_f = os.path.join(modules_f, module)
        os.chdir(module_f)
        atm.configure(
            args = (
                "--prefix=" + result_f,
            ),
            includes = cross and INCLUDES_CROSS or INCLUDES,
            libraries = (result_f + "/lib",),
            cflags = cflags,
            cross = cross
        )
        atm.make()

    # copies the various build resulting files into the appropriate
    # deb associated directories and the resulting binaries into the
    # temporary folder associated with the project
    atm.copy(result_f + "/lib", deb_f + "/usr/lib")
    atm.copy(result_f + "/include", deb_f + "/usr/include")
    atm.copy(result_f + "/bin/viriatum", deb_f + "/usr/sbin")
    atm.copy(result_f + "/etc/viriatum", deb_f + "/etc/viriatum")
    atm.copy(result_f + "/etc/init.d/viriatum", deb_f + "/etc/init.d")
    atm.copy(result_f + "/var/viriatum/www", deb_f + "/var/viriatum/www")
    atm.copy(script_f + "/meta", deb_f + "/DEBIAN")
    atm.copy(result_f, tmp_f + "/" + name_arc)

    # changes the current directory to the deb folder and starts
    # the process of packing the deb file from the files in the
    # folder and then moves the resulting deb file to the distribution
    # based directory
    os.chdir(deb_f)
    atm.deb(
        section = "httpd",
        depends = "libc6",
        size = "1024"
    )
    atm.move(os.path.join(deb_base_f, name_deb + ".deb"), dist_f)

    # changes the current directory to the resulting folder and
    # creates the tar file for it moving it then to the distribution
    # based folder (final place)
    os.chdir(result_f)
    atm.tar(name_raw + ".tar")
    atm.move(name_raw + ".tar", dist_f)

    # creates the various compressed files for both the archive and
    # source directories (distribution files)
    os.chdir(tmp_f)
    atm.compress(name_arc, target = dist_f)
    atm.compress(name_src, target = dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()
Exemplo n.º 5
0
def build(file=None, build_m=True, arch="win32", mode="Release"):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "msbuild", "capsule test"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, arch=arch)

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")
    build_f = atm.path("build")
    base_f = repo_f
    bin_f = os.path.join(base_f, "bin/viriatum/i386/win32/%s" % mode)
    solution_f = os.path.join(base_f, "win32/vs2008ex")
    modules_f = os.path.join(repo_f, "modules")

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_arc = atm.conf("name_arc")
    name_raw = atm.conf("name_raw")
    name_src = atm.conf("name_src")

    # clones the current repository using the git command and then
    # copies the resulting directory to the temporary directory
    atm.git(clean=True)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))

    # lists the modules directory so that all the modules are
    # discovered (module folder names) this will be used to
    # build the various modules (iteration trigger)
    modules = build_m and os.listdir(modules_f) or []

    # constructs the path to the solution file and uses it for
    # the msbuild command to build the project
    sln_path = os.path.join(solution_f, "viriatum.sln")
    atm.msbuild(sln_path)

    # changes to the binary directory and copies the built files
    # to the result directory
    os.chdir(bin_f)
    atm.copy("viriatum.exe", result_f)
    atm.copy("config", os.path.join(result_f, "config"))
    atm.copy("htdocs", os.path.join(result_f, "htdocs"))

    # constructs the path to the solution file and uses it for
    # the msbuild command to build the project
    mod_sln_path = os.path.join(solution_f, "viriatum_mod.sln")
    build_m and atm.msbuild(mod_sln_path, includes=INCLUDES)

    # iterates over all the modules to copy their resulting files
    # into the appropriate modules directory
    for module in modules:
        module_bin_f = os.path.join(
            base_f, "bin/viriatum_%s/i386/win32/%s" % (module, mode))
        os.chdir(module_bin_f)
        atm.copy("viriatum_%s.dll" % module,
                 os.path.join(result_f, "modules"),
                 replace=False)

    # copies the resulting files to the temporary directory with
    # the name of the build for later compression
    atm.copy(result_f, os.path.join(tmp_f, name_arc))

    # changes the current directory to the result directory and
    # creates a tar based file with the binary contents
    os.chdir(result_f)
    atm.tar(name_raw + ".tar", build_m and FILES_M or FILES)
    atm.move(name_raw + ".tar", dist_f)

    # changes to build directory and creates the capsule file for the
    # current configuration, the metadata values will be used from the
    # context that is currently defined
    os.chdir(build_f)
    atm.capsule(os.path.join(dist_f, name_arc + ".exe"),
                os.path.join(dist_f, name_raw + ".tar"))

    # creates the various compressed files for both the archive and
    # source directories (distribution files)
    os.chdir(tmp_f)
    atm.compress(name_arc, target=dist_f)
    atm.compress(name_src, target=dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()
Exemplo n.º 6
0
def build(file=None, build_m=True, cflags=None, cross=None):
    # runs the initial assertion for the various commands
    # that are mandatory for execution, this should avoid
    # errors in the middle of the build
    atm.assert_c(("git", "make", "dpkg-deb"))

    # starts the build process with the configuration file
    # that was provided to the configuration script
    atm.build(file, cross=cross)

    # retrieves the various values from the global configuration
    # that are going to be used around the configuration
    name_arc = atm.conf("name_arc")
    name_raw = atm.conf("name_raw")
    name_src = atm.conf("name_src")
    name_deb = name_arc.replace("-", "_")

    # creates the various paths to the folders to be used
    # for the build operation, from the ones already loaded
    repo_f = atm.path("repo")
    result_f = atm.path("result")
    tmp_f = atm.path("tmp")
    dist_f = atm.path("dist")
    target_f = atm.path("target")
    modules_f = os.path.join(repo_f, "modules")
    deb_base_f = os.path.join(target_f, "deb")
    deb_f = os.path.join(deb_base_f, name_deb)
    script_f = os.path.dirname(__file__)
    script_f = os.path.abspath(script_f)

    # clones the current repository using the git command this
    # should retrieve all the source data from the server
    atm.git(clean=True)

    # lists the modules directory so that all the modules are
    # discovered (module folder names) this will be used to
    # build the various modules (iteration trigger)
    modules = build_m and os.listdir(modules_f) or []

    # changes the current directory into the repository one and
    # runs the auto generation process for the creation of the
    # configuration files
    os.chdir(repo_f)
    atm.autogen(clean=True)

    # iterates over all the modules to prepare their source code
    # for compilation distribution
    for module in modules:
        module_f = os.path.join(modules_f, module)
        os.chdir(module_f)
        atm.autogen(clean=True)

    # changes the current directory to the repository one and
    # copies the contents of it into the temporary folder named
    # after the project name, then runs the configuration program
    # and the build process (compilation of the project)
    os.chdir(repo_f)
    atm.copy(repo_f, os.path.join(tmp_f, name_src))
    atm.configure(args=("--prefix=" + result_f,
                        "--with-wwwroot=" + result_f + "/var/viriatum/www",
                        "--enable-defaults"),
                  cflags=cflags,
                  cross=cross)
    atm.make()

    # iterates over each of the modules to run the build process
    # operations for each of them
    for module in modules:
        module_f = os.path.join(modules_f, module)
        os.chdir(module_f)
        atm.configure(args=("--prefix=" + result_f, ),
                      includes=cross and INCLUDES_CROSS or INCLUDES,
                      libraries=(result_f + "/lib", ),
                      cflags=cflags,
                      cross=cross)
        atm.make()

    # copies the various build resulting files into the appropriate
    # deb associated directories and the resulting binaries into the
    # temporary folder associated with the project
    atm.copy(result_f + "/lib", deb_f + "/usr/lib")
    atm.copy(result_f + "/include", deb_f + "/usr/include")
    atm.copy(result_f + "/bin/viriatum", deb_f + "/usr/sbin")
    atm.copy(result_f + "/etc/viriatum", deb_f + "/etc/viriatum")
    atm.copy(result_f + "/etc/init.d/viriatum", deb_f + "/etc/init.d")
    atm.copy(result_f + "/var/viriatum/www", deb_f + "/var/viriatum/www")
    atm.copy(script_f + "/meta", deb_f + "/DEBIAN")
    atm.copy(result_f, tmp_f + "/" + name_arc)

    # changes the current directory to the deb folder and starts
    # the process of packing the deb file from the files in the
    # folder and then moves the resulting deb file to the distribution
    # based directory
    os.chdir(deb_f)
    atm.deb(section="httpd", depends="libc6", size="1024")
    atm.move(os.path.join(deb_base_f, name_deb + ".deb"), dist_f)

    # changes the current directory to the resulting folder and
    # creates the tar file for it moving it then to the distribution
    # based folder (final place)
    os.chdir(result_f)
    atm.tar(name_raw + ".tar")
    atm.move(name_raw + ".tar", dist_f)

    # creates the various compressed files for both the archive and
    # source directories (distribution files)
    os.chdir(tmp_f)
    atm.compress(name_arc, target=dist_f)
    atm.compress(name_src, target=dist_f)

    # creates the various hash files for the complete set of files in
    # the distribution directory
    os.chdir(dist_f)
    atm.hash_d()