How to use the packit.cli.utils.cover_packit_exception 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 / tests / unit / test_cli_utils.py View on Github external
    @cover_packit_exception(exit_code=5)
    def covered_func():
        raise PackitException("Test exception")
github packit-service / packit / tests / unit / test_cli_utils.py View on Github external
    @cover_packit_exception
    def covered_func():
        raise CustomException("Other test exception")
github packit-service / packit / packit / cli / init.py View on Github external
@cover_packit_exception
def init(path_or_url, force):
    """
    Generate new packit config.
    """

    working_dir = Path(path_or_url.working_dir)
    config_path = get_existing_config(working_dir)
    if config_path:
        if not force:
            raise PackitException(
                f"Packit config {config_path} already exists."
                " If you want to regenerate it use `packit init --force`"
            )
    else:
        # Use default name
        config_path = working_dir / ".packit.yaml"
github packit-service / packit / packit / cli / create_update.py View on Github external
@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(
            koji_builds=koji_build,
github packit-service / packit / packit / cli / status.py View on Github external
@cover_packit_exception
def status(config, path_or_url):
    """
    Display status.

    \b
    - latest downstream pull requests
    - versions from all downstream branches
    - latest upstream releases
    - latest builds in Koji
    - latest builds in Copr
    - latest updates in Bodhi
    """

    api = get_packit_api(config=config, local_project=path_or_url)
    api.status()
github packit-service / packit / packit / cli / sync_from_downstream.py View on Github external
@cover_packit_exception
@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,
github packit-service / packit / packit / cli / push_updates.py View on Github external
@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 / build.py View on Github external
@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
    out of the current checkout and sends it to koji.
github packit-service / packit / packit / cli / local_build.py View on Github external
@cover_packit_exception
def local_build(config, path_or_url, upstream_ref, remote):
    """
    Create RPMs 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)
    rpm_paths = api.create_rpms(upstream_ref=upstream_ref)
    logger.info("RPMs:")
    for path in rpm_paths:
        logger.info(f" * {path}")
github packit-service / packit / packit / cli / update.py View on Github external
@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