summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorGeorg Kunz <georg.kunz@ericsson.com>2016-12-02 15:57:04 +0100
committerGeorg Kunz <georg.kunz@ericsson.com>2016-12-02 16:25:35 +0100
commitc62b63e6f4b2560dcc673206faee74706fd9e7bc (patch)
treec44b2286faed9585cc3e14b619a69a07d3f342ab /build
parent556447538dbf4033076d05b9e8db99a84769a4cd (diff)
Makefile and RPM spec file for building gluon RPMs
Change-Id: I937958f6a9776c6e68e938482492d353204ffc43 Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
Diffstat (limited to 'build')
-rw-r--r--build/Makefile33
-rw-r--r--build/rpm_specs/gluon.spec89
2 files changed, 122 insertions, 0 deletions
diff --git a/build/Makefile b/build/Makefile
new file mode 100644
index 0000000..9e5e8dd
--- /dev/null
+++ b/build/Makefile
@@ -0,0 +1,33 @@
+GLUON_REPO=https://github.com/openstack/gluon.git
+GLUON_BRANCH=master
+GLUON_VER=0.0.1
+GLUON_TAR=gluon.tar.gz
+GLUON_RPM=noarch/gluon-$(GLUON_VER)-1.noarch.rpm
+
+.PHONY: all
+
+all: gluon
+
+.PHONY: gluon
+gluon: $(GLUON_RPM)
+
+.PHONY: clean
+clean: clean-gluon
+
+.PHONY: clean-gluon
+clean-gluon:
+ rm -rf BUILDROOT
+ rm -rf noarch
+ rm -f $(GLUON_TAR)
+ rm -f openstack-proton-server.service
+ rm -f proton.conf
+ rm -rf gluon-$(GLUON_VER)
+
+$(GLUON_TAR):
+ @echo cloning Gluon git repo
+ git clone $(GLUON_REPO) -b $(GLUON_BRANCH) gluon-$(GLUON_VER)
+ tar czf gluon.tar.gz gluon-$(GLUON_VER)
+
+$(GLUON_RPM): $(GLUON_TAR)
+ @echo building Gluon RPM
+ rpmbuild --clean -bb --target noarch rpm_specs/gluon.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D %'_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
diff --git a/build/rpm_specs/gluon.spec b/build/rpm_specs/gluon.spec
new file mode 100644
index 0000000..f64640f
--- /dev/null
+++ b/build/rpm_specs/gluon.spec
@@ -0,0 +1,89 @@
+%define release 1
+%define _sharedstatedir /var/lib
+
+Summary: OpenStack Gluon Framework
+Name: gluon
+Version: 0.0.1
+Release: %{release}%{?git}%{?dist}
+
+License: Apache 2.0
+Group: Applications/Internet
+Source0: gluon.tar.gz
+Url: https://github.com/openstack/gluon
+BuildArch: noarch
+
+Vendor: OpenStack <openstack-dev@lists.openstack.org>
+Packager: Georg Kunz <georg.kunz@ericsson.com>
+
+Requires: python-pbr
+Requires: python-click
+Requires: python-six
+Requires: python-requests
+Requires: python-yaml
+Requires: python-sqlalchemy
+Requires: python2-babel
+Requires: python2-oslo-db
+Requires: python2-oslo-config
+Requires: python2-oslo-versionedobjects
+Requires: python2-oslo-log
+Requires: python2-oslo-utils
+Requires: python2-oslo-i18n
+Requires: python2-wsme
+Requires: pytz
+
+%description
+OpenStack Gluon framework for NFV networking
+
+%prep
+%setup -q
+cat << EOF > %{_builddir}/openstack-proton-server.service
+[Unit]
+Description=OpenStack Proton Server
+After=syslog.target network.target
+
+[Service]
+Type=simple
+TimeoutStartSec=0
+Restart=always
+User=proton
+ExecStart=/usr/bin/proton-server --config-file /etc/proton/proton.conf --logfile /var/log/proton/api.log
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+cat << EOF > %{_builddir}/proton.conf
+[DEFAULT]
+state_path = /var/lib/proton
+EOF
+
+
+%install
+python setup.py install -O1 --root=%{buildroot} --record=INSTALLED_FILES --prefix=/usr
+mkdir -p %{buildroot}/usr/lib/systemd/system
+install %{_builddir}/openstack-proton-server.service %{buildroot}/usr/lib/systemd/system
+mkdir -p %{buildroot}%{_sharedstatedir}/proton
+mkdir -p %{buildroot}%{_localstatedir}/log/proton
+mkdir -p %{buildroot}%{_localstatedir}/run/proton
+mkdir -p %{buildroot}%{_sysconfdir}/proton
+install %{_builddir}/proton.conf %{buildroot}%{_sysconfdir}/proton
+
+
+%pre
+getent group proton >/dev/null || groupadd -r proton --gid 201
+if ! getent passwd proton >/dev/null; then
+ useradd -u 201 -r -g proton -G proton,nobody -d %{_sharedstatedir}/proton -s /sbin/nologin -c "OpenStack Proton Server" proton
+fi
+exit 0
+
+
+%clean
+rm -rf %{buildroot}
+
+%files -f INSTALLED_FILES
+%defattr(-,root,root)
+%attr(644,root,root) /usr/lib/systemd/system/openstack-proton-server.service
+%attr(640,proton,root) /etc/proton/proton.conf
+%attr(750,proton,root) /var/log/proton
+%attr(750,proton,root) /var/run/proton
+%attr(755,proton,root) /var/lib/proton