Skip to content

Commit

Permalink
Show --skip-package (and friends) in the report
Browse files Browse the repository at this point in the history
  • Loading branch information
PerchunPak committed Feb 2, 2025
1 parent e0c47a9 commit 840fbc7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 21 additions & 2 deletions nixpkgs_review/report.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import os
from re import Pattern
from struct import pack
import subprocess
from collections.abc import Callable
from pathlib import Path
Expand Down Expand Up @@ -150,6 +152,9 @@ def __init__(
attrs_per_system: dict[str, list[Attr]],
extra_nixpkgs_config: str,
only_packages: set[str],
package_regex: list[Pattern[str]],
skip_packages: set[str],
skip_packages_regex: list[Pattern[str]],
show_header: bool = True,
*,
checkout: Literal["merge", "commit"] = "merge",
Expand All @@ -158,6 +163,9 @@ def __init__(
self.attrs = attrs_per_system
self.checkout = checkout
self.only_packages = only_packages
self.package_regex = [r.pattern for r in package_regex]
self.skip_packages = skip_packages
self.skip_packages_regex = [r.pattern for r in skip_packages_regex]

if extra_nixpkgs_config != "{ }":
self.extra_nixpkgs_config: str | None = extra_nixpkgs_config
Expand Down Expand Up @@ -193,6 +201,9 @@ def json(self, pr: int | None) -> str:
"checkout": self.checkout,
"extra-nixpkgs-config": self.extra_nixpkgs_config,
"only_packages": list(self.only_packages),
"package_regex": list(self.package_regex),
"skip_packages": list(self.skip_packages),
"skip_packages_regex": list(self.skip_packages_regex),
"result": {
system: report.serialize()
for system, report in self.system_reports.items()
Expand All @@ -215,8 +226,16 @@ def markdown(self, pr: int | None) -> str:
cmd += f" --extra-nixpkgs-config '{self.extra_nixpkgs_config}'"
if self.checkout != "merge":
cmd += f" --checkout {self.checkout}"
if self.only_packages:
cmd += " --package " + " --package ".join(self.only_packages)
for option_name, option_value in {
"package": self.only_packages,
"package-regex": self.package_regex,
"skip-package": self.skip_packages,
"skip-package-regex": self.skip_packages_regex,
}.items():
if option_value:
cmd += f" --{option_name} " + f" --{option_name} ".join(
option_value
)
msg += f"Command: `{cmd}`\n"

for system, report in self.system_reports.items():
Expand Down
3 changes: 3 additions & 0 deletions nixpkgs_review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ def start_review(
self.extra_nixpkgs_config,
checkout=self.checkout.name.lower(), # type: ignore[arg-type]
only_packages=self.only_packages,
package_regex=self.package_regex,
skip_packages=self.skip_packages,
skip_packages_regex=self.skip_packages_regex,
show_header=self.show_header,
)
report.print_console(pr)
Expand Down

0 comments on commit 840fbc7

Please sign in to comment.