|
| 1 | +%if 0%{?rhel} <= 9 |
| 2 | +%global _sysusersdir /usr/lib/sysusers.d |
| 3 | +%endif |
| 4 | + |
| 5 | +Name: testcloud |
| 6 | +Version: 0.0.0 |
| 7 | +Release: %autorelease |
| 8 | +Summary: Tool for running cloud images locally |
| 9 | + |
| 10 | +License: GPL-2.0-or-later |
| 11 | +URL: https://github.com/teemtee/testcloud |
| 12 | +Source0: %{pypi_source testcloud} |
| 13 | +Source1: testcloud.sysusers |
| 14 | + |
| 15 | +ExclusiveArch: %{kernel_arches} noarch |
| 16 | +BuildArch: noarch |
| 17 | + |
| 18 | +BuildRequires: systemd-rpm-macros |
| 19 | +%{?sysusers_requires_compat} |
| 20 | + |
| 21 | +Requires: polkit |
| 22 | + |
| 23 | +Recommends: edk2-ovmf |
| 24 | + |
| 25 | +Requires: python3-%{name} = %{version}-%{release} |
| 26 | + |
| 27 | +%description |
| 28 | +testcloud is a relatively simple system which is capable of booting images |
| 29 | +designed for cloud systems on a local system with minimal configuration. |
| 30 | +testcloud is designed to be (and remain) somewhat simple, trading fancy cloud |
| 31 | +system features for ease of use and sanity in development. |
| 32 | + |
| 33 | +%package -n python3-%{name} |
| 34 | +Summary: Python 3 interface to testcloud |
| 35 | + |
| 36 | +BuildRequires: bash-completion |
| 37 | +BuildRequires: python3-devel |
| 38 | +BuildRequires: python3-pytest |
| 39 | + |
| 40 | +Requires: acl |
| 41 | +Requires: genisoimage |
| 42 | +Requires: libvirt-daemon |
| 43 | +Requires: libvirt-daemon-config-network |
| 44 | +Requires: libvirt-daemon-driver-qemu |
| 45 | +Requires: libvirt-daemon-driver-storage-core |
| 46 | +Recommends: butane |
| 47 | +Suggests: python3-libguestfs |
| 48 | +Suggests: libguestfs-tools-c |
| 49 | + |
| 50 | +%description -n python3-%{name} |
| 51 | +Python 3 interface to testcloud. |
| 52 | + |
| 53 | +%pre |
| 54 | +%sysusers_create_compat %{SOURCE1} |
| 55 | + |
| 56 | +%prep |
| 57 | +%autosetup -n %{name}-%{version} -p1 |
| 58 | +# Drop coverage testing |
| 59 | +sed -i 's/ --cov-report=term-missing --cov testcloud//g' tox.ini |
| 60 | + |
| 61 | +%generate_buildrequires |
| 62 | +%pyproject_buildrequires |
| 63 | + |
| 64 | +%build |
| 65 | +export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} |
| 66 | +%pyproject_wheel |
| 67 | + |
| 68 | +%install |
| 69 | +%pyproject_install |
| 70 | +%pyproject_save_files testcloud |
| 71 | + |
| 72 | +# man page |
| 73 | +mkdir -p %{buildroot}%{_mandir}/man1 |
| 74 | +install -pm 644 manpages/testcloud.1 %{buildroot}%{_mandir}/man1 |
| 75 | + |
| 76 | +# bash completion |
| 77 | +mkdir -p %{buildroot}%{_datadir}/bash-completion/completions |
| 78 | +install -pm 644 conf/testcloud %{buildroot}%{_datadir}/bash-completion/completions/testcloud |
| 79 | + |
| 80 | +# configuration files |
| 81 | +mkdir -p %{buildroot}%{_sysconfdir}/testcloud/ |
| 82 | +install conf/settings-example.py %{buildroot}%{_sysconfdir}/testcloud/settings.py |
| 83 | + |
| 84 | +# Create running directory for testcloud |
| 85 | +install -d %{buildroot}%{_sharedstatedir}/testcloud/ |
| 86 | + |
| 87 | +# backingstores dir |
| 88 | +install -d %{buildroot}/%{_sharedstatedir}/testcloud/backingstores |
| 89 | + |
| 90 | +# instance dir |
| 91 | +install -d %{buildroot}/%{_sharedstatedir}/testcloud/instances |
| 92 | + |
| 93 | +# create polkit rules dir and install polkit rule |
| 94 | +mkdir -p %{buildroot}%{_sysconfdir}/polkit-1/rules.d |
| 95 | +install conf/99-testcloud-nonroot-libvirt-access.rules %{buildroot}%{_sysconfdir}/polkit-1/rules.d/99-testcloud-nonroot-libvirt-access.rules |
| 96 | + |
| 97 | +# sysusers conf file for creation of testcloud group |
| 98 | +install -p -m644 -D %{SOURCE1} %{buildroot}%{_sysusersdir}/%{name}.conf |
| 99 | + |
| 100 | +%check |
| 101 | +%pyproject_check_import |
| 102 | +%pytest |
| 103 | + |
| 104 | +%files |
| 105 | +%doc README.md |
| 106 | +%{_mandir}/man1/testcloud.1* |
| 107 | +%license LICENSE |
| 108 | + |
| 109 | +%dir %{_sysconfdir}/testcloud |
| 110 | +%dir %attr(0775, qemu, testcloud) %{_sharedstatedir}/testcloud |
| 111 | +%dir %attr(0775, qemu, testcloud) %{_sharedstatedir}/testcloud/backingstores |
| 112 | +%dir %attr(0775, qemu, testcloud) %{_sharedstatedir}/testcloud/instances |
| 113 | + |
| 114 | +%attr(0644, root, root) %{_sysconfdir}/polkit-1/rules.d/99-testcloud-nonroot-libvirt-access.rules |
| 115 | + |
| 116 | +%config(noreplace) %{_sysconfdir}/testcloud/settings.py |
| 117 | +%{_bindir}/testcloud |
| 118 | +%{_bindir}/t7d |
| 119 | +%{_datadir}/bash-completion/completions/testcloud |
| 120 | + |
| 121 | +%{_sysusersdir}/%{name}.conf |
| 122 | + |
| 123 | +%files -n python3-%{name} -f %{pyproject_files} |
| 124 | + |
| 125 | +%changelog |
| 126 | +%autochangelog |
0 commit comments