Files
rpms/fedora/SPECS/polemarch.spec

109 lines
3.3 KiB
RPMSpec
Raw Normal View History

# Attention: Before you can build this package, you must install venvctrl package through pip:
# pip install venvctrl
# Macros
%define name polemarch
%define shortname polemarch
%define namebase polemarch
%define user polemarch
%define datad poledata
%define version 1.1.0
%define release 0
%define __prelink_undo_cmd %{nil}
%define _binaries_in_noarch_packages_terminate_build 0
%define unmangled_version %{version}
# Globals
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Summary: Infrastructure Heat Service for orchestration infrastructure by ansible.
Group: Application/System
Vendor: VST Consulting <sergey.k@vstconsulting.net>
License: AGPL-3+
AutoReq: No
AutoProv: No
Source0: %name-%version.tar.gz
Source1: %name-settings
Source2: %name-redis-patch.sh
Patch0: %name-python3.patch
# Note: these two packages must not be installed by distribution (fedora): python3-pyyaml, python3-blockdiag-devel
# Build fails, if these two packages are installed!
BuildRequires: python3, openssl-devel, libyaml-devel
BuildRequires: python3-sphinxcontrib-blockdiag, python3-virtualenv, openldap-devel
Requires: python3, openssl-devel
Requires: python3-virtualenv
Requires: git
Requires: libyaml-devel
Requires: krb5-devel, krb5-libs, openldap-devel
Requires: mailcap
Requires: python3-redis, python3-django-redis, redis
%description
Polemarch is service for orchestration infrastructure by ansible.
Simply WEB gui for orchestration infrastructure by ansible playbooks.
%prep
%setup -q -n %name-%version
%patch0 -b python3-patch
%install
make BUILD_DIR=%{buildroot}
install %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini
# fix for python3 redis access:
bash %{S:2}
# fix for fedora rundir config:
mv %{buildroot}/var/run %{buildroot}/
# create additional directories:
install -d %{buildroot}/%{_var}/log/%{name}
install -d %{buildroot}/opt/%{datad}
2019-02-22 10:13:19 +01:00
%pre
getent group %{user} >/dev/null || \
groupadd -r %{user}
getent passwd %{user} >/dev/null || \
useradd -r -g %{user} -d %{user} \
-s /sbin/nologin -c "%{user} user" %{user}
exit 0
%post
2019-02-22 10:13:19 +01:00
%systemd_post %{name}.service
# only migrate, if it is an update
if [ $2 -eq 1 ]; then
su - %{user} -c "/opt/%{name}/bin/%{shortname}ctl migrate"
2019-02-22 10:13:19 +01:00
fi
%preun
2019-02-22 10:13:19 +01:00
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%defattr(-,%{user},%{user},-)
%dir %attr(-,%{user},%{user}) /opt/%{namebase}
%dir %attr(-,%{user},%{user}) /opt/%{datad}
%dir %attr(-,%{user},%{user}) %{_var}/log/%{namebase}
%attr(-,%{user},%{user}) /opt/%{namebase}/bin/*
%attr(-,%{user},%{user}) /opt/%{namebase}/include/*
%attr(-,%{user},%{user}) /opt/%{namebase}/lib/*
/opt/%{namebase}/lib64
%dir %{_sysconfdir}/%{namebase}
%{_var}/log/%{namebase}
%{_rundir}/%{namebase}
%{_var}/lock/%{namebase}
%attr(755,%{user},%{user}) %{_sysconfdir}/systemd/system/%{shortname}.service
%attr(755,root,root) %{_sysconfdir}/tmpfiles.d/%{namebase}.conf
%config(noreplace) %{_sysconfdir}/%{namebase}/settings.ini
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
[ "%{_builddir}" != "/" ] && [ -d "%{_builddir}" ] && rm -rf %{_builddir}/*
%changelog
* Fri Feb 22 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- First setup for Fedora 29