%bcond_without check %if ! 0%{?gobuild:1} %define gobuild(o:) go build -mod vendor -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${GO_LDFLAGS:-} -extldflags '${LDFLAGS:-} -Wl,-z,relro -Wl,-z,now'" -a -v %{?**}; %endif %global goipath github.com/RedHatInsights/host-metering %global forgeurl https://github.com/RedHatInsights/host-metering/ %global autorelease git202611022035G0e9a71e3 %global gomodulesmode GO111MODULE=on %global godocs README.md # macros needed by SELinux %global selinuxtype targeted %global moduletype contrib %global modulename host-metering Name: host-metering Version: 1.4.0 Release: git202611022035G0e9a71e3.20261102203509844810.pr71.10.g0e9a71e%{?dist} Summary: None License: Apache-2.0 ExcludeArch: %{ix86} s390 s390x ppc ppc64 URL: https://github.com/RedHatInsights/host-metering/ Source: host-metering-1.4.0.tar.gz %if 0%{?rhel} >= 8 || 0%{?fedora} BuildRequires: golang >= 1.19 %if 0%{?rhel} >= 9 || 0%{?fedora} BuildRequires: go-rpm-macros %endif BuildRequires: systemd-rpm-macros %endif BuildRequires: git BuildRequires: policycoreutils BuildRequires: selinux-policy BuildRequires: selinux-policy-devel Requires: subscription-manager Requires: %{name}-selinux = %{version}-%{release} %description Host metering service %package selinux Summary: SELinux policy module for host-metering BuildArch: noarch %{?selinux_requires} Requires: %{name} = %{version}-%{release} %description selinux This package installs and sets up the SELinux policy security module for host-metering. %prep %setup -q -b 0 -n host-metering-1.4.0 # for possible downstream patches %autopatch -p1 %build pwd %gobuild -o $(pwd)/bin/host-metering %{goipath} make build-selinux %pre selinux %selinux_relabel_pre -s %{selinuxtype} %install install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp $(pwd)/bin/* %{buildroot}%{_bindir}/ install -m 0755 -vd %{buildroot}%{_unitdir} install -m 644 contrib/systemd/host-metering.service %{buildroot}%{_unitdir}/%{name}.service install -m 0755 contrib/systemd/host-metering-proxy-setup.sh %{buildroot}%{_bindir}/host-metering-proxy-setup.sh install -m 0755 -vd %{buildroot}%{_presetdir} install -m 644 contrib/systemd/80-host-metering.preset %{buildroot}%{_presetdir}/80-%{name}.preset install -m 0755 -vd %{buildroot}%{_mandir}/man1 install -m 644 contrib/man/host-metering.1 %{buildroot}%{_mandir}/man1/host-metering.1 install -m 0755 -vd %{buildroot}%{_mandir}/man5 install -m 644 contrib/man/host-metering.conf.5 %{buildroot}%{_mandir}/man5/host-metering.conf.5 install -D -m 0644 contrib/selinux/%{modulename}.pp %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp install -D -p -m 644 contrib/selinux/%{modulename}.if %{buildroot}%{_datadir}/selinux/devel/include/distributed/%{modulename}.if %if %{with check} %check export PATH=$(pwd)/mocks:$PATH go test -v ./... %endif %post %systemd_post %{name}.service %post selinux %selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp %selinux_relabel_post -s %{selinuxtype} if [ "$1" -le "1" ]; then # First install # the daemon needs to be restarted for the custom label to be applied systemctl try-restart %{name}.service >/dev/null 2>&1 || : fi %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %postun selinux if [ $1 -eq 0 ]; then %selinux_modules_uninstall -s %{selinuxtype} %{modulename} %selinux_relabel_post -s %{selinuxtype} fi %files %doc README.md %{_bindir}/* %attr(644,root,root) %{_unitdir}/%{name}.service %{_mandir}/man1/host-metering.1* %{_mandir}/man5/host-metering.conf.5* %{_presetdir}/*.preset %files selinux %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp %{_datadir}/selinux/devel/include/distributed/%{modulename}.if %ghost %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename} %changelog * Mon Nov 2 2026 Packit - 1.4.0-git202611022035G0e9a71e3.20261102203509844810.pr71.10.g0e9a71e - fix: allow reading cgroup files in SELinux policy (James Molet) - fix: survive SELinux denials once running in hostmetering_t (James Molet) - test: add SELinux/systemd behavior tests to the integration suite (James Molet) - fix: start host-metering directly from systemd (Pavlina Bartikova) - ci: extend packit targets and add internal testing-farm jobs (#69) (James Molet) - test: add testing-farm tmt vm test plan (#68) (James Molet) - test: add integration test suite with real candlepin registration (#67) (James Molet) - feat: modernize sub-man metadata collection for rhel 8, 9, and 10 (#66) (James Molet) - build: modernize rpm packaging for rhel 8, 9, and 10 (#65) (James Molet) - build: removed build support for s390x (Jason Jerome) * Mon Oct 2 2023 Vobornik Petr - 1.4.0-git202611022035G0e9a71e3 - No changelog. The history is kept in Git, downstreams have own logs.