Adding support for packaging 10/8310/4
authorMauro Sardara <msardara+fdio@cisco.com>
Tue, 5 Sep 2017 18:11:45 +0000 (20:11 +0200)
committerMauro Sardara <msardara+fdio@cisco.com>
Tue, 5 Sep 2017 18:21:57 +0000 (18:21 +0000)
Change-Id: Ifce8355ee5f85513d368df8b3a92b69e2abdef20
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/netmon.install [new file with mode: 0644]
debian/netmon.postinst [new file with mode: 0644]
debian/python3-netmodel.install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/vicn.install [new file with mode: 0644]
debian/watch [new file with mode: 0644]
scripts/build_package.sh [new file with mode: 0644]
scripts/version [new file with mode: 0644]

diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..90590ff
--- /dev/null
@@ -0,0 +1,5 @@
+vicn (1.0-25~g009e5b9~b1) UNRELEASED; urgency=medium
+
+  * Initial release (Closes: #nnnn)
+
+ -- Mauro Sardara <mauro.sardara@cisco.com>  Tue, 18 Oct 2016 12:10:07 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..1dad268
--- /dev/null
@@ -0,0 +1,59 @@
+Source: vicn
+Version: 3.23
+Section: python
+Priority: optional
+Maintainer: Jordan AugĂ© <jordan.auge@cisco.com>
+Build-Depends: debhelper (>= 9), dh-python, python3-all, python3-setuptools, python3-docutils, python3-sphinx
+Standards-Version: 3.9.5
+Homepage: https://wiki.fd.io/view/Vicn
+Vcs-Git: https://gerrit.fd.io/r/cicn
+Vcs-Browser: https://gerrit.fd.io/r/gitweb?p=cicn.git
+X-Python3-Version: >= 3.5
+
+Package: python3-netmodel
+Version: 3.23
+Architecture: all
+Depends: ${python3:Depends}, ${misc:Depends}, python3-daemon, python3-lockfile, python3-setuptools, python3-pip
+Suggests: python-netmodel-doc
+Description: Netmodel
+ Netmodel
+
+Package: netmon
+Version: 3.23
+Architecture: all
+Depends: ${python3:Depends}, ${misc:Depends}, python3-netmodel
+Suggests: netmon-doc
+Description: Monitoring
+ Monitoring daemon
+
+Package: vicn
+Version: 3.23
+Architecture: all
+Depends: ${python3:Depends}, ${misc:Depends}, python3-netmodel
+Suggests: vicn-doc
+Description: vICN experiment controller
+ = vICN
+ .
+ == Description
+ .
+ This application is an ICN experimental testbed orchestrator. It allows to
+ quickly deploy experiments in a cluster using linux containers, IP tunnels and
+ linux kernel tools.
+ .
+ This tool provides the following features:
+ .
+ - Physical topology deployment
+ - Virtual topology deployment
+ - ICN Network setup
+ - Management tools
+ .
+ The architecture of this orchestrator is basically a master-slave architecture.
+ The master, vICN, controls the whole cluster of servers, by means of HTTPS REST
+ APIs and remote SSH.
+
+#Package: vicn-resource-hicn
+#Architecture: all
+#Depends: vicn
+#Description: TODO
+# TODO
+
diff --git a/debian/netmon.install b/debian/netmon.install
new file mode 100644 (file)
index 0000000..9846542
--- /dev/null
@@ -0,0 +1,5 @@
+/etc/init/netmon.conf
+/lib/systemd/system/netmon.service
+/usr/lib/python3*/dist-packages/netmon
+/usr/lib/python3*/dist-packages/netmon-*.egg-info
+/usr/bin/netmon
diff --git a/debian/netmon.postinst b/debian/netmon.postinst
new file mode 100644 (file)
index 0000000..fdbfb95
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+pip3 install --upgrade autobahn
diff --git a/debian/python3-netmodel.install b/debian/python3-netmodel.install
new file mode 100644 (file)
index 0000000..5545c4a
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/python3*/dist-packages/netmodel/
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..86a95b0
--- /dev/null
@@ -0,0 +1,17 @@
+#! /usr/bin/make -f
+
+#export DH_VERBOSE = 1
+
+# NOTE: setting PYBUILD_NAME breaks dh_install
+#export PYBUILD_NAME = vicn
+
+%:
+       dh $@ --with python3,sphinxdoc --buildsystem=pybuild
+
+override_dh_auto_test:
+
+#override_dh_auto_build: export http_proxy=127.0.0.1:9
+#override_dh_auto_build: export https_proxy=127.0.0.1:9
+#override_dh_auto_build: dh_auto_build
+#        PYTHONPATH=. sphinx-build -N -bhtml docs/ build/html # HTML generator
+#        PYTHONPATH=. sphinx-build -N -bman docs/ build/man # Manpage generator
diff --git a/debian/vicn.install b/debian/vicn.install
new file mode 100644 (file)
index 0000000..4325084
--- /dev/null
@@ -0,0 +1,3 @@
+/usr/lib/python3*/dist-packages/vicn/
+/usr/lib/python3*/dist-packages/vicn-*.egg-info
+/usr/bin/vicn
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..a4eda3e
--- /dev/null
@@ -0,0 +1,3 @@
+version=3
+opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
+https://pypi.debian.net/mypackage/mypackage-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff --git a/scripts/build_package.sh b/scripts/build_package.sh
new file mode 100644 (file)
index 0000000..8189efd
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/bash
+set -euxo pipefail
+IFS=$'\n\t'
+
+SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+APT_PATH=`which apt-get` || true
+apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
+
+BUILD_TOOLS_UBUNTU="build-essential doxygen"
+DEPS_UBUNTU="devscripts debhelper python3-all python3-setuptools python3-docutils python3-sphinx python3-networkx python3-openssl python3-pyparsing python3-pip"
+
+setup() {
+
+    DISTRIB_ID=$1
+
+    if [ "$DISTRIB_ID" == "Ubuntu" ]; then
+        sudo ${apt_get} update || true
+    fi
+}
+
+# Parameters:
+# $1 = Package name
+#
+build_package() {
+
+    PACKAGE_NAME=$1
+
+    ARCHITECTURE="all"
+
+    # Figure out what system we are running on
+    if [ -f /etc/lsb-release ];then
+        . /etc/lsb-release
+        DEB=ON
+        RPM=OFF
+    else
+        echo "ERROR: System configuration not recognized. Build failed"
+        exit -1
+    fi
+
+    echo ARCHITECTURE: $ARCHITECTURE
+    echo DISTRIB_ID: $DISTRIB_ID
+    echo DISTRIB_RELEASE: $DISTRIB_RELEASE
+    echo DISTRIB_CODENAME: $DISTRIB_CODENAME
+    echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION
+
+    setup $DISTRIB_ID
+    # Install package dependencies
+    if [ $DISTRIB_ID == "Ubuntu" ]; then
+        echo $BUILD_TOOLS_UBUNTU $DEPS_UBUNTU | xargs sudo ${apt_get} install -y --allow-unauthenticated
+    fi
+
+    # do nothing but print the current slave hostname
+    hostname
+
+    # Make the package
+    VERSION=$(bash $SCRIPT_PATH/version)
+
+    cat << EOF > $SCRIPT_PATH/../debian/changelog
+vicn ($VERSION) UNRELEASED; urgency=medium
+
+  * Initial release (Closes: #nnnn)
+
+ -- Mauro Sardara <mauro.sardara@cisco.com>  Tue, 18 Oct 2016 12:10:07 +0200
+EOF
+
+    pushd $SCRIPT_PATH/..
+    debuild --no-lintian --no-tgz-check -i -us -uc -b
+    popd
+
+    echo "*******************************************************************"
+    echo "* $PACKAGE_NAME BUILD SUCCESSFULLY COMPLETED"
+    echo "*******************************************************************"
+
+    exit 0
+}
+
+PACKAGE_NAME="VICN"
+pushd $SCRIPT_PATH/..
+build_package $PACKAGE_NAME
+popd
+
diff --git a/scripts/version b/scripts/version
new file mode 100644 (file)
index 0000000..dcf93d8
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+version_prefix="Vicn-v"
+
+cd "$path"
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+    vstring=$(git describe --dirty --match "$version_prefix*" | sed "s/$version_prefix//")
+elif [ -f .version ]; then
+    vstring=$(cat .version)
+else
+    if [ -f ../rpm/*.gz ]; then
+        vstring=$(ls ../rpm/*.gz)
+    else
+        exit 1
+    fi
+fi
+
+TAG=$(echo ${vstring} | cut -d- -f1 | sed -e "s/$version_prefix//")
+ADD=$(echo ${vstring} | cut -s -d- -f2)
+
+git rev-parse 2> /dev/null
+if [ $? == 0 ]; then
+    CMT=$(git describe --dirty --match "$version_prefix*" | sed "s/$version_prefix//" | cut -s -d- -f3,4)
+else
+    CMT=$(echo ${vstring} | cut -s -d- -f3,4)
+fi
+CMTR=$(echo $CMT | sed 's/-/_/')
+
+if [ -n "${BUILD_NUMBER}" ]; then
+       BLD="~b${BUILD_NUMBER}"
+else
+       BLD="~b1"
+fi
+
+if [ "$1" = "rpm-version" ]; then
+  echo ${TAG}
+  exit
+fi
+
+if [ "$1" = "rpm-release" ]; then
+  [ -z "${ADD}" ] && echo release && exit
+  echo ${ADD}${CMTR:+~${CMTR}}${BLD}
+  exit
+fi
+
+  if [ -n "${ADD}" ]; then
+    if [ "$1" = "rpm-string" ]; then
+      echo ${TAG}-${ADD}${CMTR:+~${CMTR}}${BLD}
+    else
+      echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
+    fi
+  else
+    echo ${TAG}-release
+fi
\ No newline at end of file