diff options
| author | John Estabrook <jestabro@vyos.io> | 2024-12-06 08:48:14 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-06 08:48:14 -0600 |
| commit | 2b979d7fc25793e5be29376a4951375c0bf328d9 (patch) | |
| tree | 815fc2d64f76267a217eadd0a167157b61bd92f8 | |
| parent | 9e4f6c1494fcff64ad22503b704dbdd43347b0a6 (diff) | |
| parent | bd71aa6b728f037ad5d85d9310f3380342714348 (diff) | |
| download | libvyosconfig-2b979d7fc25793e5be29376a4951375c0bf328d9.tar.gz libvyosconfig-2b979d7fc25793e5be29376a4951375c0bf328d9.zip | |
Merge pull request #21 from jestabro/vyconf-minimal
T6718: use the vyconf daemon for validation of set commands
| -rw-r--r-- | Makefile | 2 | ||||
| -rwxr-xr-x | build.sh | 3 | ||||
| -rw-r--r-- | debian/libvyosconfig0.install | 3 | ||||
| -rwxr-xr-x | debian/rules | 14 | ||||
| -rw-r--r-- | lib/bindings.ml | 6 |
5 files changed, 24 insertions, 4 deletions
@@ -61,7 +61,7 @@ $(BUILDDIR)/%.o: %.c $(CC) -c -o $@ -fPIC -I $(shell ocamlfind query ctypes) -I $(OCAMLDIR) -I $(OCAMLDIR)/../ctypes $< $(BUILDDIR)/%.cmx: %.ml - ocamlfind opt -c -o $@ -I $(BUILDDIR)/generated -I $(BUILDDIR)/lib -package $(PACKAGES) $< + ocamlfind opt -c -o $@ -I $(BUILDDIR)/generated -I $(BUILDDIR)/lib -thread -package $(PACKAGES) $< $(GENERATOR): $(GENERATOR_FILES) ocamlfind opt -o $@ -I $(BUILDDIR)/lib -linkpkg -thread -package $(PACKAGES) $^ @@ -2,6 +2,9 @@ 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#acfac8d809 -y' +sudo sh -c 'eval $(opam env --root=/opt/opam --set-root) && opam pin add vyconf https://github.com/vyos/vyconf.git#196fdd7fdf -y' + eval `opam config env` make clean make diff --git a/debian/libvyosconfig0.install b/debian/libvyosconfig0.install index 40b3a73..dbd9fb6 100644 --- a/debian/libvyosconfig0.install +++ b/debian/libvyosconfig0.install @@ -1 +1,4 @@ usr/lib/libvyosconfig.so.0 +usr/share/vyos/vyconf +etc/vyos +usr/libexec/vyos/vyconf diff --git a/debian/rules b/debian/rules index ae59417..8d4a32b 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,11 @@ #!/usr/bin/make -f DIR := debian/tmp +OCAML_DIR := /opt/opam/${OCAML_VERSION} +VYCONF := usr/libexec/vyos/vyconf +VYCONF_CONF := $(VYCONF)/config +VYCONF_DATA := usr/share/vyos/vyconf +VYCONF_DEF := etc/vyos %: dh $@ --with quilt @@ -9,6 +14,15 @@ override_dh_auto_build: ./build.sh $(DIR) override_dh_auto_install: + mkdir -p $(DIR)/$(VYCONF_CONF) + mkdir -p $(DIR)/$(VYCONF_DATA) + mkdir -p $(DIR)/$(VYCONF_DEF) + cp $(OCAML_DIR)/share/vyconf/vyconf.proto $(DIR)/$(VYCONF_DATA) + cp $(OCAML_DIR)/share/vyconf/vyconfd.conf $(DIR)/$(VYCONF_DEF) + cp $(OCAML_DIR)/bin/vyconfd $(DIR)/$(VYCONF) + cp $(OCAML_DIR)/bin/vy_set $(DIR)/$(VYCONF) + cp $(OCAML_DIR)/bin/vy_delete $(DIR)/$(VYCONF) + # mkdir -p $(DIR)/usr/lib cp _build/libvyosconfig.so $(DIR)/usr/lib/libvyosconfig.so.0 dh_makeshlibs diff --git a/lib/bindings.ml b/lib/bindings.ml index 02f606a..052495d 100644 --- a/lib/bindings.ml +++ b/lib/bindings.ml @@ -224,9 +224,9 @@ let tree_union c_ptr_l c_ptr_r = with CD.Nonexistent_child -> error_message := "Nonexistent child"; Ctypes.null -let reference_tree_to_json from_dir to_file = +let reference_tree_to_json internal_cache from_dir to_file = try - Generate.reference_tree_to_json from_dir to_file; 0 + Generate.reference_tree_to_json ~internal_cache:internal_cache from_dir to_file; 0 with | Generate.Load_error msg -> let s = Printf.sprintf "Load_error \'%s\'" msg in @@ -276,6 +276,6 @@ 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 "reference_tree_to_json" (string @-> string @-> returning int) reference_tree_to_json + 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 |
