From 73d0eec02cae106c6b79a5f4c6c42967c829c546 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 11 Jun 2025 11:46:12 -0500 Subject: T7499: bindings for (non-)destructive configtree merge --- lib/bindings.ml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/bindings.ml b/lib/bindings.ml index 604c05f..2d9a5d1 100644 --- a/lib/bindings.ml +++ b/lib/bindings.ml @@ -7,6 +7,7 @@ open Commitd_client module CT = Config_tree module CD = Config_diff +module TA = Tree_alg module CM = Commit module VC = Vycall_client @@ -247,7 +248,18 @@ let tree_union c_ptr_l c_ptr_r = let ct_ret = CD.tree_union ct_l ct_r in Ctypes.Root.create ct_ret with - CD.Nonexistent_child -> error_message := "Nonexistent child"; Ctypes.null + | TA.Nonexistent_child -> error_message := "Nonexistent child"; Ctypes.null + | TA.Incompatible_union -> error_message := "Trees must have equivalent root"; Ctypes.null + +let tree_merge destructive c_ptr_l c_ptr_r = + let ct_l = Root.get c_ptr_l in + let ct_r = Root.get c_ptr_r in + try + let ct_ret = CD.tree_merge ~destructive:destructive ct_l ct_r in + Ctypes.Root.create ct_ret + with + | TA.Nonexistent_child -> error_message := "Nonexistent child"; Ctypes.null + | TA.Incompatible_union -> error_message := "Trees must have equivalent root"; Ctypes.null let reference_tree_to_json internal_cache from_dir to_file = try @@ -304,6 +316,7 @@ struct let () = I.internal "diff_tree" (string @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) diff_tree let () = I.internal "show_diff" (bool @-> string @-> (ptr void) @-> (ptr void) @-> returning string) show_diff let () = I.internal "tree_union" ((ptr void) @-> (ptr void) @-> returning (ptr void)) tree_union + 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 end -- cgit v1.2.3 From 843e2a99276fe7d01d7f1ed64b4a8a923c8ce4cc Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sun, 6 Jul 2025 16:35:57 -0500 Subject: T7499: set permissions on session directory To allow clean up of cache data on Python module exit, set permissions on directory. --- debian/libvyosconfig0.postinst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/libvyosconfig0.postinst b/debian/libvyosconfig0.postinst index 32d09d8..93efa1c 100644 --- a/debian/libvyosconfig0.postinst +++ b/debian/libvyosconfig0.postinst @@ -1 +1,3 @@ ldconfig +chown -R root:vyattacfg /usr/libexec/vyos/vyconf/session +chmod -R 775 /usr/libexec/vyos/vyconf/session -- cgit v1.2.3 From 4dd28075ed44a51a6b5e7a490ce7c6fb9b6a8354 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sun, 6 Jul 2025 18:34:20 -0500 Subject: T7499: update hashes for add destructive merge --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 424c897..40dc49b 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#e1b570dfbdb5703688b445f9d54160754cc2d190 -y' -sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyconf https://github.com/vyos/vyconf.git#30d9df43317ae7395a11c9e8a5414f177cefae79 -y' +sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyos1x-config https://github.com/vyos/vyos1x-config.git#74c67327160d8dffb8d79bf6691852855715d5f8 -y' +sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyconf https://github.com/vyos/vyconf.git#111bfa17c6ab2a983fb22427d55ecf6fd35d4529 -y' eval `opam config env` make clean -- cgit v1.2.3