pkgcore.bugzilla.pkglist module¶
Parsing and rewriting of the cf_stabilisation_atoms bug field.
The field is a newline separated list of <package spec> [keyword...] lines,
with # comments and three keyword sentinels: * expands to the keywords
suggested for that package, ^ repeats the previous line’s keywords, and
- marks a line as deliberately having none.
PackageList keeps the original text and rewrites only the lines it has
to, so indentation and comments on untouched lines survive a round trip.
- class pkgcore.bugzilla.pkglist.PackageList(text: str = '', *, bug_id: BugId | None = None)[source]¶
Bases:
SimpleA lazily parsed view of a bug’s package list.
Parsing is deferred so fetching a bug with a malformed list never fails; only code that looks at the list does.
- bug_id¶
- classmethod build(entries: Iterable[tuple[atom, Iterable[str]]]) PackageList[source]¶
Construct a fresh list from atoms and their keywords
- entries¶
Every line of the list, blanks and comments included
- expand(suggest: Callable[[atom], Sequence[str]]) PackageList[source]¶
Resolve the
*and^sentinels.suggestreturns the keywords a package should be requested for, in the order they should be written; returning nothing collapses the line to-.- Raises:
PackageListError – on
^with nothing above it to copy
- text¶
- class pkgcore.bugzilla.pkglist.PackageListEntry(lineno: int, raw: str, pkg: atom | None, keywords: tuple[str, ...] = (), comment: str = '', eol: str = '')[source]¶
Bases:
objectA single line of a package list
- with_keywords(keywords: Iterable[str]) PackageListEntry[source]¶
Return a copy with new keywords, keeping indentation and comment
- pkgcore.bugzilla.pkglist.parse_atom(token: str) atom[source]¶
Parse a package list token into an atom.
Stabilization lines carry a bare
cat/pkg-1.2.3rather than the=cat/pkg-1.2.3an atom needs, so the versioned form is tried first.- Raises:
MalformedAtom – if the token isn’t a usable package spec