Support of debian packaging with versioning for openvim and ovim library; dealing... 09/1609/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 20 Apr 2017 17:21:49 +0000 (19:21 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 20 Apr 2017 17:21:49 +0000 (19:21 +0200)
Change-Id: Iaa42a592bf8c372c3429fe6a5e556537ec3c9559
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
MANIFEST.in
Makefile
README.rst [new file with mode: 0644]
README_lite.rst [new file with mode: 0644]
osm_openvim/osm-openvim.service [new file with mode: 0644]
scripts/python-osm-openvim.postinst [new file with mode: 0755]
setup.py
setup_lite.py
stdeb.cfg [new file with mode: 0644]
stdeb_lite.cfg [new file with mode: 0644]

index db411b1..3a9e9a9 100644 (file)
@@ -1,3 +1,5 @@
+include README.rst
+include OPENVIM_VERSION
 include openflow
 include openvimd
 include openvim
index 3f9feff..189cb21 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,34 +6,52 @@ lite: clean build_lite pip_lite install_lite
 
 clean:
        rm -rf build
+       find osm_openvim -name '*.pyc' -delete
+       find osm_openvim -name '*.pyo' -delete
 
 prepare_lite:
+       pip install setuptools
        mkdir -p build
-       cp -r  osm_openvim/ build/lib_osm_openvim
+       VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
+       VER2=$(shell git describe | cut -d- -f2); \
+       VER3=$(shell git describe | cut -d- -f3); \
+       echo "$$VER1.dev$$VER2+$$VER3" > build/OVIM_VERSION
+       cp MANIFEST.in build/
+       sed -i "s/include OPENVIM_VERSION/include OVIM_VERSION/g" build/MANIFEST.in
+       sed -i "s/recursive-include osm_openvim */recursive-include lib_osm_openvim */g" build/MANIFEST.in
+       sed -i "s/include openflow/include openflow-lib/g" build/MANIFEST.in
+       sed '/include openvimd/d' build/MANIFEST.in
+       sed '/include openvim/d' build/MANIFEST.in
+       cp README_lite.rst build/README.rst
+       cp setup_lite.py build/setup.py
+       cp stdeb_lite.cfg build/stdeb.cfg
+       cp -r osm_openvim/ build/lib_osm_openvim
        rm build/lib_osm_openvim/httpserver.py
        rm build/lib_osm_openvim/openvimd.cfg
        cp -r database_utils build/lib_osm_openvim/
        cp -r scripts build/lib_osm_openvim/
-       cp MANIFEST.in build/
-       cp setup_lite.py build/setup.py
-       cp openflow build/
-       sed -i "s/from osm_openvim/from lib_osm_openvim/g" build/openflow
-       sed -i "s/import osm_openvim/import lib_osm_openvim/g" build/openflow
+       cp openflow build/openflow-lib
+       sed -i "s/from osm_openvim/from lib_osm_openvim/g" build/openflow-lib
+       sed -i "s/import osm_openvim/import lib_osm_openvim/g" build/openflow-lib
        sed -i "s/import osm_openvim; print osm_openvim.__path__[0]/import lib_osm_openvim; print lib_osm_openvim.__path__[0]/g" build/lib_osm_openvim/database_utils/migrate_vim_db.sh
-       sed -i "s/recursive-include osm_openvim */recursive-include lib_osm_openvim */g" build/MANIFEST.in
-       sed '/include openvimd/d' build/MANIFEST.in
-       sed '/include openvim/d' build/MANIFEST.in
 
 prepare:
+       pip install setuptools
        mkdir -p build
+       VER1=$(shell git describe | sed -e 's/^v//' |cut -d- -f1); \
+       VER2=$(shell git describe | cut -d- -f2); \
+       VER3=$(shell git describe | cut -d- -f3); \
+       echo "$$VER1.dev$$VER2+$$VER3" > build/OPENVIM_VERSION
+       cp MANIFEST.in build/
+       cp README.rst build/
+       cp setup.py build/
+       cp stdeb.cfg build/
        cp -r osm_openvim/  build/
        cp -r scripts build/osm_openvim/
        cp -r database_utils build/osm_openvim/
        cp -r templates build/osm_openvim/
        cp -r test build/osm_openvim/
        cp -r charm build/osm_openvim/
-       cp MANIFEST.in build/
-       cp setup.py build/
        cp openflow build/
        cp openvim build/
        cp openvimd build/
@@ -44,18 +62,26 @@ build: prepare
 build_lite: prepare_lite
        python -m py_compile build/lib_osm_openvim/*.py
 
-#deb:
-#      cd build && python setup.py --command-packages=stdeb.command bdist_deb
-#
-#debianize:
-#      cd build && python setup.py --command-packages=stdeb.command debianize
-
 pip: clean build
        cd build; ./setup.py sdist
 
 pip_lite: clean build_lite
        cd build; ./setup.py sdist
 
+package: clean prepare
+       #apt-get install -y python-stdeb
+       cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
+       cd build && cp osm_openvim/scripts/python-osm-openvim.postinst deb_dist/osm-openvim*/debian/
+       cd build/deb_dist/osm-openvim* && dpkg-buildpackage -rfakeroot -uc -us
+
+package_lite: clean prepare_lite
+       #apt-get install -y python-stdeb
+       cd build && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True
+       cd build/deb_dist/lib-osm-openvim* && dpkg-buildpackage -rfakeroot -uc -us
+
+snap:
+       echo "Nothing to be done yet"
+
 install: clean build
        cd build/dist; pip  install osm_openvim*
 
diff --git a/README.rst b/README.rst
new file mode 100644 (file)
index 0000000..00ea01a
--- /dev/null
@@ -0,0 +1,6 @@
+===========
+osm-openvim
+===========
+
+osm-openvim is a reference VIM offered in OSM to deploy VMs with EPA requirements
+
diff --git a/README_lite.rst b/README_lite.rst
new file mode 100644 (file)
index 0000000..e177eda
--- /dev/null
@@ -0,0 +1,8 @@
+===========
+lib-osm-openvim
+===========
+
+lib-osm-openvim is the library used in OSM to allow the management of a physical underlay
+network. The RO uses this library, so that it is possible to interconnect EPA-based VNFs
+using an underlay network which escapes from the control of the VIM.
+
diff --git a/osm_openvim/osm-openvim.service b/osm_openvim/osm-openvim.service
new file mode 100644 (file)
index 0000000..4431c6b
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=openvim server
+
+[Service]
+User=${USER_OWNER}
+ExecStart=openvimd -c /etc/osm/openvimd.cfg --log-file=/var/log/osm/openvim.log
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/scripts/python-osm-openvim.postinst b/scripts/python-osm-openvim.postinst
new file mode 100755 (executable)
index 0000000..bb58768
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+##
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: OSM_TECH@list.etsi.org
+##
+
+echo "POST INSTALL OSM-OPENVIM"
+OPENVIM_PATH=`python -c 'import osm_openvim; print osm_openvim.__path__[0]'`
+
+systemctl enable osm-openvim.service
+
+#Creation of log folder
+mkdir -p /var/log/osm
+
+#configure arg-autocomplete for this user
+su $SUDO_USER -c 'activate-global-python-argcomplete --user'
+if ! su  $SUDO_USER -c 'grep -q bash_completion.d/python-argcomplete.sh ${HOME}/.bashrc'
+then
+    echo "    inserting .bash_completion.d/python-argcomplete.sh execution at .bashrc"
+    su $SUDO_USER -c 'echo ". ${HOME}/.bash_completion.d/python-argcomplete.sh" >> ~/.bashrc'
+fi
+
+echo '
+To make OPENVIM work, you have to install mysql and a database, and finally start osm-openvim service'
+echo "     ${OPENVIM_PATH}/database_utils/install-db-server.sh # -h for help"
+echo '     service osm-openvim start'
+
+
index fac60ea..6856ff1 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -3,8 +3,8 @@
 from setuptools import setup
 
 __name = 'osm_openvim'
-__version = '1.0.0'
-__description = 'OSM Openvim library'
+__version = open('OPENVIM_VERSION').read().strip()
+__description = 'OSM Openvim'
 __author = 'ETSI OSM'
 __author_email = 'alfonso.tiernosepulveda@telefonica.com'
 __maintainer = 'mirabal'
@@ -64,6 +64,9 @@ setup(name=__name,
       scripts=__scripts__,
       package_data={'osm_openvim': ['*']},
       include_package_data=True,
+      data_files = [('/etc/osm/', ['osm_openvim/openvimd.cfg']),
+                   ('/etc/systemd/system/', ['osm_openvim/osm-openvim.service']),
+                   ],
       install_requires=_req
       )
 
index cf38014..9d2b2ef 100755 (executable)
@@ -3,7 +3,7 @@
 from setuptools import setup
 
 __name = 'lib_osm_openvim'
-__version = '1.0.0'
+__version = open('OVIM_VERSION').read().strip()
 __description = 'OSM Openvim library'
 __author = 'ETSI OSM'
 __author_email = 'alfonso.tiernosepulveda@telefonica.com'
@@ -38,7 +38,7 @@ _req = [
     "paramiko",
 ]
 
-__scripts__ = ['openflow']
+__scripts__ = ['openflow-lib']
 
 setup(name=__name,
       version=__version,
diff --git a/stdeb.cfg b/stdeb.cfg
new file mode 100644 (file)
index 0000000..8a40c6c
--- /dev/null
+++ b/stdeb.cfg
@@ -0,0 +1,5 @@
+[DEFAULT]
+Suite: xenial
+XS-Python-Version: >= 2.7
+Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
+Depends: python-pip, libmysqlclient-dev, libssl-dev, libffi-dev, python-argcomplete, python-jsonschema, python-mysqldb, python-paramiko, python-requests, python-yaml, libvirt-dev, python-bottle, python-libvirt
diff --git a/stdeb_lite.cfg b/stdeb_lite.cfg
new file mode 100644 (file)
index 0000000..3ec45b1
--- /dev/null
@@ -0,0 +1,5 @@
+[DEFAULT]
+Suite: xenial
+XS-Python-Version: >= 2.7
+Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
+Depends: python-pip, libmysqlclient-dev, libssl-dev, libffi-dev, python-argcomplete, python-jsonschema, python-mysqldb, python-paramiko, python-requests, python-yaml