# Generated by go2rpm 1.5.0 %bcond_without check %global shortname prometheus-alertmanager # https://github.com/prometheus/alertmanager %global goipath github.com/prometheus/alertmanager Version: 0.23.0 %gometa %global common_description %{expand: The Alertmanager handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integrations such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts.} %global golicenses COPYRIGHT.txt LICENSE NOTICE %global godocs doc examples MAINTAINERS.md README.md CHANGELOG.md SECURITY.md Name: %{goname} Release: %autorelease Summary: Prometheus Alertmanager # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: %{gourl} Source0: %{gosource} Source1: %{shortname}.service Source2: %{shortname}.sysusers Source3: %{shortname}.conf Source4: %{shortname}.yml Source5: README.templates Source6: %{shortname}.logrotate # Replace defaults paths for config files Patch0: defaults-paths.patch ExcludeArch: s390x BuildRequires: systemd-rpm-macros BuildRequires: golang(github.com/alecthomas/units) BuildRequires: golang(github.com/cenkalti/backoff/v4) BuildRequires: golang(github.com/cespare/xxhash) BuildRequires: golang(github.com/go-kit/kit/log) BuildRequires: golang(github.com/go-kit/kit/log/level) BuildRequires: golang(github.com/go-openapi/errors) BuildRequires: golang(github.com/go-openapi/loads) BuildRequires: golang(github.com/go-openapi/runtime) BuildRequires: golang(github.com/go-openapi/runtime/client) BuildRequires: golang(github.com/go-openapi/runtime/flagext) BuildRequires: golang(github.com/go-openapi/runtime/middleware) BuildRequires: golang(github.com/go-openapi/runtime/security) BuildRequires: golang(github.com/go-openapi/spec) BuildRequires: golang(github.com/go-openapi/strfmt) BuildRequires: golang(github.com/go-openapi/swag) BuildRequires: golang(github.com/go-openapi/validate) BuildRequires: golang(github.com/gofrs/uuid) BuildRequires: golang(github.com/gogo/protobuf/gogoproto) BuildRequires: golang(github.com/gogo/protobuf/proto) BuildRequires: golang(github.com/gogo/protobuf/types) BuildRequires: golang(github.com/hashicorp/go-sockaddr) BuildRequires: golang(github.com/hashicorp/memberlist) BuildRequires: golang(github.com/jessevdk/go-flags) BuildRequires: golang(github.com/matttproud/golang_protobuf_extensions/pbutil) BuildRequires: golang(github.com/oklog/run) BuildRequires: golang(github.com/oklog/ulid) BuildRequires: golang(github.com/pkg/errors) BuildRequires: golang(github.com/prometheus/client_golang/api) BuildRequires: golang(github.com/prometheus/client_golang/prometheus) BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp) BuildRequires: golang(github.com/prometheus/common/config) BuildRequires: golang(github.com/prometheus/common/model) BuildRequires: golang(github.com/prometheus/common/promlog) BuildRequires: golang(github.com/prometheus/common/promlog/flag) BuildRequires: golang(github.com/prometheus/common/route) BuildRequires: golang(github.com/prometheus/common/version) BuildRequires: golang(github.com/prometheus/exporter-toolkit/web) BuildRequires: golang(github.com/prometheus/exporter-toolkit/web/kingpinflag) BuildRequires: golang(github.com/rs/cors) BuildRequires: golang(github.com/shurcooL/vfsgen) BuildRequires: golang(github.com/stretchr/testify/require) BuildRequires: golang(github.com/xlab/treeprint) BuildRequires: golang(golang.org/x/net/netutil) BuildRequires: golang(gopkg.in/alecthomas/kingpin.v2) BuildRequires: golang(gopkg.in/yaml.v2) %if %{with check} # Tests BuildRequires: golang(github.com/kylelemons/godebug/pretty) %endif Requires(pre): shadow-utils %description %{common_description} %gopkg %prep %goprep %patch0 -p1 %build LDFLAGS="-X github.com/prometheus/common/version.Version=%{version} \ -X github.com/prometheus/common/version.Revision=%{release} \ -X github.com/prometheus/common/version.Branch=tarball \ -X github.com/prometheus/common/version.BuildDate=$(date -u -d@$SOURCE_DATE_EPOCH +%%Y%%m%%d)" for cmd in cmd/* ; do %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done %install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ mv %{buildroot}%{_bindir}/alertmanager %{buildroot}%{_bindir}/%{shortname} pushd %{buildroot}%{_bindir} ln -s %{shortname} alertmanager popd install -Dpm0644 %{S:4} %{buildroot}%{_sysconfdir}/prometheus/alertmanager.yml install -Dpm0644 %{S:5} %{buildroot}%{_sysconfdir}/prometheus/alertmanager_templates/README.templates mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus/alertmanager install -Dpm0644 %{S:1} %{buildroot}%{_unitdir}/%{shortname}.service install -Dpm0644 %{S:2} %{buildroot}%{_sysusersdir}/%{shortname}.conf install -Dpm0644 %{S:3} %{buildroot}%{_sysconfdir}/default/%{shortname} install -Dpm0644 %{S:6} %{buildroot}%{_sysconfdir}/logrotate.d/%{shortname} install -Dpm0644 template/default.tmpl %{buildroot}/%{_datadir}/prometheus/alertmanager/template/default.tmpl # Build man pages. mkdir -vp %{buildroot}/%{_mandir}/man1/ %{buildroot}%{_bindir}/%{shortname} --help-man > \ %{buildroot}/%{_mandir}/man1/%{shortname}.1 %{buildroot}%{_bindir}/amtool --help-man > \ %{buildroot}/%{_mandir}/man1/amtool.1 sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\nprometheus-alertmanager \\- The Prometheus alert manager' \ %{buildroot}/%{_mandir}/man1/%{shortname}.1 sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\namtool \\- Tooling for the Prometheus alert manager' \ %{buildroot}/%{_mandir}/man1/amtool.1 # Fix executable path in amtool examples sed -i 's/\.\/amtool/amtool/' %{buildroot}/%{_mandir}/man1/amtool.1 %pre %sysusers_create_compat %{SOURCE2} %post %systemd_post %{shortname}.service %preun %systemd_preun %{shortname}.service %postun %systemd_postun_with_restart %{shortname}.service %if %{with check} %check %gocheck %endif %files %license COPYRIGHT.txt LICENSE NOTICE %doc doc examples MAINTAINERS.md README.md CHANGELOG.md SECURITY.md %{_bindir}/* %{_datadir}/prometheus %{_mandir}/man1/%{shortname}.1* %{_mandir}/man1/amtool.1* %dir %{_sysconfdir}/prometheus %config(noreplace) %{_sysconfdir}/prometheus/alertmanager.yml %config(noreplace) %{_sysconfdir}/logrotate.d/%{shortname} %{_sysconfdir}/prometheus/alertmanager_templates %config(noreplace) %{_sysconfdir}/default/%{shortname} %dir %attr(0755,prometheus,prometheus) %{_sharedstatedir}/prometheus %dir %attr(0755,prometheus,prometheus) %{_sharedstatedir}/prometheus/alertmanager %{_sysusersdir}/%{shortname}.conf %{_unitdir}/%{shortname}.service %gopkgfiles %changelog %autochangelog