summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-08-19 08:56:38 -0500
committerGitHub <noreply@github.com>2025-08-19 08:56:38 -0500
commita3f0fbb07cfcab9e178fb542c3726d952a103247 (patch)
tree8d0b130644af64387483a515323c18c036b85fa4
parentd0c3b937497cc1132a485372c85ab189653c202f (diff)
parentbc1521214f82dfeb5aa28f57530c06f381b2c7ae (diff)
downloadvyos-1x-a3f0fbb07cfcab9e178fb542c3726d952a103247.tar.gz
vyos-1x-a3f0fbb07cfcab9e178fb542c3726d952a103247.zip
Merge pull request #48 from jestabro/validate-tree
T7718: add binding for validate_tree_filter
-rwxr-xr-xbuild.sh4
-rw-r--r--lib/bindings.ml16
2 files changed, 18 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 0ee7c62a2..b5cd65222 100755
--- a/build.sh
+++ b/build.sh
@@ -2,8 +2,8 @@
DIR=$1
-sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyos1x-config https://github.com/vyos/vyos1x-config.git#868b906e8af275a7121b59bb186c06602e9d8af4 -y'
-sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyconf https://github.com/vyos/vyconf.git#29e73893a0fc942a96abc06dfa037afd71778d27 -y'
+sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyos1x-config https://github.com/vyos/vyos1x-config.git#b53326dce7dd2dabad2677ad82de4fcd4ea85524 -y'
+sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyconf https://github.com/vyos/vyconf.git#88d926d30b4219c50bbb1167ab58d60c5c5d2bbb -y'
eval `opam config env`
make clean
diff --git a/lib/bindings.ml b/lib/bindings.ml
index 2d9a5d16b..2b222fb0b 100644
--- a/lib/bindings.ml
+++ b/lib/bindings.ml
@@ -7,11 +7,13 @@ open Commitd_client
module CT = Config_tree
module CD = Config_diff
+module RT = Reference_tree
module TA = Tree_alg
module CM = Commit
module VC = Vycall_client
module I = Internal.Make(Config_tree)
+module IR = Internal.Make(Reference_tree)
let error_message = ref ""
@@ -282,6 +284,19 @@ let mask_tree c_ptr_l c_ptr_r =
| CD.Incommensurable -> error_message := "Incommensurable"; Ctypes.null
| CD.Empty_comparison -> error_message := "Empty comparison"; Ctypes.null
+let validate_tree_filter c_ptr rt_cache_path validator_dir =
+ let ct = Root.get c_ptr in
+ try
+ let rt = IR.read_internal rt_cache_path
+ in
+ let ct_ret, out =
+ RT.validate_tree_filter validator_dir rt ct
+ in
+ error_message := out; Ctypes.Root.create ct_ret
+ with Internal.Read_error msg ->
+ error_message := msg; c_ptr
+
+
module Stubs(I : Cstubs_inverted.INTERNAL) =
struct
@@ -319,4 +334,5 @@ struct
let () = I.internal "tree_merge" (bool @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) tree_merge
let () = I.internal "reference_tree_to_json" (string @-> string @-> string @-> returning int) reference_tree_to_json
let () = I.internal "mask_tree" ((ptr void) @-> (ptr void) @-> returning (ptr void)) mask_tree
+ let () = I.internal "validate_tree_filter" ((ptr void) @-> string @-> string @-> returning (ptr void)) validate_tree_filter
end