diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-05-05 19:38:06 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-05-05 19:49:23 +0300 |
commit | f5b955018af5715bdd72ce6b094bf901be2d8ced (patch) | |
tree | a333a6834858f9e4f30e211522bdc0af8a9f3bff | |
parent | start work on 0.2.8 (diff) | |
download | pkgdev-f5b955018af5715bdd72ce6b094bf901be2d8ced.tar.gz pkgdev-f5b955018af5715bdd72ce6b094bf901be2d8ced.tar.bz2 pkgdev-f5b955018af5715bdd72ce6b094bf901be2d8ced.zip |
bugs: add support for passing root blocker
Add option to pass `--blocks [bug_no]`. The "root" bugs (those
corresponding to the starting nodes, those packages passed as args)
will be created and block the passed bug. You can pass multiple bugs
to block, separated by comma.
Resolves: https://github.com/pkgcore/pkgdev/issues/139
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r-- | data/share/bash-completion/completions/pkgdev | 3 | ||||
-rw-r--r-- | src/pkgdev/scripts/pkgdev_bugs.py | 24 |
2 files changed, 22 insertions, 5 deletions
diff --git a/data/share/bash-completion/completions/pkgdev b/data/share/bash-completion/completions/pkgdev index 223a7d9..7cc6df2 100644 --- a/data/share/bash-completion/completions/pkgdev +++ b/data/share/bash-completion/completions/pkgdev @@ -234,13 +234,14 @@ _pkgdev() { subcmd_options=" --api-key --auto-cc-arches + --blocks --dot -s --stablereq -k --keywording " case "${prev}" in - --api-key | --auto-cc-arches) + --api-key | --auto-cc-arches | --blocks) COMPREPLY=() ;; --dot) diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py index 98d84f9..8c79ac6 100644 --- a/src/pkgdev/scripts/pkgdev_bugs.py +++ b/src/pkgdev/scripts/pkgdev_bugs.py @@ -67,6 +67,18 @@ bugs.add_argument( package is maintainer-needed, always add CC-ARCHES. """, ) +bugs.add_argument( + "--blocks", + metavar="BUG", + action=arghparse.CommaSeparatedValuesAppend, + default=[], + help="bugs which should be blocked by newly created bugs", + docs=""" + Collection of bug ids which should be blocked by newly created bugs. + Only bugs created for passed targets would be blockers, excluding other + bugs which were created as dependencies. + """, +) bugs.add_argument( "--cache", @@ -183,7 +195,9 @@ class GraphNode: keywords.clear() keywords.add("*") - def file_bug(self, api_key: str, auto_cc_arches: frozenset[str], observer=None) -> int: + def file_bug( + self, api_key: str, auto_cc_arches: frozenset[str], block_bugs: list[int], observer=None + ) -> int: if self.bugno is not None: return self.bugno for dep in self.edges: @@ -211,6 +225,7 @@ class GraphNode: assigned_to=maintainers[0], cc=maintainers[1:], depends_on=list({dep.bugno for dep in self.edges}), + blocks=block_bugs, ) request = urllib.Request( url="https://bugs.gentoo.org/rest/bug", @@ -446,7 +461,7 @@ class DependencyGraph: ) break - def file_bugs(self, api_key: str, auto_cc_arches: frozenset[str]): + def file_bugs(self, api_key: str, auto_cc_arches: frozenset[str], block_bugs: list[int]): def observe(node: GraphNode): self.out.write( f"https://bugs.gentoo.org/{node.bugno} ", @@ -457,7 +472,7 @@ class DependencyGraph: self.out.flush() for node in self.starting_nodes: - node.file_bug(api_key, auto_cc_arches, observe) + node.file_bug(api_key, auto_cc_arches, block_bugs, observe) def _load_from_stdin(out: Formatter, err: Formatter): @@ -510,4 +525,5 @@ def main(options, out: Formatter, err: Formatter): return 1 disabled, enabled = options.auto_cc_arches - d.file_bugs(options.api_key, frozenset(enabled).difference(disabled)) + blocks = list(frozenset(map(int, options.blocks))) + d.file_bugs(options.api_key, frozenset(enabled).difference(disabled), blocks) |