Exemplo n.º 1
0
def set_multi_version(ver):
    """Add ver to multi_version set and return latest version."""
    global multi_version

    multi_version = config.parse_config_versions(build.download_path)

    if ver:
        # Some build patterns put multiple versions in the same package.
        # For those patterns add to the multi_version list
        if buildpattern.default_pattern in ["godep"]:
            multi_version.add(ver)
        else:
            multi_version = set([ver])
    elif not multi_version:
        # Fall back to ensure a version is always set
        # (otherwise the last known version will be used)
        multi_version = set("1")
    return sorted(multi_version)[-1]
Exemplo n.º 2
0
def process(url_arg, name_arg, ver_arg, target, archives_arg, filemanager):
    """Download and process the tarball at url_arg."""
    global url
    global name
    global version
    global path
    global tarball_prefix
    global archives
    global prefixes
    url = url_arg
    name = name_arg
    version = ver_arg
    archives = archives_arg
    tarfile = os.path.basename(url_arg)
    # determine build pattern and build requirements from url
    detect_build_from_url(url)
    # Create the download path for content and set build.download_path
    create_download_path(target)
    # determine name and version of package
    name, rawname, version = name_and_version(name_arg, ver_arg, filemanager)
    # Store the top-level version
    config.versions[version] = url
    # set gcov file information, must be done after name is set since the gcov
    # name is created by adding ".gcov" to the package name (if a gcov file
    # exists)
    set_gcov()
    # download the tarball to tar_path
    tar_path = check_or_get_file(url, tarfile)
    # determine extract command and tarball prefix for the tarfile
    extract_cmd, tarball_prefix = find_extract(tar_path, tarfile)
    # Store the detected prefix associated with this file
    prefixes[url] = tarball_prefix
    # set global path with tarball_prefix
    path = os.path.join(build.base_path, tarball_prefix)
    # Now that the metadata has been collected print the header
    print_header()
    # write out the Makefile with the name, url, and archives we found
    # prepare directory and extract tarball
    prepare_and_extract(extract_cmd)
    # locate or download archives and move them into the right spot
    process_archives(archives_arg)
    # process any additional versions
    urls = config.parse_config_versions(build.download_path)
    if len(urls) <= 1:
        # This is a single version package
        return
    for extraver in urls:
        extraurl = urls[extraver]
        if not extraurl:
            # Nothing to do here
            continue
        if extraurl == url:
            # This is the same as the SOURCE0 package, which we already handled
            continue
        buildpattern.sources["version"].append(extraurl)
        name, rawname, extraver = name_and_version(name_arg, extraver,
                                                   filemanager)
        # Make sure we don't stick to a single version
        set_multi_version(None)
        tarfile = os.path.basename(extraurl)
        tar_path = check_or_get_file(extraurl, tarfile, mode="a")
        extract_cmd, tarball_prefix = find_extract(tar_path, tarfile)
        prefixes[extraurl] = tarball_prefix
        prepare_and_extract(extract_cmd)