How to use the packit.config.pass_config function in packit

To help you get started, we’ve selected a few packit 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 packit-service / packit / packit / cli / create_update.py View on Github external
@pass_config
@cover_packit_exception
def create_update(
    config, dist_git_branch, koji_build, update_notes, update_type, path_or_url
):
    """
    Create a bodhi update for the selected upstream project

    PATH_OR_URL argument is a local path or a URL to the upstream git repository,
    it defaults to the current working directory
    """
    api = get_packit_api(config=config, local_project=path_or_url)
    branches_to_update = get_branches(*dist_git_branch.split(","), default="master")
    click.echo(f"Syncing from the following branches: {', '.join(branches_to_update)}")

    for branch in branches_to_update:
        api.create_update(
github packit-service / packit / packit / cli / sync_from_downstream.py View on Github external
@pass_config
def sync_from_downstream(
    config,
    dist_git_branch,
    upstream_branch,
    no_pr,
    path_or_url,
    fork,
    remote,
    exclude,
    force,
):
    """
    Copy synced files from Fedora dist-git into upstream by opening a pull request.

    PATH_OR_URL argument is a local path or a URL to the upstream git repository,
    it defaults to the current working directory
github packit-service / packit / packit / cli / srpm.py View on Github external
@pass_config
@cover_packit_exception
def srpm(
    config,
    output,
    path_or_url,
    upstream_ref,
    remote,  # click introspects this in LocalProjectParameter
):
    """
    Create new SRPM (.src.rpm file) using content of the upstream repository.

    PATH_OR_URL argument is a local path or a URL to the upstream git repository,
    it defaults to the current working directory
    """
    api = get_packit_api(config=config, local_project=path_or_url)
    srpm_path = api.create_srpm(output_file=output, upstream_ref=upstream_ref)
github packit-service / packit / packit / cli / sourcegit_to_srpm.py View on Github external
@pass_config
@cover_packit_exception
def sg2srpm(config, dest_dir, upstream_ref, version, repo):
    """
    Generate a srpm from packit.

    This script is meant to accept a source git repo with a branch as an input and produce a SRPM.

    It is expected to do this:

    1. clone the repo

    2. create archive out of the sources

    3. create SRPM
    """
    """
github packit-service / packit / packit / cli / update.py View on Github external
@pass_config
@cover_packit_exception
def update(
    config,
    dist_git_path,
    dist_git_branch,
    force_new_sources,
    no_pr,
    local_content,
    path_or_url,
    upstream_ref,
    version,
    remote,  # click introspects this in LocalProjectParameter
    force,
):
    """
    Release current upstream release into Fedora
github packit-service / packit / packit / cli / copr_build.py View on Github external
@pass_config
@cover_packit_exception
def copr_build(
    config,
    nowait,
    owner,
    project,
    targets,
    description,
    instructions,
    list_on_homepage,
    preserve_project,
    upstream_ref,
    additional_repos,
    path_or_url,
):
    """
github packit-service / packit / packit / cli / push_updates.py View on Github external
@pass_config
@cover_packit_exception
def push_updates(update_alias, config, path_or_url):
    """
    Find all Bodhi updates that have been in testing for more than 'Stable days' (7 by default)
    and push them to stable.

    """
    api = get_packit_api(config=config, local_project=path_or_url)
    api.push_updates(update_alias)
github packit-service / packit / packit / cli / watch_fedora_ci.py View on Github external
@pass_config
@cover_packit_exception
def watcher(config, message_id):
    """
    Watch for flags on PRs: try to process those which we know mapping for

    :return: int, retcode
    """
    api = PackitAPI(config)

    if message_id:
        for msg_id in message_id:
            fedmsg_dict = api.fetch_fedmsg_dict(msg_id)
            api.process_ci_result(fedmsg_dict)
            return
    else:
        api.keep_fwding_ci_results()
github packit-service / packit / packit / cli / sourcegit_to_dist_git.py View on Github external
@pass_config
@cover_packit_exception
def sg2dg(config, dest_dir, no_new_sources, upstream_ref, version, repo):
    """
    Convert source-git repo to dist-git repo.

    1. Create tarball from the source git repo.

    2. Create patches from the downstream commits.

    3. Copy the redhat/ dir to the dist-git.

    4. Take the tarball and upload it to lookaside cache.

    5. The output is the directory (= dirty git repo)
    """
    """
github packit-service / packit / packit / cli / build.py View on Github external
@pass_config
@cover_packit_exception
def build(
    config,
    dist_git_path,
    dist_git_branch,
    from_upstream,
    scratch,
    nowait,
    path_or_url,
    koji_target,
):
    """
    Build selected upstream project in Fedora.

    By default, packit checks out the respective dist-git repository and performs
    `fedpkg build` for the selected branch. With `--from-upstream`, packit creates a SRPM