Made improvements for rpmbuild

Change-Id: I1dd7a54f7ade5414ad07cb8e12d0b018ecbc63c2
This commit is contained in:
Igor Yozhikov 2013-12-12 13:52:08 +04:00
parent 4b070eaa46
commit 77d5ac0326
5 changed files with 217 additions and 3 deletions

View File

@ -1,6 +1,5 @@
recursive-include muranodashboard/static *
recursive-include muranodashboard/templates *
include muranodashboard/services/*.yaml
include tools/pip-requires
include run_tests.sh
include ChangeLog
@ -9,6 +8,6 @@ include MANIFEST.in
include AUTHORS
include LICENSE
include ChangeLog
include babel.cfg
include tox.ini
recursive-include build_addons/rpm *.sh
global-exclude *.pyc

View File

@ -0,0 +1,94 @@
#!/bin/sh
# Copyright (c) 2013 Mirantis, Inc.
#
# 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.
#
# CentOS script.
LOGLVL=1
LOG_DIR="/var/log/murano"
# Functions
# Loger function
log()
{
MSG=$1
if [ $LOGLVL -gt 0 ]; then
echo "LOG:> $MSG"
fi
}
# patching horizon configuration
modify_horizon_config() {
REMOVE=$2
if [ -f $1 ]; then
lines=$(sed -ne '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ =' $1)
if [ -n "$lines" ]; then
if [ ! -z $REMOVE ]; then
log "Removing our data from \"$1\"..."
sed -e '/^#START_MURANO_DASHBOARD/,/^#END_MURANO_DASHBOARD/ d' -i $1
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
exit
fi
else
log "\"$1\" already has our data, you can change it manually and restart apache2 service"
fi
else
if [ -z $REMOVE ];then
log "Adding our data into \"$1\"..."
cat >> $1 << EOF
#START_MURANO_DASHBOARD
HORIZON_CONFIG['dashboards'] += ('murano',)
INSTALLED_APPS += ('muranodashboard','floppyforms',)
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
verbose_formatter = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
if 'formatters' in LOGGING: LOGGING['formatters'].update(verbose_formatter)
else: LOGGING['formatters'] = verbose_formatter
LOGGING['handlers']['murano-file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '$LOG_DIR/murano-dashboard.log'}
LOGGING['loggers']['muranodashboard'] = {'handlers': ['murano-file'], 'level': 'DEBUG'}
LOGGING['loggers']['muranoclient'] = {'handlers': ['murano-file'], 'level': 'ERROR'}
#MURANO_API_URL = "http://localhost:8082"
#MURANO_METADATA_URL = "http://localhost:8084"
#if murano-api set up with ssl uncomment next strings
#MURANO_API_INSECURE = True
#END_MURANO_DASHBOARD
EOF
if [ $? -ne 0 ];then
log "Can't modify \"$1\", check permissions or something else, exiting!!!"
fi
fi
fi
else
echo "File \"$1\" not found, exiting!!!"
exit 1
fi
}
# Command line args'
COMMAND="$1"
cfg_file="/usr/share/openstack-dashboard/openstack_dashboard/settings.py"
case $COMMAND in
install )
modify_horizon_config $cfg_file
;;
uninstall )
modify_horizon_config $cfg_file remove
;;
* )
exit 1
;;
esac

View File

@ -0,0 +1,67 @@
Name: murano-dashboard
Version: 0.4
Release: 5%{?dist}
Summary: OpenStack Murano Dashboard
Group: Applications/Communications
License: Apache License, Version 2.0
URL: https://launchpad.net/murano
Source0: murano-dashboard-0.4.tar.gz
BuildArch: noarch
Requires: openstack-dashboard
Requires: python-eventlet
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: python-d2to1
Requires: python-pbr >= 0.5.21, python-pbr < 1.0
Requires: python-anyjson >= 0.3.3
Requires: python-bunch >= 1.0.1
Requires: python-iso8601 >= 0.1.8
Requires: python-six >= 1.4.1
Requires: PyYAML >= 3.10
Requires: python-django-floppyforms >= 1.1
Requires: python-ordereddict >= 1.1
Requires: python-yaql >= 0.2
Requires: python-muranoclient >= 0.4
Requires: murano-metadataclient >= 0.4
%description
Murano Dashboard
Sytem package - murano-dashboard
Python package - murano-dashboard
%prep
%setup -q muranodashboard-%{version}
%build
%{__python} setup.py build
%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
mkdir -p %{buildroot}/usr/bin
cp %{_builddir}/murano-dashboard-%{version}/build_addons/rpm/modify-horizon-config.sh %{buildroot}/usr/bin/
%post
/usr/bin/modify-horizon-config.sh install
if [ ! -d "/var/log/murano" ]; then
mkdir -p /var/log/murano
fi
touch /var/log/murano/murano-dashboard.log
mkdir -p /usr/share/openstack-dashboard/static/floppyforms
mkdir -p /usr/share/openstack-dashboard/static/muranodashboard
chown -R apache:root /usr/share/openstack-dashboard/static/muranodashboard
chown -R apache:root /usr/share/openstack-dashboard/static/floppyforms
chown apache:root /var/log/murano/murano-dashboard.log
su -c "python /usr/share/openstack-dashboard/manage.py collectstatic --noinput | /usr/bin/logger -t murano-dashboard-install " -s /bin/bash apache
service httpd restart
%files
%{python_sitelib}/*
/usr/bin/*
%changelog
* Thu Dec 12 2013 built by Igor Yozhikov <iyozhikov@mirantis.com>
- build number - 5

View File

@ -0,0 +1,54 @@
Name: #SYS_PKG_NAME#
Version: 0.4
Release: #RELEASE#
Summary: OpenStack Murano Dashboard
Group: Applications/Communications
License: #LICENSE#
URL: #URL#
Source0: #SOURCE0#
BuildArch: noarch
Requires: openstack-dashboard
Requires: python-eventlet
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-pbr
BuildRequires: python-d2to1
#REQUIRES#
%description
Murano Dashboard
#DESCRIPTION#
%prep
%setup -q muranodashboard-%{version}
%build
%{__python} setup.py build
%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
mkdir -p %{buildroot}/usr/bin
cp %{_builddir}/murano-dashboard-%{version}/build_addons/rpm/modify-horizon-config.sh %{buildroot}/usr/bin/
%post
/usr/bin/modify-horizon-config.sh install
if [ ! -d "/var/log/murano" ]; then
mkdir -p /var/log/murano
fi
touch /var/log/murano/murano-dashboard.log
mkdir -p /usr/share/openstack-dashboard/static/floppyforms
mkdir -p /usr/share/openstack-dashboard/static/muranodashboard
chown -R apache:root /usr/share/openstack-dashboard/static/muranodashboard
chown -R apache:root /usr/share/openstack-dashboard/static/floppyforms
chown apache:root /var/log/murano/murano-dashboard.log
su -c "python /usr/share/openstack-dashboard/manage.py collectstatic --noinput | /usr/bin/logger -t murano-dashboard-install " -s /bin/bash apache
service httpd restart
%files
%{python_sitelib}/*
/usr/bin/*
%changelog
#CHANGELOG#

View File

@ -15,7 +15,7 @@
[metadata]
name = murano-dashboard
version = 0.2
version = 0.4
summary = The Murano Dashboard
description-file =
README.rst