Files
rpms/fedora/SPECS/polemarch.spec

122 lines
3.7 KiB
RPMSpec

# Attention: Before you can build this package, you must install venvctrl package through pip:
# pip install venvctrl
# Globals
%global __os_install_post %{nil}
# prevents the building of /usr/lib/.build-id directories and files:
# this only happens, if you are using python virtualenv
%global _build_id_links none
# Macros
%define name polemarch
%define shortname polemarch
%define namebase polemarch
%define user polemarch
%define datad poledata
%define version 1.1.2
%define release 1
%define __prelink_undo_cmd %{nil}
%define _binaries_in_noarch_packages_terminate_build 0
%define unmangled_version %{version}
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
Source3: %name-redis-client.patch
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 >= 3.2.0, 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}
pushd %{buildroot}
patch -p0 < %{S:3}
popd
%pre
getent group %{user} >/dev/null || \
groupadd -r %{user}
getent passwd %{user} >/dev/null || \
useradd -r -g %{user} -d /opt/%{user} \
-s /sbin/nologin -c "%{user} user" %{user}
exit 0
%post
%systemd_post %{name}.service
sudo -u %{user} /opt/%{name}/bin/%{shortname}ctl migrate
%preun
%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}
%{_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
%config(noreplace) %{_sysconfdir}/%{namebase}/settings.ini.template
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
[ "%{_builddir}" != "/" ] && [ -d "%{_builddir}" ] && rm -rf %{_builddir}/*
%changelog
* Fri Mar 8 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Do migrate alltimes postinstall script.
- Upgrade to latest 1.1.2 version.
- redis-py patch for version 3.2.0 which is required but not resolved.
* Fri Feb 22 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Some fixes for post script.
* Fri Feb 22 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- First setup for Fedora 29