nsh-plugin rpm packaging 58/3258/1
authorEd Warnicke <[email protected]>
Tue, 13 Sep 2016 20:04:28 +0000 (20:04 +0000)
committerEd Warnicke <[email protected]>
Tue, 4 Oct 2016 18:26:31 +0000 (11:26 -0700)
Change-Id: I5ccacfa9e09c88f84ac5b5cb303ba4d170f3743d
Signed-off-by: Ed Warnicke <[email protected]>
Signed-off-by: Ed Warnicke <[email protected]>
nsh-plugin/Makefile.am
nsh-plugin/build.sh
nsh-plugin/packaging/rpm/.gitignore [new file with mode: 0644]
nsh-plugin/packaging/rpm/vpp-nsh-plugin.spec [new file with mode: 0644]
nsh-plugin/packaging/scripts/version [new file with mode: 0755]
scripts/ci/verify.sh

index 4ecc63e..096eb90 100644 (file)
@@ -53,3 +53,7 @@ install-data-hook:
        rm -f $(prefix)/lib/nsh_plugin.*
        rm -f $(prefix)/lib/nsh_test_plugin.*
 
+pkg-rpm: all install
+       cd $(srcdir)/packaging/rpm; \
+       rpmbuild -bb --define "_topdir $$PWD" \
+               --define "_plugin_prefix ${prefix}" vpp-nsh-plugin.spec
index 86d592b..2acc331 100755 (executable)
@@ -1,4 +1,29 @@
 #!/usr/bin/env bash
+
+# Figure out what system we are running on
+if [ -f /etc/lsb-release ];then
+    . /etc/lsb-release
+elif [ -f /etc/redhat-release ];then
+    sudo yum install -y redhat-lsb
+    DISTRIB_ID=`lsb_release -si`
+    DISTRIB_RELEASE=`lsb_release -sr`
+    DISTRIB_CODENAME=`lsb_release -sc`
+    DISTRIB_DESCRIPTION=`lsb_release -sd`
+fi
+KERNEL_OS=`uname -o`
+KERNEL_MACHINE=`uname -m`
+KERNEL_RELEASE=`uname -r`
+KERNEL_VERSION=`uname -v`
+
+echo KERNEL_OS: $KERNEL_OS
+echo KERNEL_MACHINE: $KERNEL_MACHINE
+echo KERNEL_RELEASE: $KERNEL_RELEASE
+echo KERNEL_VERSION: $KERNEL_VERSION
+echo DISTRIB_ID: $DISTRIB_ID
+echo DISTRIB_RELEASE: $DISTRIB_RELEASE
+echo DISTRIB_CODENAME: $DISTRIB_CODENAME
+echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
+
 NSH_PLUGIN_DIR=$(dirname $0)
 NSH_INSTALL_PREFIX=${NSH_INSTALL_PREFIX:-/usr}
 cd ${NSH_PLUGIN_DIR}
diff --git a/nsh-plugin/packaging/rpm/.gitignore b/nsh-plugin/packaging/rpm/.gitignore
new file mode 100644 (file)
index 0000000..2410124
--- /dev/null
@@ -0,0 +1,6 @@
+BUILD
+BUILDROOT
+RPMS
+SOURCES
+SPECS
+SRPMS
diff --git a/nsh-plugin/packaging/rpm/vpp-nsh-plugin.spec b/nsh-plugin/packaging/rpm/vpp-nsh-plugin.spec
new file mode 100644 (file)
index 0000000..c114200
--- /dev/null
@@ -0,0 +1,47 @@
+%define _topdir          %(pwd)
+%define _builddir        %{_topdir}
+%define _version         %(../scripts/version rpm-version)
+%define _release         %(../scripts/version rpm-release)
+
+Name: vpp-nsh-plugin
+Summary: Vector Packet Processing
+License: Apache
+Version: %{_version}
+Release: %{_release}
+Requires: vpp 
+%description
+This package provides an nsh plugin for vpp
+
+%package devel
+Summary: VPP header files, static libraries
+Group: Development/Libraries
+Requires: vpp-nsh-plugin = %{_version}-%{_release}, vpp-devel 
+%description devel
+This package contains the headers for C bindings for the vpp-nsh-plugin
+
+%install
+#
+# vpp-nsh-plugin
+#
+mkdir -p -m755 %{buildroot}%{_libdir}/vpp_plugins
+install -m 644 %{_plugin_prefix}/lib/vpp_plugins/nsh_plugin.so %{buildroot}%{_libdir}/vpp_plugins/nsh_plugin.so
+mkdir -p -m755 %{buildroot}%{_libdir}/vpp_api_test_plugins
+install -m 644 %{_plugin_prefix}/lib/vpp_api_test_plugins/nsh_test_plugin.so %{buildroot}%{_libdir}/vpp_api_test_plugins/nsh_test_plugin.so
+
+# 
+# vpp-nsh-plugin-devel
+#
+mkdir -p -m755 %{buildroot}%{_includedir}/vpp-api/
+install -m 644 %{_plugin_prefix}/include/vpp-api/nsh_all_api_h.h %{buildroot}%{_includedir}/vpp-api/nsh_all_api_h.h
+install -m 644 %{_plugin_prefix}/include/vpp-api/nsh_msg_enum.h %{buildroot}%{_includedir}/vpp-api/nsh_msg_enum.h
+install -m 644 %{_plugin_prefix}/include/vpp-api/nsh.api.h %{buildroot}%{_includedir}/vpp-api/nsh.api.h
+
+
+%files
+%defattr(-,bin,bin)
+%{_libdir}/vpp_plugins/nsh_plugin.so
+%{_libdir}/vpp_api_test_plugins/nsh_test_plugin.so
+
+%files devel
+%defattr(-,bin,bin)
+%{_includedir}/*
diff --git a/nsh-plugin/packaging/scripts/version b/nsh-plugin/packaging/scripts/version
new file mode 100755 (executable)
index 0000000..84ee5db
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//')
+ADD=$(git describe | cut -s -d- -f2)
+CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
+
+if [ -n "${BUILD_NUMBER}" ]; then
+       BLD="~b${BUILD_NUMBER}"
+fi
+
+if [ "$1" = "rpm-version" ]; then
+  echo ${TAG}
+  exit
+fi
+
+if [ "$1" = "rpm-release" ]; then
+  [ -z "${ADD}" ] && echo release && exit
+  CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/')
+  echo ${ADD}${CMT:+~${CMT}}${BLD}
+  exit
+fi
+
+if [ -n "${ADD}" ]; then
+  echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
+else
+  echo ${TAG}
+fi
index e00e005..7728415 100755 (executable)
@@ -27,5 +27,8 @@ if test -f /usr/bin/lsb_release  && test `lsb_release -si` == "Ubuntu"  && test
     break
 fi
 ${NSH_PLUGIN_DIR}/build.sh
-
+cd ${NSH_PLUGIN_DIR}/build/
+if [ "${OS}" == "centos7" ]; then
+    make pkg-rpm
+fi