How to use the build.download_path function in build

To help you get started, we’ve selected a few build examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clearlinux / autospec / tests / test_build.py View on Github external
def test_setup_workingdir(self):
        """
        Test that setup_workingdir sets the correct directory patterns
        """
        build.tarball.name = "testtarball"
        build.setup_workingdir("test_directory")
        self.assertEqual(build.base_path, "test_directory")
        self.assertEqual(build.download_path, "test_directory/testtarball")
github clearlinux / autospec / autospec / autospec.py View on Github external
license.add_license(word)
        except:
            pass
        license.scan_for_licenses(_dir)
        exit(0)

    config.setup_patterns()
    config.config_file = args.config
    config.parse_config_files(build.download_path, args.bump, filemanager)
    config.parse_existing_spec(build.download_path, tarball.name)

    buildreq.set_build_req()
    buildreq.scan_for_configure(_dir)
    specdescription.scan_for_description(name, _dir)
    license.scan_for_licenses(_dir)
    commitmessage.scan_for_changes(build.download_path, _dir)
    add_sources(build.download_path, args.archives)
    test.scan_for_tests(_dir)

    #
    # Now, we have enough to write out a specfile, and try to build it.
    # We will then analyze the build result and learn information until the
    # package builds
    #
    specfile = specfiles.Specfile(tarball.url, tarball.version, tarball.name, tarball.release)
    filemanager.load_specfile(specfile)
    load_specfile(specfile)

    print("\n")

    if args.integrity == True:
        interactive_mode = not args.non_interactive
github clearlinux / autospec / autospec / autospec.py View on Github external
elif os.path.isfile("README.clear"):
        try:
            print("\nREADME.clear CONTENTS")
            print("*********************")
            with open("README.clear", "r") as readme_f:
                print(readme_f.read())

            print("*********************\n")
        except Exception:
            pass

    examine_abi(build.download_path)
    if os.path.exists("/var/lib/rpm"):
        pkg_scan.get_whatrequires(tarball.name)

    write_out(build.download_path + "/release", tarball.release + "\n")

    # record logcheck output
    logcheck(build.download_path)

    commitmessage.guess_commit_message(pkg_integrity.IMPORTED)
    config.create_buildreq_cache(build.download_path, tarball.version)

    if args.git:
        git.commit_to_git(build.download_path)
    else:
        print("To commit your changes, git add the relevant files and "
              "run 'git commit -F commitmsg'")
github clearlinux / autospec / autospec / autospec.py View on Github external
with open("README.clear", "r") as readme_f:
                print(readme_f.read())

            print("*********************\n")
        except:
            pass

    examine_abi(build.download_path)

    with open(build.download_path + "/release", "w") as fp:
        fp.write(tarball.release + "\n")

    commitmessage.guess_commit_message()

    if args.git:
        git.commit_to_git(build.download_path)
github clearlinux / autospec / autospec / autospec.py View on Github external
check_requirements(args.git)
    build.setup_workingdir(workingdir)

    #
    # First, download the tarball, extract it and then do a set
    # of static analysis on the content of the tarball.
    #
    filemanager = files.FileManager()
    tarball.name_and_version(args.url, args.name, args.version, filemanager)
    tarball.download_tarball(args.url, args.name, args.archives, args.target)
    _dir = tarball.path

    if args.license_only:
        try:
            with open(os.path.join(build.download_path,
                      tarball.name + ".license"), "r") as dotlic:
                for word in dotlic.read().split():
                    if word.find(":") < 0:
                        license.add_license(word)
        except:
            pass
        license.scan_for_licenses(_dir)
        exit(0)

    config.setup_patterns()
    config.config_file = args.config
    config.parse_config_files(build.download_path, args.bump, filemanager)
    config.parse_existing_spec(build.download_path, tarball.name)

    buildreq.set_build_req()
    buildreq.scan_for_configure(_dir)
github clearlinux / autospec / autospec / autospec.py View on Github external
specfile = specfiles.Specfile(tarball.url, tarball.version, tarball.name, tarball.release)
    filemanager.load_specfile(specfile)
    load_specfile(specfile)

    print("\n")

    if args.integrity == True:
        interactive_mode = not args.non_interactive
        pkg_integrity.check(args.url, build.download_path, interactive=interactive_mode)
        pkg_integrity.load_specfile(specfile)

    specfile.write_spec(build.download_path)
    while 1:
        build.package(filemanager)
        filemanager.load_specfile(specfile)
        specfile.write_spec(build.download_path)
        filemanager.newfiles_printed = 0
        if build.round > 20 or build.must_restart == 0:
            break

    test.check_regression(build.download_path)

    if build.success == 0:
        print_fatal("Build failed, aborting")
        sys.exit(1)
    elif os.path.isfile("README.clear"):
        try:
            print("\nREADME.clear CONTENTS")
            print("*********************")
            with open("README.clear", "r") as readme_f:
                print(readme_f.read())
github clearlinux / autospec / autospec / autospec.py View on Github external
filemanager.newfiles_printed = 0
        mock_chroot = "/var/lib/mock/clear-{}/root/builddir/build/BUILDROOT/" \
                      "{}-{}-{}.x86_64".format(build.uniqueext,
                                               tarball.name,
                                               tarball.version,
                                               tarball.release)
        if filemanager.clean_directories(mock_chroot):
            # directories added to the blacklist, need to re-run
            build.must_restart += 1

        if build.round > 20 or build.must_restart == 0:
            break

        save_mock_logs(build.download_path, build.round)

    check.check_regression(build.download_path)

    if build.success == 0:
        config.create_buildreq_cache(build.download_path, tarball.version)
        print_fatal("Build failed, aborting")
        sys.exit(1)
    elif os.path.isfile("README.clear"):
        try:
            print("\nREADME.clear CONTENTS")
            print("*********************")
            with open("README.clear", "r") as readme_f:
                print(readme_f.read())

            print("*********************\n")
        except Exception:
            pass
github clearlinux / autospec / autospec / tarball.py View on Github external
def process_go_dependency(url, target):
    """Handle go dependency files."""
    base_url = os.path.dirname(url)
    # Unlink the upstream file to avoid appending existing go artifacts
    try:
        os.unlink(os.path.join(build.download_path, "upstream"))
    except FileNotFoundError:
        pass
    for ver in list(multi_version.keys()):
        get_go_artifacts(base_url, target, ver)
github clearlinux / autospec / autospec / tarball.py View on Github external
def write_upstream(sha, tarfile, mode="w"):
    """Write the upstream hash to the upstream file."""
    write_out(os.path.join(build.download_path, "upstream"),
              os.path.join(sha, tarfile) + "\n", mode=mode)
github clearlinux / autospec / autospec / tarball.py View on Github external
def prepare_and_extract(extract_cmd):
    """Prepare the directory and extract the tarball."""
    shutil.rmtree(os.path.join(build.base_path, name), ignore_errors=True)
    shutil.rmtree(os.path.join(build.base_path, tarball_prefix), ignore_errors=True)
    os.makedirs("{}".format(build.base_path), exist_ok=True)
    call("mkdir -p %s" % build.download_path)
    if isinstance(extract_cmd, list) and buildpattern.default_pattern in ["godep"]:
        for cmd in extract_cmd:
            call(cmd)
    else:
        call(extract_cmd)