diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 74 |
1 files changed, 40 insertions, 34 deletions
@@ -7,38 +7,33 @@ LIBS := -lzmq 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 -LIBVYOSCONFIG_STATUS := $(shell git submodule status) config_xml_src = $(wildcard interface-definitions/*.xml.in) config_xml_obj = $(config_xml_src:.xml.in=.xml) op_xml_src = $(wildcard op-mode-definitions/*.xml.in) op_xml_obj = $(op_xml_src:.xml.in=.xml) +.PHONY: libvyosconfig +libvyosconfig: + @if [ ! -f /usr/lib/libvyosconfig.so.0 ]; then \ + make -C libvyosconfig clean ; \ + make -C libvyosconfig all ; \ + sudo make -C libvyosconfig install ; \ + fi + %.xml: %.xml.in @echo Generating $(BUILD_DIR)/$@ from $< mkdir -p $(BUILD_DIR)/$(dir $@) $(CURDIR)/scripts/transclude-template $< > $(BUILD_DIR)/$@ -.PHONY: libvyosconfig -.ONESHELL: -libvyosconfig: - if test ! -f $(LIBVYOSCONFIG_BUILD_PATH); then - if ! echo $(firstword $(LIBVYOSCONFIG_STATUS))|grep -Eq '^[a-z0-9]'; then - git submodule sync; git submodule update --init --remote - fi - rm -rf /tmp/libvyosconfig && mkdir /tmp/libvyosconfig - cp -r libvyosconfig /tmp && cd /tmp/libvyosconfig && \ - eval $$(opam env --root=/opt/opam --set-root) && ./build.sh || exit 1 - fi - .PHONY: interface_definitions .ONESHELL: -interface_definitions: $(config_xml_obj) libvyosconfig - mkdir -p $(TMPL_DIR) +interface_definitions: libvyosconfig $(config_xml_obj) + rm -rf $(TMPL_DIR); mkdir -p $(TMPL_DIR) $(CURDIR)/scripts/override-default $(BUILD_DIR)/interface-definitions + $(CURDIR)/scripts/override-help $(BUILD_DIR)/interface-definitions + $(CURDIR)/scripts/check-properties-collision $(BUILD_DIR)/interface-definitions find $(BUILD_DIR)/interface-definitions -type f -name "*.xml" | xargs -I {} $(CURDIR)/scripts/build-command-templates {} $(CURDIR)/schema/interface_definition.rng $(TMPL_DIR) || exit 1 @@ -57,19 +52,15 @@ interface_definitions: $(config_xml_obj) libvyosconfig # could mask help strings or mandatory priority statements find $(TMPL_DIR) -name node.def -type f -empty -exec false {} + || sh -c 'echo "There are empty node.def files! Check your interface definitions." && exit 1' -ifeq ($(BUILD_ARCH),arm64) - # There is currently no telegraf support in VyOS for ARM64, remove CLI definitions - rm -rf $(TMPL_DIR)/service/monitoring/telegraf -endif .PHONY: op_mode_definitions .ONESHELL: op_mode_definitions: $(op_xml_obj) - mkdir -p $(OP_TMPL_DIR) + rm -rf $(OP_TMPL_DIR); mkdir -p $(OP_TMPL_DIR) find $(BUILD_DIR)/op-mode-definitions/ -type f -name "*.xml" | xargs -I {} $(CURDIR)/scripts/build-command-op-templates {} $(CURDIR)/schema/op-mode-definition.rng $(OP_TMPL_DIR) || exit 1 - $(CURDIR)/python/vyos/xml_ref/generate_op_cache.py --xml-dir $(BUILD_DIR)/op-mode-definitions || exit 1 + $(CURDIR)/python/vyos/xml_ref/generate_op_cache.py --xml-dir $(BUILD_DIR)/op-mode-definitions --export-json $(DATA_DIR)/op_cache.json || exit 1 # XXX: tcpdump, ping, traceroute and mtr must be able to recursivly call themselves as the # options are provided from the scripts themselves @@ -88,8 +79,19 @@ op_mode_definitions: $(op_xml_obj) vyshim: $(MAKE) -C $(SHIM_DIR) +.PHONY: ocaml +ocaml: libvyosconfig + $(MAKE) -C src/ocaml + .PHONY: all -all: clean libvyosconfig interface_definitions op_mode_definitions test j2lint vyshim generate-configd-include-json +all: clean copyright libvyosconfig pylint interface_definitions op_mode_definitions test j2lint vyshim generate-configd-include-json generate-activation-scripts-json ocaml + +.PHONY: copyright +copyright: + @if git grep -q -E "Copyright( \(C\))? (19|20)[0-9]{2}(-[0-9]{4})? VyOS maintainers"; then \ + echo "Error: Legacy copyright notice found."; \ + exit 1; \ + fi .PHONY: clean clean: @@ -97,11 +99,12 @@ clean: rm -rf $(TMPL_DIR) rm -rf $(OP_TMPL_DIR) $(MAKE) -C $(SHIM_DIR) clean + $(MAKE) -C src/ocaml clean .PHONY: test test: generate-configd-include-json - set -e; python3 -m compileall -q -x '/vmware-tools/scripts/, /ppp/' . - PYTHONPATH=python/ python3 -m "nose" --with-xunit src --with-coverage --cover-erase --cover-xml --cover-package src/conf_mode,src/op_mode,src/completion,src/helpers,src/validators,src/tests --verbose + set -e; python3 -m compileall -q -x '/vmware-tools/scripts/' . + PYTHONPATH=python/ python3 -m nose2 -v .PHONY: check_migration_scripts_executable .ONESHELL: @@ -109,6 +112,13 @@ check_migration_scripts_executable: @echo "Checking if migration scripts have executable bit set..." find src/migration-scripts -type f -not -executable -print -exec false {} + || sh -c 'echo "Found files that are not executable! Add permissions." && exit 1' +.PHONE: pylint +pylint: interface_definitions + @echo Running "pylint ..." + @set -e; \ + PYTHONPATH="python/:smoketest/scripts/cli/" pylint --errors-only $(shell git ls-files python/**/*.py src/conf_mode/*.py src/op_mode/*.py src/migration-scripts src/services/vyos* smoketest/scripts); \ + PYTHONPATH=python/ pylint --disable=all --enable=W0611 $(shell git ls-files *.py src/migration-scripts src/services) + .PHONY: j2lint j2lint: ifndef J2LINT @@ -116,14 +126,6 @@ ifndef J2LINT endif $(J2LINT) data/ -.PHONY: sonar -sonar: - sonar-scanner -X -Dsonar.login=${SONAR_TOKEN} - -.PHONY: unused-imports -unused-imports: - @pylint --disable=all --enable=W0611 $(PYLINT_FILES) - deb: dpkg-buildpackage -uc -us -tc -b @@ -131,6 +133,10 @@ deb: generate-configd-include-json: @scripts/generate-configd-include-json.py +.PHONY: generate-activation-scripts-json +generate-activation-scripts-json: + @scripts/generate-activation-scripts-json.py + .PHONY: schema schema: trang -I rnc -O rng schema/interface_definition.rnc schema/interface_definition.rng |
