File irtt.spec of Package irtt

#
# spec file for package irtt
#
# Copyright (c) 2021, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define services irtt@.service irtt.target
Name:           irtt
Version:        0.9.1
Release:        0
Summary:        Isochronous Round-Trip Tester
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Diagnostic
URL:            https://github.com/heistp/irtt
#Git-Clone:     https://github.com/heistp/irtt.git
Source:         https://github.com/heistp/irtt/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
Source2:        irtt.target
Patch0:         irtt-fix-service.patch
BuildRequires:  go
BuildRequires:  golang-packaging
%{go_provides}

%description
IRTT (Isochronous Round-Trip Tester) IRTT measures round-trip time,
one-way delay and other metrics using UDP packets sent on a fixed period,
and produces both user and machine parseable output.

%prep
%autosetup -p 1 -a 1

%build
%{goprep} github.com/heistp/irtt
%{gobuild} -mod=vendor cmd/...

%install
%{goinstall}
install -d %{buildroot}%{_mandir}/man1/
for manpage in doc/*.1; do
  install -m 0644 $manpage %{buildroot}%{_mandir}/man1/
done
install -D -m 0644 irtt@.service %{buildroot}%{_unitdir}/irtt@.service
install -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/irtt.target

%pre
%service_add_pre %{services}

%post
%service_add_post %{services}

%preun
%service_del_preun %{services}

%postun
%service_del_postun %{services}

%check
#broken
#%%gotest github.com/heistp/irtt

%files
%license LICENSE
%doc CHANGES.md README.md doc/*.html
%{_bindir}/irtt
%{_unitdir}/irtt@.service
%{_unitdir}/irtt.target
%{_mandir}/man1/irtt.1%{?ext_man}
%{_mandir}/man1/irtt-client.1%{?ext_man}
%{_mandir}/man1/irtt-server.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by