Files
rpms/centos/SPECS/polemarch.spec

131 lines
4.3 KiB
RPMSpec
Raw Normal View History

2022-07-19 10:19:57 +02:00
# 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
2022-07-22 12:34:11 +02:00
%define pyversion /usr/bin/python3.8
2022-07-19 10:19:57 +02:00
%define name polemarch
%define shortname polemarch
%define namebase polemarch
%define user polemarch
%define datad poledata
2022-09-16 08:25:56 +02:00
%define version 2.0.0
2022-07-19 10:19:57 +02:00
%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
# compiled binary tree:
Source0: %name-%{version}-bin.tar.gz
Source1: %name-settings
Source2: %name.service
Source3: %name.tmpfiles.conf
# Note: these two packages must not be installed by distribution (fedora): python3-pyyaml, python3-blockdiag-devel
# Build fails, if these two packages are installed!
Requires: python38, openssl-devel, libxcrypt
Requires: python38-PyMySQL
Requires: git
Requires: krb5-devel, krb5-libs, openldap-devel
Requires: mailcap
2022-07-22 12:31:29 +02:00
Requires: percona-server-client
2022-07-19 10:19:57 +02:00
%description
Polemarch is service for orchestration infrastructure by ansible.
Simply WEB gui for orchestration infrastructure by ansible playbooks.
%prep
%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:0} -C %{buildroot}
install -D %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini
install -D %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini.template
# fix for fedora rundir config:
install -d %{buildroot}/run/%name
install -D %{S:2} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service
install -d %{buildroot}%{_var}/lock/%{name}
install -D %{S:3} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf
# create additional directories:
install -d %{buildroot}/%{_var}/log/%{name}
install -d %{buildroot}/opt/%{datad}
# remove buildroot path in opt/polemarch/bin/activate.csh:
sed -i -e 's|/root/rpmbuild/BUILDROOT/polemarch.*x86_64||' %{buildroot}/opt/polemarch/bin/activate.csh
# remove .gitignore file:
rm -f %{buildroot}/opt/polemarch/.gitignore
%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
2022-07-22 12:34:11 +02:00
update-alternatives --set python %{pyversion}
2022-07-19 10:19:57 +02:00
sudo -u %{user} /opt/%{name}/bin/%{shortname}ctl migrate
2022-07-22 12:34:11 +02:00
2022-07-19 10:19:57 +02:00
%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}/lib/*
/opt/%{namebase}/lib64
/opt/%{namebase}/*.cfg
%dir %{_sysconfdir}/%{namebase}
%{_rundir}/%{namebase}
%{_var}/lock/%{namebase}
%attr(755,%{user},%{user}) %{_sysconfdir}/systemd/system/%{name}.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
2022-09-16 08:25:56 +02:00
* Fri Sep 16 2022 Daniel Steiner <daniel.steiner@dsteiner.ch>
- Updated to 2.0.0.
2022-09-11 10:22:17 +02:00
* Sun Sep 11 2022 Daniel Steiner <daniel.steiner@dsteiner.ch>
- Updated to 2.0.0 Beta 2.
2022-07-19 10:19:57 +02:00
* Mon Jul 18 2022 Daniel Steiner <daniel.steiner@dsteiner.ch>
- First 2.0.0 build on Almalinux 8.