From 4868cfef785f83fef983971e3ae2adba581a335a Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 5 Sep 2017 20:11:45 +0200 Subject: Adding support for packaging Change-Id: Ifce8355ee5f85513d368df8b3a92b69e2abdef20 Signed-off-by: Mauro Sardara --- debian/changelog | 5 +++ debian/compat | 1 + debian/control | 59 ++++++++++++++++++++++++++++++ debian/netmon.install | 5 +++ debian/netmon.postinst | 3 ++ debian/python3-netmodel.install | 1 + debian/rules | 17 +++++++++ debian/vicn.install | 3 ++ debian/watch | 3 ++ scripts/build_package.sh | 81 +++++++++++++++++++++++++++++++++++++++++ scripts/version | 57 +++++++++++++++++++++++++++++ 11 files changed, 235 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/netmon.install create mode 100644 debian/netmon.postinst create mode 100644 debian/python3-netmodel.install create mode 100755 debian/rules create mode 100644 debian/vicn.install create mode 100644 debian/watch create mode 100644 scripts/build_package.sh create mode 100644 scripts/version diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..90590ffb --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +vicn (1.0-25~g009e5b9~b1) UNRELEASED; urgency=medium + + * Initial release (Closes: #nnnn) + + -- Mauro Sardara Tue, 18 Oct 2016 12:10:07 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..1dad2688 --- /dev/null +++ b/debian/control @@ -0,0 +1,59 @@ +Source: vicn +Version: 3.23 +Section: python +Priority: optional +Maintainer: Jordan Augé +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 index 00000000..98465421 --- /dev/null +++ b/debian/netmon.install @@ -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 index 00000000..fdbfb95e --- /dev/null +++ b/debian/netmon.postinst @@ -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 index 00000000..5545c4af --- /dev/null +++ b/debian/python3-netmodel.install @@ -0,0 +1 @@ +/usr/lib/python3*/dist-packages/netmodel/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..86a95b03 --- /dev/null +++ b/debian/rules @@ -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 index 00000000..4325084c --- /dev/null +++ b/debian/vicn.install @@ -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 index 00000000..a4eda3e7 --- /dev/null +++ b/debian/watch @@ -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 index 00000000..8189efdc --- /dev/null +++ b/scripts/build_package.sh @@ -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 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 index 00000000..dcf93d83 --- /dev/null +++ b/scripts/version @@ -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 -- cgit 1.2.3-korg