%global service dzil_build Name: obs-service-%{service} Version: 0.0.4 Release: 0 Summary: Obs service that will run dzil build command License: GPL-3.0-or-later URL: https://github.com/huakim/%{name} Group: Development/Tools/Building BuildArch: noarch Source0: %{service} Source1: %{service}.service Source2: %{service}_tar BuildRequires: (perl-generators or rpm-build-perl) BuildRequires: rpm_macro(_obs_service_dir) Requires: /usr/bin/perl %(echo %{SOURCE0} | %{_rpmconfigdir}/perl.req | sed "s/^/Requires: /g") %package -n %{name}_tar Requires: %{name} Summary: %{summary} %define TarReqs %{expand: %(echo %{SOURCE2} | %{_rpmconfigdir}/perl.req | sed "s/^/Requires: /g") } %{TarReqs} %package -n %{name}_gzip Requires: %{name} Summary: %{summary} %{TarReqs} %description %{summary}. %description -n %{name}_gzip %{summary}. %description -n %{name}_tar %{summary}. %install %define file %{_obs_service_dir}/%{service} %define script %{buildroot}%{file} mkdir -p %{buildroot}%{_obs_service_dir} cp %{SOURCE0} %{buildroot}%{file} cp %{SOURCE1} %{buildroot}%{file}.service cp %{SOURCE2} %{buildroot}%{file}_tar cp %{SOURCE1} %{buildroot}%{file}_tar.service cp %{SOURCE2} %{buildroot}%{file}_gzip cp %{SOURCE1} %{buildroot}%{file}_gzip.service sed -i '0,/%{service}/s//%{service}_tar/' %{buildroot}%{file}_tar.service sed -i '0,/%{service}/s//%{service}_gzip/' %{buildroot}%{file}_gzip.service sed -i '0,/tar/s//gzip/' %{buildroot}%{file}_gzip %post %postun %files %attr(755, root, root) %{file} %attr(644, root, root) %{file}.service %files -n %{name}_tar %attr(755, root, root) %{file}_tar %attr(644, root, root) %{file}_tar.service %files -n %{name}_gzip %attr(755, root, root) %{file}_gzip %attr(644, root, root) %{file}_gzip.service %changelog