## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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.6.0
%bcond_without check

# https://github.com/hetznercloud/cli
%global goipath         github.com/hetznercloud/cli
Version:                1.31.1

%gometa

%global common_description %{expand:
A command-line interface for Hetzner Cloud.}

%global golicenses      LICENSE
%global godocs          examples CHANGES.md README.md

Name:           hcloud
Release:        %autorelease
Summary:        A command-line interface for Hetzner Cloud

License:        MIT
URL:            %{gourl}
Source0:        %{gosource}

%description
%{common_description}

%gopkg

%prep
%goprep

%generate_buildrequires
%go_generate_buildrequires

%build
#LDFLAGS="-X 'github.com/hetznercloud/cli/internal/version.Version=%{version}'"
for cmd in cmd/* ; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done

# Build shell completions.
for SHELL in bash fish zsh; do
    %{gobuilddir}/bin/%{name} completion $SHELL > %{name}.${SHELL}
done

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

# Install shell completions.
install -Dp %{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dp %{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
install -Dp %{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name}


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

%files
%license LICENSE
%doc examples CHANGES.md README.md
%{_bindir}/*
%{_datadir}/bash-completion/completions/%{name}
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/fish/vendor_completions.d/%{name}.fish
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/zsh/site-functions/_%{name}
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions

%gopkgfiles

%changelog
* Wed Dec 07 2022 Major Hayden <major@redhat.com> 1.31.1-1
- Update to 1.31.1 rhbz#2151592

* Fri Dec 02 2022 Major Hayden <major@redhat.com> 1.31.0-1
- Update to 1.31.0 rhbz#2150264

* Mon Nov 14 2022 Major Hayden <major@redhat.com> 1.30.4-1
- Update to 1.30.4 rhbz#2142491

* Thu Sep 29 2022 Major Hayden <major@redhat.com> 1.30.3-2
- Specify version when building rhbz#2130676

* Tue Aug 16 2022 Major Hayden <major@redhat.com> 1.30.3-1
- Update to 1.30.3 rhbz#2118812

* Wed Aug 10 2022 Maxwell G <gotmax@e.email> 1.30.2-2
- Rebuild to fix FTBFS

* Tue Aug 09 2022 Major Hayden <major@redhat.com> 1.30.2-1
- Update to 1.30.2 rhbz#2116703

* Wed Jul 27 2022 Major Hayden <major@redhat.com> 1.30.1-1
- Update to 1.30.1 rhbz#2107395

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 1.30.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

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

* Wed Jun 29 2022 Major Hayden <major@redhat.com> 1.30.0-1
- Update to 1.30.0

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

* Tue Jun 14 2022 Major Hayden <major@redhat.com> 1.29.5-2
- Bump release number

* Tue May 31 2022 Major Hayden 🤠 <major@redhat.com> 1.29.5-1
- Initial import (rhbz#2091178)