Files
rpms/fedora/SPECS/polemarch.spec

208 lines
7.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
# don't check for rpath:
%global __arch_install_post /usr/lib/rpm/check-buildroot
# Macros
%define pyversion 3.8
%define name polemarch
%define shortname polemarch
%define namebase polemarch
%define user polemarch
%define datad poledata
%define version 1.7.6
%define release 2
%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-mysql-patch.sh
# compiled binary tree:
Source10: %name-bin-%{version}.tgz
Patch0: %name-python3.patch
Patch1: %name-venvctrl.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, python3-mysql
BuildRequires: python3-sphinxcontrib-blockdiag, python3-virtualenv, openldap-devel
BuildRequires: python3-amqp, python3-vine, python3-billiard, python3-celery, python3-kombu
BuildRequires: python3-redis, python3-Cython, python3-django-timezone-field, python3-markdown2
BuildRequires: python3-netaddr, python3-ldap, python3-smmap
BuildRequires: nodejs-has-yarn, yarnpkg, nodejs >= 10.0
Requires: python3, openssl-devel, libxcrypt-compat
Requires: python3-virtualenv, python3-mysql, python3-PyMySQL
Requires: git
Requires: libyaml-devel
Requires: krb5-devel, krb5-libs, openldap-devel
Requires: mailcap
Requires: python3-redis >= 3.2.0, python3-django-redis >= 4.0.0, redis >= 5.0.0
Requires: python3-gitdb, python3-GitPython
Requires: python3-amqp, python3-vine, python3-billiard, python3-celery, python3-kombu
Requires: python3-redis, python3-Cython, python3-django-timezone-field, python3-markdown2
Requires: python3-netaddr, python3-ldap, python3-smmap
%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
%patch1 -b venvctrl-patch
%install
#/usr/bin/make BUILD_DIR=%{buildroot}
# Install binary package (compiling does not work here! You need to compile it first!)
# cd BUILD/polemarch-1.7.3
# /usr/bin/patch --no-backup-if-mismatch -p0 -b --suffix ~/rpmbuild/SOURCES/venvctrl-patch --fuzz=0
# /usr/bin/make BUILD_DIR=/root/rpmbuild/BUILDROOT/polemarch
# cd /root/rpmbuild/BUILDROOT/polemarch
# tar czf ~/rpmbuild/SOURCES/polemarch-bin-1.7.3.tgz .
# don't forget to replace version and release number!
tar xzf %{S:10} -C %{buildroot}
/usr/bin/install %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini
# fix for python3 redis access:
bash %{S:2}
# fix or workaround for mysqlclient version check:
bash %{S:3}
# fix for fedora rundir config:
mv %{buildroot}/var/run %{buildroot}/
# create additional directories:
install -d %{buildroot}/%{_var}/log/%{name}
install -d %{buildroot}/opt/%{datad}
ln -s %{python3_sitearch}/MySQLdb %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/MySQLdb
ln -s %{python3_sitelib}/pymysql %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/pymysql
# remove compiled git python package, which are not working on Fedora 32 and pyton3.8
rm -rf %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/git
ln -s %{python3_sitelib}/git %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/git
rm -rf %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/gitdb
ln -s %{python3_sitelib}/gitdb %{buildroot}/opt/polemarch/lib/python%{pyversion}/site-packages/gitdb
# remove buildroot path in opt/polemarch/bin/activate.xsh:
sed -i -e 's|/root/rpmbuild/BUILDROOT/polemarch.*x86_64||' %{buildroot}/opt/polemarch/bin/activate.xsh
%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
* Mon May 18 2020 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Build dependencies added (nodejs and yarn).
* Fri May 15 2020 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.7.6 version.
* Sun May 3 2020 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Fixes for Fedora 32 installation. Git and gitdb packages are now symlinked.
* Fri Jan 17 2020 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.6.2 version.
* Mon Dec 30 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.6.1 version.
* Sun Dec 15 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.6.0 version.
* Fri Dec 6 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.5.1 version.
* Sat Nov 9 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Changes for Fedora 31.
- mysqlcient symlink added.
* Sat Sep 21 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.4.4 version.
* Sun Sep 15 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.4.3 version.
* Fri Aug 16 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.4.1 version.
* Sat Jul 13 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.3.1 version.
* Sun Jun 16 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.2.1 version.
* Mon Jun 10 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to 1.2.0 version, python 3 is required now.
* Sun May 12 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Dependency for libxcrypt-compat added.
* Fri May 3 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Workaround for mysql DB version failure.
* Sun Apr 28 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to latest 1.1.4 version.
* Fri Mar 22 2019 Daniel Steiner <daniel.steiner@daniel-steiner.org>
- Update to latest 1.1.3 version.
* 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