|
| 1 | +# Created by pyp2rpm-3.3.8 |
| 2 | +%global pypi_name opencast-camera-control |
| 3 | +%global pypi_version %{_camera_control_version} |
| 4 | + |
| 5 | +%define uid opencastcamera |
| 6 | +%define gid opencastcamera |
| 7 | + |
| 8 | +Name: %{pypi_name} |
| 9 | +Version: %{pypi_version} |
| 10 | +Release: 1%{?dist} |
| 11 | +Summary: Automated Camera Control for Opencast |
| 12 | + |
| 13 | +License: GPLv3+ |
| 14 | + |
| 15 | +URL: None |
| 16 | +Source0: https://github.com/virtUOS/%{name}/archive/refs/tags/%{version}.tar.gz |
| 17 | +Source1: https://raw.githubusercontent.com/virtUOS/%{name}/%{version}/camera-control.yml |
| 18 | +Source2: opencast-camera-control.service |
| 19 | +BuildArch: noarch |
| 20 | + |
| 21 | +BuildRequires: python3-devel |
| 22 | +BuildRequires: python3dist(setuptools) |
| 23 | + |
| 24 | +Requires: python3dist(confygure) >= 0.1 |
| 25 | +Requires: python3dist(prometheus-client) |
| 26 | +Requires: python3dist(python-dateutil) |
| 27 | +Requires: python3dist(requests) |
| 28 | +Requires: python3dist(setuptools) |
| 29 | + |
| 30 | +BuildRequires: systemd |
| 31 | +Requires(post): systemd |
| 32 | +Requires(preun): systemd |
| 33 | +Requires(postun): systemd |
| 34 | + |
| 35 | +%description |
| 36 | +Control PTZ camera to move to certain presets when |
| 37 | +starting a scheduled recording. |
| 38 | + |
| 39 | +%{?python_provide:%python_provide python3-%{pypi_name}} |
| 40 | + |
| 41 | + |
| 42 | +%prep |
| 43 | +%autosetup -n %{pypi_name}-%{pypi_version} |
| 44 | +# Remove bundled egg-info |
| 45 | +rm -rf %{pypi_name}.egg-info |
| 46 | +# Patch setup.py |
| 47 | +# This is a workaround for the Python toolchain in EL9 not supporting the new pyproject.toml |
| 48 | +echo 'from setuptools import setup' > setup.py |
| 49 | +echo "setup(name = 'opencast-camera-control', $(grep version pyproject.toml), packages=['occameracontrol']," >> setup.py |
| 50 | +echo " entry_points={'console_scripts':['opencast-camera-control = occameracontrol.__main__:main' ]})" >> setup.py |
| 51 | + |
| 52 | +%build |
| 53 | +%py3_build |
| 54 | + |
| 55 | +%install |
| 56 | +%py3_install |
| 57 | + |
| 58 | +# Install configuration |
| 59 | +install -m 0644 -p -D %{SOURCE1} %{buildroot}%{_sysconfdir}/camera-control.yml |
| 60 | + |
| 61 | +# Install Systemd unit file |
| 62 | +install -m 0644 -p -D %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service |
| 63 | + |
| 64 | + |
| 65 | +%pre |
| 66 | +# Create user and group if nonexistent |
| 67 | +if [ ! $(getent group %{gid}) ]; then |
| 68 | + groupadd -r %{gid} > /dev/null 2>&1 || : |
| 69 | +fi |
| 70 | +if [ ! $(getent passwd %{uid}) ]; then |
| 71 | + useradd -M -r -g %{gid} %{uid} > /dev/null 2>&1 || : |
| 72 | +fi |
| 73 | + |
| 74 | + |
| 75 | +%post |
| 76 | +%systemd_post %{name}.service |
| 77 | + |
| 78 | + |
| 79 | +%preun |
| 80 | +%systemd_preun %{name}.service |
| 81 | + |
| 82 | + |
| 83 | +%postun |
| 84 | +%systemd_postun_with_restart %{name}.service |
| 85 | + |
| 86 | + |
| 87 | +%files |
| 88 | +%license LICENSE |
| 89 | +%doc README.md |
| 90 | +%{_bindir}/opencast-camera-control |
| 91 | +%{_unitdir}/%{name}.service |
| 92 | +%{python3_sitelib}/occameracontrol |
| 93 | +%{python3_sitelib}/opencast_camera_control-%{pypi_version}-py%{python3_version}.egg-info |
| 94 | +%config(noreplace) %{_sysconfdir}/camera-control.yml |
| 95 | + |
| 96 | +%changelog |
| 97 | +* Tue Mar 26 2024 Lars Kiesow <lkiesow@uos.de> - 0.1.0-1 |
| 98 | +- Initial package. |
0 commit comments