pkgcore.bugzilla.changes module

Typed payloads for creating and updating bugs.

Bugzilla mutates list valued fields through an {"add": [...], "remove": [...]} object, and silently ignores anything it doesn’t recognise, so a misspelt key like cc_add is accepted and does nothing. ListChange and the frozen payload classes here make that shape the only one expressible.

class pkgcore.bugzilla.changes.BugUpdate(*, status: Status | None = None, resolution: Resolution | None = None, dupe_of: BugId | None = None, summary: str | None = None, assigned_to: str | None = None, whiteboard: str | None = None, deadline: date | None = None, cc: ListChange[str] = ListChange(add=(), remove=(), replace=None), keywords: ListChange[str] = ListChange(add=(), remove=(), replace=None), blocks: ListChange[BugId] = ListChange(add=(), remove=(), replace=None), depends_on: ListChange[BugId] = ListChange(add=(), remove=(), replace=None), see_also: ListChange[str] = ListChange(add=(), remove=(), replace=None), groups: ListChange[str] = ListChange(add=(), remove=(), replace=None), flags: tuple[FlagChange, ...] = (), comment: NewComment | None = None, package_list: PackageList | None = None, runtime_testing_required: RuntimeTesting | None = None)[source]

Bases: object

A patch to apply to one or more bugs.

Every field defaults to leaving the bug alone. List valued fields only accept a ListChange, so the cc_add shape Bugzilla ignores is both a static and a runtime error.

assigned_to: str | None
blocks: ListChange[BugId]
cc: ListChange[str]
comment: NewComment | None
deadline: date | None
depends_on: ListChange[BugId]
dupe_of: BugId | None
flags: tuple[FlagChange, ...]
groups: ListChange[str]
keywords: ListChange[str]
classmethod obsoleted_by(bug: BugId | int, **kwargs: Any) BugUpdate[source]

Close as OBSOLETE, pointing at the bug that supersedes this one

package_list: PackageList | None
resolution: Resolution | None
classmethod resolve(resolution: Resolution = Resolution.FIXED, *, comment: str | None = None, **kwargs: Any) BugUpdate[source]
runtime_testing_required: RuntimeTesting | None
classmethod sanity_check(status: bool | None, *, comment: str | None = None, **kwargs: Any) BugUpdate[source]

Set the sanity-check flag, None clearing it

see_also: ListChange[str]
status: Status | None
summary: str | None
to_wire(ids: Sequence[BugId | int]) RawBugUpdate[source]

Render the payload.

The complete id list is always sent, since Bugzilla lets the body override the id in the request path rather than the other way around.

whiteboard: str | None
class pkgcore.bugzilla.changes.FlagChange(name: str, status: FlagStatus, requestee: str | None = None)[source]

Bases: object

Set or clear a flag

name: str
requestee: str | None
status: FlagStatus
to_wire() RawFlagChange[source]
class pkgcore.bugzilla.changes.ListChange(add: tuple[T, ...] = (), remove: tuple[T, ...] = (), replace: tuple[T, ...] | None = None)[source]

Bases: Generic

An add/remove/set mutation of a list valued field

add: tuple[T, ...]
classmethod adding(*values: T) ListChange[T][source]
remove: tuple[T, ...]
classmethod removing(*values: T) ListChange[T][source]
replace: tuple[T, ...] | None
classmethod setting(*values: T) ListChange[T][source]

Replace the field wholesale, Bugzilla’s set

to_wire() RawListChange[source]
class pkgcore.bugzilla.changes.NewBug(*, summary: str, description: str, component: Component | str, product: Product | str = Product.GENTOO_LINUX, version: str = 'unspecified', severity: Severity | str = Severity.NORMAL, assigned_to: str | None = None, cc: tuple[str, ...] = (), keywords: tuple[str, ...] = (), depends_on: tuple[BugId, ...] = (), blocks: tuple[BugId, ...] = (), see_also: tuple[str, ...] = (), deadline: date | None = None, package_list: PackageList | None = None, runtime_testing_required: RuntimeTesting | None = None)[source]

Bases: object

A bug to file

classmethod arch_request(category: BugCategory, package_list: PackageList, *, maintainers: Sequence[str] = (), cc_arches: bool = False, summary: str | None = None, description: str | None = None, **kwargs: Any) NewBug[source]

A keywordreq or stablereq, with the bgo conventions applied

assigned_to: str | None
blocks: tuple[BugId, ...]
cc: tuple[str, ...]
component: Component | str
deadline: date | None
depends_on: tuple[BugId, ...]
description: str
keywords: tuple[str, ...]
package_list: PackageList | None
classmethod package_mask(summary: str, description: str, *, rites: int, maintainers: Sequence[str] = (), today: date | None = None, **kwargs: Any) NewBug[source]

A last rites tracker, masked for rites days

product: Product | str
runtime_testing_required: RuntimeTesting | None
see_also: tuple[str, ...]
severity: Severity | str
summary: str
to_wire() RawNewBug[source]
version: str
class pkgcore.bugzilla.changes.NewComment(body: str, is_private: bool = False)[source]

Bases: object

A comment to leave alongside an update

body: str
is_private: bool
to_wire() RawNewComment[source]
classmethod truncated(body: str, limit: int = 65535, **kwargs: Any) NewComment[source]

Build a comment, cutting an overlong body on a line boundary

pkgcore.bugzilla.changes.summarise(package_list: PackageList, category: BugCategory) str[source]

Build the conventional summary for an arch team request