From 4b6216b9d00195bf2e3772bb9278faf18ee9fd46 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 20 Apr 2017 16:41:52 +0200 Subject: [PATCH] Support of versioning in deb packages; addressing also comments to change 1593 Change-Id: I76da6c8dcb30b44e015c2de4bee9d67b3317f3d4 Signed-off-by: garciadeblas --- Makefile | 11 ++-- .../install-db-server.sh | 0 openmanod | 7 ++- scripts/openmano-report | 60 +++---------------- scripts/python-osm-ro.postinst | 2 +- setup.py | 2 +- 6 files changed, 20 insertions(+), 62 deletions(-) rename {scripts => database_utils}/install-db-server.sh (100%) diff --git a/Makefile b/Makefile index 5bde339b..b5f6ac59 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,10 @@ all: package install prepare: pip install setuptools mkdir -p build/ - #git describe | sed -e 's/^v//' > build/RO_VERSION - echo "1.1.5" > build/RO_VERSION + 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/RO_VERSION cp MANIFEST.in build/ cp requirements.txt build/ cp README.rst build/ @@ -34,6 +36,7 @@ pip: prepare cd build && ./setup.py sdist package: 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_ro/scripts/python-osm-ro.postinst deb_dist/osm-ro*/debian/ cd build/deb_dist/osm-ro* && dpkg-buildpackage -rfakeroot -uc -us @@ -65,6 +68,6 @@ stop-docker: clean: rm -rf build - #find build -name '*.pyc' -delete - #find build -name '*.pyo' -delete + find osm_ro -name '*.pyc' -delete + find osm_ro -name '*.pyo' -delete diff --git a/scripts/install-db-server.sh b/database_utils/install-db-server.sh similarity index 100% rename from scripts/install-db-server.sh rename to database_utils/install-db-server.sh diff --git a/openmanod b/openmanod index bb32339c..0611d4ec 100755 --- a/openmanod +++ b/openmanod @@ -48,6 +48,7 @@ import socket from osm_ro import httpserver, nfvo, nfvo_db from osm_ro.openmano_schemas import config_schema from osm_ro.db_base import db_base_Exception +import osm_ro global global_config global logger @@ -150,7 +151,7 @@ if __name__=="__main__": opts, args = getopt.getopt(sys.argv[1:], "hvc:V:p:P:", ["config=", "help", "version", "port=", "vnf-repository=", "adminport=", "log-socket-host=", "log-socket-port=", "log-file="]) port=None port_admin = None - config_file = 'openmanod.cfg' + config_file = 'osm_ro/openmanod.cfg' vnf_repository = None log_file = None log_socket_host = None @@ -264,8 +265,8 @@ if __name__=="__main__": r = mydb.get_db_version() if r[1] != database_version: logger.critical("DATABASE wrong version '%s'. \ - Try to upgrade/downgrade to version '%s' with './database_utils/migrate_mano_db.sh'", - r[1], database_version) + Try to upgrade/downgrade to version '%s' with '%s/database_utils/migrate_mano_db.sh'", + r[1], database_version, osm_ro.__path__[0]) exit(-1) except db_base_Exception as e: logger.critical("DATABASE is not a MANO one or it is a '0.0' version. Try to upgrade to version '%s' with \ diff --git a/scripts/openmano-report b/scripts/openmano-report index 9402facc..13c941a7 100755 --- a/scripts/openmano-report +++ b/scripts/openmano-report @@ -25,8 +25,7 @@ DIRNAME=$(readlink -f ${BASH_SOURCE[0]}) DIRNAME=$(dirname $DIRNAME ) -OMCLIENT=$DIRNAME/../openmano/openmano -OVCLIENT=$DIRNAME/../openvim/openvim +OMCLIENT=openmano #get screen log files at the beginning echo @@ -36,14 +35,8 @@ echo "-------------------------------" echo "-------------------------------" echo "OPENMANO" echo "-------------------------------" -echo "cat $DIRNAME/../logs/openmano.log*" -cat $DIRNAME/../logs/openmano.log* -echo -echo "-------------------------------" -echo "OPENVIM" -echo "-------------------------------" -echo "cat $DIRNAME/../logs/openvim.?" -cat $DIRNAME/../logs/openvim.? +echo "cat /var/log/osm/openmano.log*" +cat /var/log/osm/openmano.log* echo echo "-------------------------------" echo @@ -56,14 +49,8 @@ echo "-------------------------------" echo "-------------------------------" echo "OPENMANO" echo "-------------------------------" -echo "cat $DIRNAME/../openmano/openmanod.py|grep ^__version__" -cat $DIRNAME/../openmano/openmanod.py|grep ^__version__ -echo -echo "-------------------------------" -echo "OPENVIM" -echo "-------------------------------" -echo "cat $DIRNAME/../openvim/openvimd.py|grep ^__version__" -cat $DIRNAME/../openvim/openvimd.py|grep ^__version__ +echo "openmanod --version" +openmanod --version echo echo "-------------------------------" echo @@ -75,13 +62,8 @@ echo "-------------------------------" echo "-------------------------------" echo "OPENMANO" echo "-------------------------------" -echo "cat $DIRNAME/../openmano/openmanod.cfg" -cat $DIRNAME/../openmano/openmanod.cfg -echo "-------------------------------" -echo "OPENVIM" -echo "-------------------------------" -echo "cat $DIRNAME/../openvim/openvimd.cfg" -cat $DIRNAME/../openvim/openvimd.cfg +echo "cat /etc/osm/openmanod.cfg" +cat /etc/osm/openmanod.cfg echo "-------------------------------" echo @@ -137,34 +119,6 @@ do echo "-------------------------------" done echo - echo "-------------------------------" - echo "OPENVIM$verbose" - echo "-------------------------------" - echo "$OVCLIENT config" - $OVCLIENT config - echo "-------------------------------" - echo "$OVCLIENT tenant-list $verbose" - $OVCLIENT tenant-list $verbose - echo "-------------------------------" - echo "$OVCLIENT host-list $verbose" - $OVCLIENT host-list $verbose - echo "-------------------------------" - echo "$OVCLIENT net-list $verbose" - $OVCLIENT net-list $verbose - echo "-------------------------------" - echo "$OVCLIENT port-list $verbose" - $OVCLIENT port-list $verbose - echo "-------------------------------" - echo "$OVCLIENT flavor-list $verbose" - $OVCLIENT flavor-list $verbose - echo "-------------------------------" - echo "$OVCLIENT image-list $verbose" - $OVCLIENT image-list $verbose - echo "-------------------------------" - echo "$OVCLIENT vm-list $verbose" - $OVCLIENT vm-list $verbose - echo "-------------------------------" - echo done echo diff --git a/scripts/python-osm-ro.postinst b/scripts/python-osm-ro.postinst index 00f24002..f04a94cb 100755 --- a/scripts/python-osm-ro.postinst +++ b/scripts/python-osm-ro.postinst @@ -43,7 +43,7 @@ fi echo ' To make OSM RO work, you have to install mysql and a database, and finally start openmano service' -echo ' ${OSMRO_PATH}/scripts/install-db-server.sh -u USER -p ' +echo " ${OSMRO_PATH}/database_utils/install-db-server.sh # -h for help" echo ' service openmano start' diff --git a/setup.py b/setup.py index fb389700..5f1382d9 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from os import system #import glob _name = 'osm_ro' -_version = open('RO_VERSION').read() +_version = open('RO_VERSION').read().strip() _description = 'OSM Resource Orchestrator' _author = 'ETSI OSM' _author_email = 'alfonso.tiernosepulveda@telefonica.com' -- 2.25.1