File salt-broker.spec of Package salt-broker
#
# spec file for package salt-broker
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define services salt-broker.service
%if ! %{defined primary_python}
%global primary_python python311
%endif
Name: salt-broker
Version: 0.0.3
Release: 0
Summary: A salt proxy which does not suck
License: MIT
URL: https://github.com/uyuni-project/uyuni/tree/master/proxy/proxy/salt-broker
# based on https://raw.githubusercontent.com/uyuni-project/uyuni/refs/heads/master/proxy/proxy/salt-broker/salt-broker
Source0: https://raw.githubusercontent.com/uyuni-project/uyuni/refs/heads/master/proxy/proxy/salt-broker/salt-broker
Source1: https://raw.githubusercontent.com/uyuni-project/uyuni/refs/heads/master/proxy/proxy/salt-broker/broker
# based on https://raw.githubusercontent.com/uyuni-project/uyuni/refs/heads/master/proxy/proxy/salt-broker/salt-broker.service
Source2: salt-broker.service
Source3: salt-broker.sysusers
Source4: salt-broker.apparmor
BuildArch: noarch
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(systemd)
Requires: %{primary_python}-pyzmq
Requires: %{primary_python}-PyYAML
BuildRequires: salt-master
BuildRequires: sysuser-shadow
BuildRequires: sysuser-tools
BuildRequires: apparmor-abstractions
BuildRequires: apparmor-rpm-macros
%{?systemd_ordering}
%{?sysusers_requires}
%description
A salt proxy which does not suck
Really it does not suck.
%prep
%build
%sysusers_generate_pre %{SOURCE3} %{name} %{name}.conf
%install
install -D -m 0750 -d \
%{buildroot}/etc/salt-broker/ \
%{buildroot}/var/{log,lib}/salt-broker
install -D -m 0755 %{SOURCE0} %{buildroot}%{_sbindir}/salt-broker
install -D -m 0640 %{SOURCE1} %{buildroot}/etc/salt-broker/config
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/salt-broker.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/apparmor.d/%{name}
%python3_fix_shebang
%pre -f %{name}.pre
%service_add_pre %{services}
%preun
%service_del_preun %{services}
%post
%service_add_post %{services}
%postun
%apparmor_reload %{_sysconfdir}/apparmor.d/%{name}
%service_del_postun %{services}
%files
%config(noreplace) %attr(-,root,%{name}) /etc/salt-broker/
%{_unitdir}/salt-broker.service
%{_sbindir}/salt-broker
%{_sysusersdir}/%{name}.conf
%dir %attr(-,%{name},%{name}) /var/log/salt-broker
%dir %attr(-,%{name},%{name}) /var/lib/salt-broker
%config %{_sysconfdir}/apparmor.d/%{name}
%config(noreplace) %ghost %attr(0644,root,root) %{_sysconfdir}/apparmor.d/local/%{name}
%changelog