%global debug_package %{nil} Name: alertmanager Version: 0.28.1 Release: %autorelease Summary: The Alertmanager handles alerts sent by client applications such as the Prometheus server License: Apache-2.0 URL: https://github.com/prometheus/alertmanager Source0: https://github.com/prometheus/alertmanager/archive/refs/tags/v%{version}.tar.gz Source1: %{name}.service Source2: %{name}.sysusers Source3: %{name}.conf Source4: %{name}-tmpfiles.conf Source5: %{name}-service.preset ExclusiveArch: x86_64 aarch64 BuildRequires: golang >= 1.22.0 BuildRequires: git BuildRequires: make BuildRequires: systemd-rpm-macros %{?systemd_requires} %{?sysusers_requires_compat} %description %{summary}. %package amtool Summary: Alertmanager administration tool %description amtool %{summary}. %prep %setup -q -n alertmanager-%{version} %build #https://gitlab.archlinux.org/archlinux/packaging/packages/alertmanager/-/blob/main/PKGBUILD RPM_LD_FLAGS="-extldflags '%{build_ldflags}' \ -X github.com/prometheus/common/version.Version=%{version} \ -X github.com/prometheus/common/version.Revision=%{version} \ -X github.com/prometheus/common/version.Branch=tarball \ -X github.com/prometheus/common/version.BuildUser=pgdev@fedora-copr \ -X github.com/prometheus/common/version.BuildDate=$(date -u '+%%Y%%m%%d-%%H:%%M:%%S' --date=@${SOURCE_DATE_EPOCH})" go build \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -ldflags "$RPM_LD_FLAGS" \ ./cmd/alertmanager go build \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -ldflags "$RPM_LD_FLAGS" \ ./cmd/amtool %install install --mode=0755 -D alertmanager %{buildroot}%{_bindir}/alertmanager install --mode=0755 -D amtool %{buildroot}%{_bindir}/amtool install --mode=0640 -D examples/ha/alertmanager.yml %{buildroot}%{_sysconfdir}/sysconfig/alertmanager/alertmanager.yml install --mode=0640 -D %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/alertmanager/alertmanager install --directory %{buildroot}%{_docdir}/alertmanager cp --recursive examples %{buildroot}%{_docdir}/alertmanager/examples install --mode=0644 -D %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service install --mode=0644 -D %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf install --mode=0644 -D %{SOURCE4} %{buildroot}%{_exec_prefix}/lib/tmpfiles.d/alertmanager.conf install --mode=0644 -D %{SOURCE5} %{buildroot}%{_prefix}/lib/systemd/system-preset/90-alertmanager.preset %files %license LICENSE %{_bindir}/alertmanager %attr(640,root,alertmanager) %config %{_sysconfdir}/sysconfig/alertmanager/alertmanager.yml %attr(640,root,alertmanager) %config %{_sysconfdir}/sysconfig/alertmanager/alertmanager %{_docdir}/alertmanager %{_unitdir}/%{name}.service %{_sysusersdir}/%{name}.conf %{_exec_prefix}/lib/tmpfiles.d/alertmanager.conf %{_prefix}/lib/systemd/system-preset/90-alertmanager.preset %files amtool %license LICENSE %{_bindir}/amtool %pre %sysusers_create_compat %{SOURCE1} %post %systemd_post alertmanager.service %preun %systemd_preun alertmanager.service %postun %systemd_postun alertmanager.service %changelog %autochangelog