# Generated by go2rpm 1.8.2 %bcond_without check %global shortname prometheus-snmp-exporter # https://github.com/prometheus/snmp_exporter %global goipath github.com/prometheus/snmp_exporter # Before 9e73705, which bumps the prometheus/exporter-toolkit dependency to # >=0.8.0, which Fedora does not yet have. For now, just run an older version, # there is not too much added after this (as of late November 2022). %global commit 256ec723c74f587a53f791c6792a4f31e1d2f6b4 Version: 0 %gometa -f %global common_description SNMP Exporter for Prometheus. %global golicenses LICENSE NOTICE %global godocs CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md\\\ MAINTAINERS.md README.md SECURITY.md\\\ generator/FORMAT.generator.md\\\ generator/README.generator.md Name: %{goname} Release: %autorelease Summary: SNMP Exporter for Prometheus License: Apache-2.0 URL: %{gourl} Source0: %{gosource} Source1: %{shortname}.conf Source2: %{shortname}.service Source3: %{shortname}.sysusers BuildRequires: golang(github.com/go-kit/log) BuildRequires: golang(github.com/go-kit/log/level) BuildRequires: golang(github.com/gosnmp/gosnmp) BuildRequires: golang(github.com/prometheus/client_golang/prometheus) BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promauto) BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp) BuildRequires: golang(github.com/prometheus/common/promlog) BuildRequires: golang(github.com/prometheus/common/promlog/flag) 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(gopkg.in/alecthomas/kingpin.v2) BuildRequires: golang(gopkg.in/yaml.v2) BuildRequires: net-snmp-devel BuildRequires: systemd-rpm-macros Requires: net-snmp-libs Requires(pre): shadow-utils %description %{common_description} %gopkg %prep %goprep mv generator/FORMAT.md generator/FORMAT.generator.md mv generator/README.md generator/README.generator.md %generate_buildrequires %go_generate_buildrequires %build %gobuild -o %{gobuilddir}/bin/snmp_exporter %{goipath} for cmd in generator; 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}/snmp_exporter %{buildroot}%{_bindir}/%{shortname} mv %{buildroot}%{_bindir}/generator %{buildroot}%{_bindir}/prometheus-snmp-generator install -Dpm 0644 generator/generator.yml %{buildroot}%{_datadir}/%{shortname}/generator.yml install -Dpm 0644 snmp.yml %{buildroot}%{_sysconfdir}/prometheus/snmp.yml install -Dpm 0644 %{S:1} %{buildroot}%{_sysconfdir}/default/%{shortname} install -Dpm 0644 %{S:2} %{buildroot}%{_unitdir}/%{shortname}.service install -Dpm 0644 %{S:3} %{buildroot}%{_sysusersdir}/%{shortname}.conf %if %{with check} %check %gocheck %endif %pre %sysusers_create_compat %{S:3} %post %systemd_post %{shortname}.service %preun %systemd_preun %{shortname}.service %postun %systemd_postun_with_restart %{shortname}.service %files %config(noreplace) %{_sysconfdir}/default/%{shortname} %config(noreplace) %{_sysconfdir}/prometheus/snmp.yml %doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md MAINTAINERS.md README.md %doc SECURITY.md generator/FORMAT.generator.md generator/README.generator.md %license LICENSE NOTICE %{_bindir}/%{shortname} %{_bindir}/prometheus-snmp-generator %{_datadir}/%{shortname}/generator.yml %{_sysusersdir}/%{shortname}.conf %{_unitdir}/%{shortname}.service %gopkgfiles %changelog %autochangelog