about summary refs log tree commit diff
path: root/pkgs/development/tools/parsing/tree-sitter/update.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-09-12 16:25:42 +0200
committerProfpatsch <mail@profpatsch.de>2022-11-04 18:14:33 +0100
commita953387d22f56bc62c67b14cbdfca846f1eef69f (patch)
treec631c73d1c7335deb7d74f73b4a70d586e6b90ee /pkgs/development/tools/parsing/tree-sitter/update.nix
parent923975a604e5de29106dfe349dc5b6576b6045b6 (diff)
tree-sitter/update: move checkTreeSitterRepos into python impl
Direct translation of the jq set logic.
Diffstat (limited to 'pkgs/development/tools/parsing/tree-sitter/update.nix')
-rw-r--r--pkgs/development/tools/parsing/tree-sitter/update.nix23
1 files changed, 5 insertions, 18 deletions
diff --git a/pkgs/development/tools/parsing/tree-sitter/update.nix b/pkgs/development/tools/parsing/tree-sitter/update.nix
index a51208a5bfde7..17b13bad8b0a6 100644
--- a/pkgs/development/tools/parsing/tree-sitter/update.nix
+++ b/pkgs/development/tools/parsing/tree-sitter/update.nix
@@ -6,9 +6,7 @@
 , lib
 , coreutils
 , curl
-, jq
 , xe
-, src
 }:
 
 # Grammar list:
@@ -389,21 +387,6 @@ let
 
   jsonFile = name: val: (formats.json { }).generate name val;
 
-  # check the tree-sitter orga repos
-  checkTreeSitterRepos = writeShellScript "get-grammars.sh" ''
-    set -euo pipefail
-    res=$(${jq}/bin/jq \
-      --slurpfile known "${knownTreeSitterOrgGrammarReposJson}" \
-      --slurpfile ignore "${ignoredTreeSitterOrgReposJson}" \
-      '. - ($known[0] + $ignore[0])' \
-      )
-    if [ ! "$res" == "[]" ]; then
-      echo "These repositories are neither known nor ignored:" 1>&2
-      echo "$res" 1>&2
-      exit 1
-    fi
-  '';
-
   # implementation of the fetching of repo information from github
   fetchImpl = passArgs "fetchImpl-with-args" {
       binaries = {
@@ -411,6 +394,10 @@ let
         nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git";
         inherit atomically-write;
       };
+      inherit
+        knownTreeSitterOrgGrammarRepos
+        ignoredTreeSitterOrgRepos
+        ;
     }
     (writers.writePython3 "fetchImpl" {
         flakeIgnore = ["E501"];
@@ -443,7 +430,7 @@ let
     echo "fetching list of grammars" 1>&2
     treeSitterRepos=$(${fetchImpl} fetch-orga-latest-repos '{"orga": "tree-sitter"}')
     echo "checking the tree-sitter repo list against the grammars we know" 1>&2
-    printf '%s' "$treeSitterRepos" | ${checkTreeSitterRepos}
+    printf '%s' "$treeSitterRepos" | ${fetchImpl} check-tree-sitter-repos '{}'
     echo "writing files to ${outputDir}" 1>&2
     mkdir -p "${outputDir}"
     ${forEachParallel