Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cover_packit_exception(exit_code=5)
def covered_func():
raise PackitException("Test exception")
@cover_packit_exception
def covered_func():
raise CustomException("Other test exception")
@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"
@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,
@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()
@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,
@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)
@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.
@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}")
@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