## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 8;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Generated by go2rpm 1.3
%bcond_without check

# https://github.com/insomniacslk/termhook
%global goipath         github.com/insomniacslk/termhook
%global commit          a267c978e590d0e84c40b76dbf79393eabed254a

%gometa

%global common_description %{expand:
termhook is a small library that attaches to a terminal, serial console or
other similar device, and lets you attach your own hook on terminal output.}

%global golicenses      COPYING
%global godocs          README.md

Name:           %{goname}
Version:        0
Release:        %autorelease
Summary:        Simple terminal that allows attaching hooks

# Upstream license specification: BSD-2-Clause
License:        BSD
URL:            %{gourl}
Source0:        %{gosource}
# PR#6: Update Tcsetattr usage to the new API
Patch0:         %{url}/pull/6.patch#/termhook-tcsetattr.patch

BuildRequires:  golang(github.com/pkg/term)
BuildRequires:  golang(github.com/pkg/term/termios)
BuildRequires:  golang(golang.org/x/sys/unix)

%description
%{common_description}

%gopkg

%prep
%goprep
%autopatch -p1

%build
for cmd in cmds/termhook; 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}/

%if %{with check}
%check
%gocheck
%endif

%files
%license COPYING
%doc README.md
%{_bindir}/*

%gopkgfiles

%changelog
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jul 19 2022 Maxwell G <gotmax@e.email> 0-7
- Rebuild for
  CVE-2022-{1705,32148,30631,30633,28131,30635,30632,30630,1962} in golang

* Sat Jun 18 2022 Robert-André Mauchin <zebob.m@gmail.com> 0-6
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327,
  CVE-2022-27191, CVE-2022-29526, CVE-2022-30629

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> 0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Aug 04 2021 Davide Cavalca <dcavalca@fedoraproject.org> 0-4
- Update Tcsetattr usage to the new API; Fixes: RHBZ#1987530

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Apr 06 2021 Davide Cavalca <dcavalca@fedoraproject.org> - 0-0.1.20210406gita267c97
- Initial package