From 731195c7adb21208767199f5487dfdf29ce09380 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 4 Mar 2025 16:02:41 +0100 Subject: [PATCH] T5400: add local build of libvyosconfig to Makefile libvyosconfig is both a build and a run dependency of vyos-1x. Satisfying the build dependency within the Docker image requires coordination of updates to vyos-build/libvyosconfig/vyos-1x on any changes to the library; simplify this process by moving the build to a step of the vyos-1x Makefile. --- Makefile | 15 +++++++++++++-- debian/control | 1 - python/vyos/configtree.py | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b5d114e59a..e194b6d2cd 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ CFLAGS := BUILD_ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH) J2LINT := $(shell command -v j2lint 2> /dev/null) PYLINT_FILES := $(shell git ls-files *.py src/migration-scripts) +LIBVYOSCONFIG_BUILD_PATH := /tmp/libvyosconfig/_build/libvyosconfig.so config_xml_src = $(wildcard interface-definitions/*.xml.in) config_xml_obj = $(config_xml_src:.xml.in=.xml) @@ -19,9 +20,19 @@ op_xml_obj = $(op_xml_src:.xml.in=.xml) mkdir -p $(BUILD_DIR)/$(dir $@) $(CURDIR)/scripts/transclude-template $< > $(BUILD_DIR)/$@ +.PHONY: libvyosconfig +.ONESHELL: +libvyosconfig: + if ! [ -f $(LIBVYOSCONFIG_BUILD_PATH) ]; then + git clone https://github.com/vyos/libvyosconfig.git /tmp/libvyosconfig || exit 1 + cd /tmp/libvyosconfig && \ + git checkout 677d1e2bf8109b9fd4da60e20376f992b747e384 || exit 1 + ./build.sh + fi + .PHONY: interface_definitions .ONESHELL: -interface_definitions: $(config_xml_obj) +interface_definitions: $(config_xml_obj) libvyosconfig mkdir -p $(TMPL_DIR) $(CURDIR)/scripts/override-default $(BUILD_DIR)/interface-definitions @@ -75,7 +86,7 @@ vyshim: $(MAKE) -C $(SHIM_DIR) .PHONY: all -all: clean interface_definitions op_mode_definitions test j2lint vyshim generate-configd-include-json +all: clean libvyosconfig interface_definitions op_mode_definitions test j2lint vyshim generate-configd-include-json .PHONY: clean clean: diff --git a/debian/control b/debian/control index 0d040a3745..efc008af2c 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,6 @@ Build-Depends: fakeroot, gcc, iproute2, - libvyosconfig0 (>= 0.0.7), libzmq3-dev, python3 (>= 3.10), # For QA diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index 8d27a7e467..4ad0620a53 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -19,7 +19,9 @@ from ctypes import cdll, c_char_p, c_void_p, c_int, c_bool -LIBPATH = '/usr/lib/libvyosconfig.so.0' +BUILD_PATH = '/tmp/libvyosconfig/_build/libvyosconfig.so' +INSTALL_PATH = '/usr/lib/libvyosconfig.so.0' +LIBPATH = BUILD_PATH if os.path.isfile(BUILD_PATH) else INSTALL_PATH def replace_backslash(s, search, replace):