From 476e6cc9c55a8cbe06914f45d992a94fd9ac7e47 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 4 Oct 2023 10:01:48 +0300 Subject: [PATCH] Smartly guess the channel considering the architecture --- README.md | 3 +++ src/hydra_check/arguments.py | 5 +++-- src/hydra_check/cli.py | 9 ++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f6f8ddb..cbb10e3 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/hydra_check/arguments.py b/src/hydra_check/arguments.py index c80dc73..de2c055 100644 --- a/src/hydra_check/arguments.py +++ b/src/hydra_check/arguments.py @@ -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 @@ -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", ) diff --git a/src/hydra_check/cli.py b/src/hydra_check/cli.py index 792458c..e51e0e9 100755 --- a/src/hydra_check/cli.py +++ b/src/hydra_check/cli.py @@ -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 _: @@ -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 = {}