# Generated by go2rpm 1.17.1 %bcond check 1 # https://github.com/prometheus/prometheus %global goipath github.com/prometheus/prometheus Version: 2.55.1 %gometa -L -f Name: prometheus Release: %autorelease Summary: Prometheus monitoring system and time series database # Generated by go-vendor-tools License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml Source3: %{name}.service Source4: %{name}.sysusers Source5: %{name}.yml Source6: %{name}.conf Source7: %{name}.logrotate Source8: README.consoles Source20: https://github.com/prometheus/prometheus/releases/download/v%{version}/prometheus-web-ui-%{version}.tar.gz # Debian patch for default settings Patch: 0001-Add-default-settings-adapted-for-Debian.patch # Fix for a goleak test Patch: 0001-Use-full-path-for-Fedora.patch # Patch for Go 1.24 # https://github.com/prometheus/prometheus/pull/15835 Patch: 0001-parser-fix-non-constant-format-string-call.patch BuildRequires: go-vendor-tools BuildRequires: systemd-rpm-macros Requires(pre): shadow-utils Obsoletes: golang-github-prometheus < 2.55.1-3 %description The Prometheus monitoring system and time series database. %prep %goprep -A %setup -q -T -D -a1 -a20 %{forgesetupargs} %autopatch -p1 # copy pre-generated web/ui static content and compress it # required to create EmbedFS cp -r static/* web/ui/static/ rm -rf static sh scripts/compress_assets.sh %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %global gomodulesmode GO111MODULE=on export BUILDTAGS="netgo builtinassets" # PREBUILT_ASSETS_STATIC_DIR is used starting v3.0 #export PREBUILT_ASSETS_STATIC_DIR=web/ui/static export 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 %go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ install -Dpm0644 %{S:4} %{buildroot}%{_sysusersdir}/%{name}.conf install -Dpm0644 %{S:3} %{buildroot}%{_unitdir}/%{name}.service install -Dpm0644 %{S:6} %{buildroot}%{_sysconfdir}/default/%{name} install -Dpm0644 %{S:5} %{buildroot}%{_sysconfdir}/prometheus/prometheus.yml install -Dpm0644 %{S:7} %{buildroot}%{_sysconfdir}/logrotate.d/prometheus mkdir -vp %{buildroot}%{_sysconfdir}/prometheus/consoles install -Dpm0644 %{S:8} %{buildroot}%{_sysconfdir}/prometheus/consoles/README.consoles mkdir -vp %{buildroot}%{_sysconfdir}/prometheus/console_libraries install -Dpm0644 %{S:8} %{buildroot}%{_sysconfdir}/prometheus/console_libraries/README.consoles mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus # Build man pages. mkdir -vp %{buildroot}/%{_mandir}/man1/ %{buildroot}%{_bindir}/%{name} --help-man > \ %{buildroot}/%{_mandir}/man1/%{name}.1 %{buildroot}%{_bindir}/promtool --help-man > \ %{buildroot}/%{_mandir}/man1/promtool.1 sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\nprometheus \\- The Prometheus monitoring server' \ %{buildroot}/%{_mandir}/man1/%{name}.1 sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\npromtool \\- Tooling for the Prometheus monitoring system' \ %{buildroot}/%{_mandir}/man1/promtool.1 %pre %sysusers_create_compat %{SOURCE4} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %check %go_vendor_license_check -c %{S:2} %if %{with check} # TestDocumentation & TestAutoReloadConfig* fail due to defaults-paths.patch as # it changes the path of the default configuration file for test in "TestDocumentation" "TestAutoReloadConfig_ValidToValid" "TestAutoReloadConfig_ValidToInvalidToValid" \ "TestInvalidFileUpdate" "TestUpdateFileWithPartialWrites" \ ; do awk -i inplace '/^func.*'"$test"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' $(grep -rl $test) done %gocheck -d github.com/prometheus/prometheus/promql \ -d github.com/prometheus/prometheus/rules \ -d github.com/prometheus/prometheus/scrape \ -d github.com/prometheus/prometheus/tsdb %endif %files -f %{go_vendor_license_filelist} %license vendor/modules.txt %doc docs CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md MAINTAINERS.md %doc README.md RELEASE.md SECURITY.md discovery/README.md %{_bindir}/prometheus %{_bindir}/promtool %dir %{_sysconfdir}/prometheus/ %dir %{_sysconfdir}/prometheus/consoles %dir %{_sysconfdir}/prometheus/console_libraries %config(noreplace) %{_sysconfdir}/prometheus/prometheus.yml %config(noreplace) %{_sysconfdir}/default/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/prometheus %{_sysconfdir}/prometheus/consoles/README.consoles %{_sysconfdir}/prometheus/console_libraries/README.consoles %{_mandir}/man1/%{name}.1* %{_mandir}/man1/promtool.1* %{_unitdir}/prometheus.service %{_sysusersdir}/prometheus.conf %dir %attr(0755,prometheus,prometheus) %{_sharedstatedir}/prometheus %changelog %autochangelog