retire: allow specifying custom fedpkg retire message #12224
3 changed files with 18 additions and 10 deletions
|
|
@ -93,7 +93,7 @@ RAWHIDE_RELEASE = dict(
|
|||
"latest-Fedora-Rawhide/compose/Everything/x86_64/os",
|
||||
source_repo="https://kojipkgs.fedoraproject.org/compose/rawhide/"
|
||||
"latest-Fedora-Rawhide/compose/Everything/source/tree/",
|
||||
koji_tag="f41",
|
||||
koji_tag="f42",
|
||||
koji_hub="https://koji.fedoraproject.org/kojihub",
|
||||
pagure_branch="rawhide",
|
||||
mailto="devel@lists.fedoraproject.org",
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ ORPHAN_UID = "orphan"
|
|||
PACKAGE_API_URL = "https://src.fedoraproject.org/api/0/rpms/"
|
||||
BUGZILLA_API_URL = "https://bugzilla.redhat.com"
|
||||
|
||||
DEFAULT_DISTGIT_MESSAGE = "Orphaned for 6+ weeks"
|
||||
TEMPLATE = """Automation has figured out the package is retired in Fedora {}.
|
||||
|
||||
If you like it to be unretired, please open a ticket at
|
||||
|
|
@ -149,15 +150,16 @@ def list_command(args: CLIContext, check: bool) -> None:
|
|||
|
||||
|
||||
def retire_distgit(
|
||||
package: str, directory: str, dry_run: bool, branches: Sequence[str] = ()
|
||||
package: str,
|
||||
directory: str,
|
||||
dry_run: bool,
|
||||
branches: Sequence[str] = (),
|
||||
message: str | None = None,
|
||||
) -> None:
|
||||
if owner := ensure_orphaned(package):
|
||||
click.secho(f"! {package} is owned by {owner}", fg="red", err=True)
|
||||
return
|
||||
dir = os.path.join(directory, package)
|
||||
in_dir = partial(run, dry_run=dry_run, cwd=dir)
|
||||
run(["fedpkg", "clone", package, dir])
|
||||
in_dir(["fedpkg", "retire", "Orphaned for 6+ weeks"])
|
||||
in_dir(["fedpkg", "retire", message or DEFAULT_DISTGIT_MESSAGE])
|
||||
for branch in branches:
|
||||
run(["git", "switch", branch], cwd=dir)
|
||||
in_dir(["git", "merge", "--gpg-sign", "rawhide"])
|
||||
|
|
@ -190,10 +192,14 @@ def retire_bugs(package: str, dry_run: bool, branches: Sequence[str] = ()) -> No
|
|||
|
||||
|
||||
def retire(
|
||||
package: str, directory: str, dry_run: bool, branches: Sequence[str] = ()
|
||||
package: str,
|
||||
directory: str,
|
||||
dry_run: bool,
|
||||
branches: Sequence[str] = (),
|
||||
message: str | None = None,
|
||||
) -> None:
|
||||
click.secho("distgit", bold=True)
|
||||
retire_distgit(package, directory, dry_run, branches)
|
||||
retire_distgit(package, directory, dry_run, branches, message)
|
||||
click.secho("bugzilla", bold=True)
|
||||
retire_bugs(package, dry_run, branches)
|
||||
|
||||
|
|
@ -209,6 +215,7 @@ def retire(
|
|||
help="Append a list of retired packages to a file",
|
||||
type=click.File("a"),
|
||||
)
|
||||
@click.option("--message", help="Message to use for distgit retirement commit")
|
||||
@CHECK_OPT(default=True)
|
||||
@pass_obj
|
||||
def retire_command(
|
||||
|
|
@ -218,6 +225,7 @@ def retire_command(
|
|||
branches: Sequence[str],
|
||||
check: bool,
|
||||
log_file: IO[str] | None,
|
||||
message: str | None,
|
||||
) -> None:
|
||||
"""
|
||||
Retire packages that have been orphaned for over 6 weeks
|
||||
|
|
@ -231,7 +239,7 @@ def retire_command(
|
|||
with cm as workdir:
|
||||
for package in args.package_iter(check):
|
||||
click.secho(f"{package}", underline=True, fg="green")
|
||||
retire(package, workdir, dry_run, branches)
|
||||
retire(package, workdir, dry_run, branches, message)
|
||||
if log_file:
|
||||
log_file.write(f"{package} {now}\n")
|
||||
click.echo()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ skip_install = true
|
|||
deps =
|
||||
ruff
|
||||
commands =
|
||||
ruff {posargs} find_unblocked_orphans.py retire.py
|
||||
ruff check {posargs} find_unblocked_orphans.py retire.py
|
||||
|
||||
[testenv:typing]
|
||||
description = Run type checkers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue