Loading pkgs/by-name/pr/protoc-gen-go-grpc/package.nix +4 −3 Original line number Diff line number Diff line Loading @@ -7,17 +7,17 @@ buildGoModule (finalAttrs: { pname = "protoc-gen-go-grpc"; version = "1.6.0"; version = "1.6.1"; modRoot = "cmd/protoc-gen-go-grpc"; src = fetchFromGitHub { owner = "grpc"; repo = "grpc-go"; rev = "cmd/protoc-gen-go-grpc/v${finalAttrs.version}"; hash = "sha256-Ay8X7NoS81ubMtFMrvQINhGAFV/Yh75AXh7/Y9lCJDo="; hash = "sha256-s6GZ9K0Wy18YF1RBL0RGDCbtCfAV2bskq6DNXwyorgg="; }; vendorHash = "sha256-s26T7pht7YU1LJIM3edtuPb+KVezqG3m+8CxM+l1ty4="; vendorHash = "sha256-+D3prb03c/Vgm+p3CxCZw14UMCvrDc1Cllzn1znZAE0="; ldflags = [ "-s" Loading @@ -27,6 +27,7 @@ buildGoModule (finalAttrs: { passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; }; passthru.updateScript = ./update.py; meta = { description = "Go language implementation of gRPC. HTTP/2 based RPC"; Loading pkgs/by-name/pr/protoc-gen-go-grpc/update.py 0 → 100755 +68 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #! nix-shell -i python -p "python3.withPackages (ps: with ps; [ ps.httpx ])" nix-update import os import re import subprocess import httpx URL = "https://api.github.com/repos/grpc/grpc-go/git/matching-refs/tags/cmd/protoc-gen-go-grpc/v" TAG_RE = re.compile(r"^refs/tags/(cmd/protoc-gen-go-grpc/v(\d+)\.(\d+)\.(\d+))$") def get_latest_tag() -> str: headers = { "Accept": "application/vnd.github+json", } token = os.getenv("GITHUB_TOKEN") if token: headers["Authorization"] = f"Bearer {token}" with httpx.Client(timeout=30.0, follow_redirects=True) as client: response = client.get(URL, headers=headers) response.raise_for_status() refs = response.json() if not isinstance(refs, list): raise RuntimeError("Unexpected response from GitHub API") best_tag = None best_version = None for ref in refs: if not isinstance(ref, dict): continue ref_name = ref.get("ref", "") match = TAG_RE.fullmatch(ref_name) if match is None: continue version = tuple(int(part) for part in match.groups()[1:]) if best_version is None or version > best_version: best_version = version best_tag = match.group(1) if best_tag is None: raise RuntimeError("No matching protoc-gen-go-grpc tags found") return best_tag def main() -> int: latest_tag = get_latest_tag() version = latest_tag.removeprefix("cmd/protoc-gen-go-grpc/v") subprocess.run( [ "nix-update", "protoc-gen-go-grpc", "--version", version, ], check=True, ) return 0 if __name__ == "__main__": raise SystemExit(main()) Loading
pkgs/by-name/pr/protoc-gen-go-grpc/package.nix +4 −3 Original line number Diff line number Diff line Loading @@ -7,17 +7,17 @@ buildGoModule (finalAttrs: { pname = "protoc-gen-go-grpc"; version = "1.6.0"; version = "1.6.1"; modRoot = "cmd/protoc-gen-go-grpc"; src = fetchFromGitHub { owner = "grpc"; repo = "grpc-go"; rev = "cmd/protoc-gen-go-grpc/v${finalAttrs.version}"; hash = "sha256-Ay8X7NoS81ubMtFMrvQINhGAFV/Yh75AXh7/Y9lCJDo="; hash = "sha256-s6GZ9K0Wy18YF1RBL0RGDCbtCfAV2bskq6DNXwyorgg="; }; vendorHash = "sha256-s26T7pht7YU1LJIM3edtuPb+KVezqG3m+8CxM+l1ty4="; vendorHash = "sha256-+D3prb03c/Vgm+p3CxCZw14UMCvrDc1Cllzn1znZAE0="; ldflags = [ "-s" Loading @@ -27,6 +27,7 @@ buildGoModule (finalAttrs: { passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; }; passthru.updateScript = ./update.py; meta = { description = "Go language implementation of gRPC. HTTP/2 based RPC"; Loading
pkgs/by-name/pr/protoc-gen-go-grpc/update.py 0 → 100755 +68 −0 Original line number Diff line number Diff line #!/usr/bin/env nix-shell #! nix-shell -i python -p "python3.withPackages (ps: with ps; [ ps.httpx ])" nix-update import os import re import subprocess import httpx URL = "https://api.github.com/repos/grpc/grpc-go/git/matching-refs/tags/cmd/protoc-gen-go-grpc/v" TAG_RE = re.compile(r"^refs/tags/(cmd/protoc-gen-go-grpc/v(\d+)\.(\d+)\.(\d+))$") def get_latest_tag() -> str: headers = { "Accept": "application/vnd.github+json", } token = os.getenv("GITHUB_TOKEN") if token: headers["Authorization"] = f"Bearer {token}" with httpx.Client(timeout=30.0, follow_redirects=True) as client: response = client.get(URL, headers=headers) response.raise_for_status() refs = response.json() if not isinstance(refs, list): raise RuntimeError("Unexpected response from GitHub API") best_tag = None best_version = None for ref in refs: if not isinstance(ref, dict): continue ref_name = ref.get("ref", "") match = TAG_RE.fullmatch(ref_name) if match is None: continue version = tuple(int(part) for part in match.groups()[1:]) if best_version is None or version > best_version: best_version = version best_tag = match.group(1) if best_tag is None: raise RuntimeError("No matching protoc-gen-go-grpc tags found") return best_tag def main() -> int: latest_tag = get_latest_tag() version = latest_tag.removeprefix("cmd/protoc-gen-go-grpc/v") subprocess.run( [ "nix-update", "protoc-gen-go-grpc", "--version", version, ], check=True, ) return 0 if __name__ == "__main__": raise SystemExit(main())