aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile46
-rw-r--r--build-data/platforms.mk8
-rw-r--r--build-root/Makefile3
-rw-r--r--build-root/rpm/vpp.spec6
-rw-r--r--doxygen/Makefile25
-rwxr-xr-xsrc/scripts/vppctl_completion30
6 files changed, 93 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 6af33b08..7c3dded2 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,8 @@ endif
DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache
DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd
-DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
-DEB_DEPENDS += python-dev python-virtualenv python-pip lcov chrpath autoconf
+DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config doxygen graphviz
+DEB_DEPENDS += python-dev python-virtualenv python-pip python-pyparsing python-jinja2 lcov chrpath autoconf
ifeq ($(OS_VERSION_ID),14.04)
DEB_DEPENDS += openjdk-8-jdk-headless
else
@@ -41,9 +41,9 @@ else
endif
RPM_DEPENDS_GROUPS = 'Development Tools'
-RPM_DEPENDS = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils
+RPM_DEPENDS = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils doxygen graphviz
RPM_DEPENDS += openssl-devel https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm apr-devel
-RPM_DEPENDS += python-devel python-virtualenv lcov chrpath
+RPM_DEPENDS += python-devel python-virtualenv pyparsing python-jinja2 lcov chrpath
EPEL_DEPENDS = libconfuse-devel ganglia-devel
ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),)
@@ -183,6 +183,35 @@ distversion: $(BR)/scripts/.version
$(BR)/scripts/verdist ${BR} ${prefix}-$(shell $(BR)/scripts/version rpm-version) ${verstring}
mv $(verstring).tar.gz $(BR)/rpm
+deb-depends-check:
+ifeq ($(OS_ID),ubuntu)
+ @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
+ if [ -n "$$MISSING" ] ; then \
+ echo "\nPlease install missing packages: \n$$MISSING\n" ; \
+ echo "by executing \"make install-dep\"\n" ; \
+ exit 1 ; \
+ fi; \
+ exit 0
+endif
+
+rpm-depends-check:
+ifeq ($(OS_ID),centos)
+ @RPM_DEPENDS_ARRAY=($(RPM_DEPENDS)) ; \
+ for i in "$${!RPM_DEPENDS_ARRAY[@]}"; do \
+ if ! yum list installed "$${RPM_DEPENDS_ARRAY[$$i]}" >/dev/null 2>&1; then \
+ if ! [[ "$${RPM_DEPENDS_ARRAY[$$i]}" == *"://"* ]] ; then \
+ MISSING="$$MISSING $${RPM_DEPENDS_ARRAY[$$i]}" ; \
+ fi; \
+ fi; \
+ done; \
+ if [ -n "$$MISSING" ] ; then \
+ echo "\nPlease install missing packages: \n$$MISSING\n" ; \
+ echo "by executing \"make install-dep\"\n" ; \
+ exit 1 ; \
+ fi; \
+ exit 0
+endif
+
build: $(BR)/.bootstrap.ok
$(call make,$(PLATFORM)_debug,vpp-install)
@@ -286,10 +315,10 @@ build-vat:
run-vat:
@sudo $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp_api_test
-pkg-deb:
+pkg-deb: deb-depends-check doxygen-siphon-list
$(call make,$(PLATFORM),install-deb)
-pkg-rpm: dist
+pkg-rpm: dist rpm-depends-check doxygen-siphon-list
$(call make,$(PLATFORM),install-rpm)
ctags: ctags.files
@@ -321,7 +350,7 @@ endef
.PHONY: bootstrap-doxygen doxygen wipe-doxygen
-bootstrap-doxygen:
+bootstrap-doxygen: deb-depends-check rpm-depends-check
$(call make-doxy)
doxygen:
@@ -330,6 +359,9 @@ doxygen:
wipe-doxygen:
$(call make-doxy)
+doxygen-siphon-list:
+ $(call make-doxy)
+
define banner
@echo "========================================================================"
@echo " $(1)"
diff --git a/build-data/platforms.mk b/build-data/platforms.mk
index e192155b..111a45dc 100644
--- a/build-data/platforms.mk
+++ b/build-data/platforms.mk
@@ -73,6 +73,14 @@ install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
\
: and sysctl config ; \
echo ../../src/vpp/conf/80-vpp.conf /etc/sysctl.d \
+ >> deb/debian/vpp.install ; \
+ \
+ : bash completion for vppctl ; \
+ echo ../../src/scripts/vppctl_completion /etc/bash_completion.d \
+ >> deb/debian/vpp.install ; \
+ \
+ : move dictionary of vppctl commands ; \
+ echo ../docs/siphon_docs/clicmd.itemlist /usr/share/vpp \
>> deb/debian/vpp.install ; \
\
: dev package needs a couple of additions ; \
diff --git a/build-root/Makefile b/build-root/Makefile
index 6e26e90e..9fe03d66 100644
--- a/build-root/Makefile
+++ b/build-root/Makefile
@@ -1141,7 +1141,8 @@ package_wipe_script = \
@message=$(if $(is_build_tool),"Wiping build $(PACKAGE)","Wiping build/install $(PACKAGE)") ; \
$(call build_msg_fn,$$message) ; \
$(BUILD_ENV) ; \
- rm -rf $(if $(is_build_tool),$(PACKAGE_BUILD_DIR),$(PACKAGE_INSTALL_DIR) $(PACKAGE_BUILD_DIR))
+ rm -rf $(if $(is_build_tool),$(PACKAGE_BUILD_DIR),$(PACKAGE_INSTALL_DIR) $(PACKAGE_BUILD_DIR)); \
+ rm -f $(MU_BUILD_ROOT_DIR)/docs/siphon_docs/clicmd.itemlist
.PHONY: %-wipe
%-wipe:
diff --git a/build-root/rpm/vpp.spec b/build-root/rpm/vpp.spec
index c3c0d927..07ea2c34 100644
--- a/build-root/rpm/vpp.spec
+++ b/build-root/rpm/vpp.spec
@@ -129,6 +129,8 @@ install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}/etc/
# libraries
#
mkdir -p -m755 %{buildroot}%{_libdir}
+mkdir -p -m755 %{buildroot}/usr/share/vpp
+mkdir -p -m755 %{buildroot}/etc/bash_completion.d
for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/*/lib* -type f -name '*.so.*.*.*' -print )
do
install -p -m 755 $file %{buildroot}%{_libdir}
@@ -145,6 +147,8 @@ for file in $(find %{_mu_build_dir}/%{_vpp_install_dir}/vpp/share/vpp/api -type
do
install -p -m 644 $file %{buildroot}/usr/share/vpp/api
done
+install -p -m 644 %{_mu_build_dir}/../src/scripts/vppctl_completion %{buildroot}/etc/bash_completion.d
+install -p -m 644 %{_mu_build_dir}/docs/siphon_docs/clicmd.itemlist %{buildroot}/usr/share/vpp
# Lua bindings
mkdir -p -m755 %{buildroot}/usr/share/doc/vpp/examples/lua/examples/cli
@@ -273,6 +277,8 @@ fi
%exclude %{_libdir}/vpp_api_test_plugins
%{_libdir}/*
/usr/share/vpp/api/*
+/etc/bash_completion.d/vppctl_completion
+/usr/share/vpp/clicmd.itemlist
%files api-lua
%defattr(644,root,root)
diff --git a/doxygen/Makefile b/doxygen/Makefile
index face5b44..18086626 100644
--- a/doxygen/Makefile
+++ b/doxygen/Makefile
@@ -33,8 +33,6 @@ endif
OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
# Package dependencies
-DOC_DEB_DEPENDS = doxygen graphviz python-pyparsing python-jinja2
-DOC_RPM_DEPENDS = doxygen graphviz pyparsing python-jinja2
DOC_MAC_BIN_DEPENDS = doxygen dot git
DOC_MAC_PY_DEPENDS = pyparsing jinja2
@@ -129,22 +127,11 @@ SIPHON_DOCS = $(addprefix $(SIPHON_OUTPUT)/,$(addsuffix .md,$(SIPHONS)))
SIPHON_ITEMLIST = $(addprefix $(SIPHON_OUTPUT)/,$(addsuffix .itemlist,$(filter clicmd,$(SIPHONS))))
$(BR)/.doxygen-bootstrap.ok: Makefile
- @echo "Checking whether dependencies for Doxygen are installed..."
ifeq ($(OS_ID),ubuntu)
- @set -e; inst=; \
- for i in $(DOC_DEB_DEPENDS); do \
- dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \
- done; \
- if [ "$$inst" ]; then \
- sudo apt-get update; \
- sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \
- fi
@if [ ! -s /usr/lib/graphviz/config6a ]; then \
- echo "Rebuidlding system Graphviz configuration."; \
+ echo "Rebuilding system Graphviz configuration."; \
sudo dot -c; \
fi
-else ifneq ("$(wildcard /etc/redhat-release)","")
- @sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS)
else ifeq ($(OS_ID),darwin)
@set -e; \
for bin in $(DOC_MAC_BIN_DEPENDS); do \
@@ -187,8 +174,7 @@ $(BR)/.doxygen-siphon.dep: Makefile \
# Generate .siphon files that contain fragments of source file that
# relate to the siphons we support.
.NOTPARALLEL: $(SIPHON_FILES)
-$(SIPHON_FILES): $(BR)/.doxygen-bootstrap.ok \
- $(DOXY_DIR)/siphon-generate \
+$(SIPHON_FILES):$(DOXY_DIR)/siphon-generate \
$(addprefix,$(WSROOT),$(DOXY_INPUT)) \
$(wildcard $(DOXY_DIR)/siphon/*.py)
@echo "Validating source tree..."
@@ -246,7 +232,12 @@ $(eval $(call siphon-process,itemlist,itemlist))
# This target can be used just to generate the siphoned things
.PHONY: doxygen-siphon
-doxygen-siphon: $(SIPHON_DOCS) $(SIPHON_ITEMLIST)
+doxygen-siphon: $(SIPHON_DOCS)
+
+# This target is used generate list of cli commands for use with
+# the bash completion element for vppctl
+.PHONY: doxygen-siphon-list
+doxygen-siphon-list: $(SIPHON_ITEMLIST)
# Generate the doxygen docs
.PHONY: doxygen
diff --git a/src/scripts/vppctl_completion b/src/scripts/vppctl_completion
new file mode 100755
index 00000000..7e60249f
--- /dev/null
+++ b/src/scripts/vppctl_completion
@@ -0,0 +1,30 @@
+#Copyright 2016 Intel Corporation
+#
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+
+_vppctl()
+{
+ local cur prev num opts
+ COMPREPLY=( $(compgen -f ${cur}) )
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[@]:1}"
+ num="$((${#COMP_WORDS[@]}-1))"
+
+ VPP_CMD_LIST="$(cat /usr/share/vpp/clicmd.itemlist)"
+
+ opts="$(awk -v prev="^$prev" -v num=$num '{if($0 ~ prev) print $num}' <<< "${VPP_CMD_LIST}")"
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+
+}
+complete -F _vppctl vppctl