Skip to content

Commit

Permalink
Smartly guess the channel considering the architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar authored and makefu committed Oct 7, 2023
1 parent 0e472d1 commit 476e6cc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ usage: hydra-check [options] PACKAGES...
$ hydra-check hello
Build Status for nixpkgs.hello.x86_64-linux on jobset nixos/trunk-combined
✔ hello-2.10 from 2020-03-14 - https://hydra.nixos.org/build/114752982
$ hydra-check hello --arch x86_64-darwin
Build Status for hello.x86_64-darwin on jobset nixpkgs/trunk
✔ hello-2.12.1 from 2023-09-28 - https://hydra.nixos.org/build/236635446


$ hydra-check hello python --channel 19.03
Expand Down
5 changes: 3 additions & 2 deletions src/hydra_check/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def process_args() -> argparse.Namespace:
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent('''\
Other channels can be:
unstable - alias for nixos/trunk-combined (Default)
master - alias for nixpkgs/trunk
unstable - alias for nixos/trunk-combined (Default for Linux architectures)
master - alias for nixpkgs/trunk (Default for Darwin architectures)
staging - alias for nixos/staging
19.03 - alias for nixos/release-19.03
19.09 - alias for nixos/release-19.09
Expand Down Expand Up @@ -53,6 +53,7 @@ def process_args() -> argparse.Namespace:
)
parser.add_argument(
"--channel",
# Sort of changes to "master" when arch is darwin
default="unstable",
help="Channel to check packages for",
)
Expand Down
9 changes: 6 additions & 3 deletions src/hydra_check/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@


# guess functions are intended to be fast without external queries
def guess_jobset(channel: str) -> str:
def guess_jobset(channel: str, arch: str) -> str:
# TODO guess the latest stable channel
match channel:
case "master":
return "nixpkgs/trunk"
case "unstable":
return "nixos/trunk-combined"
if arch.endswith("darwin"):
return "nixpkgs/trunk"
else:
return "nixos/trunk-combined"
case "staging":
return "nixos/staging"
case _:
Expand Down Expand Up @@ -146,7 +149,7 @@ def main() -> None:
channel = args.channel
packages: list[str] = args.PACKAGES
only_url = args.url
jobset = args.jobset or guess_jobset(channel)
jobset = args.jobset or guess_jobset(channel, args.arch)
is_channel = jobset.startswith("nixos/")
as_json = args.json
all_builds = {}
Expand Down

0 comments on commit 476e6cc

Please sign in to comment.