# Generated by go2rpm 1.6.0
%bcond_without check

# https://github.com/grpc-ecosystem/grpc-gateway
%global goipath         github.com/grpc-ecosystem/grpc-gateway/v2
Version:                2.7.3

%gometa

%global common_description %{expand:
GRPC to JSON proxy generator following the gRPC HTTP spec.}

%global golicenses      LICENSE.txt
%global godocs          docs examples ADOPTERS.md CONTRIBUTING.md README.md

Name:           %{goname}
Release:        7%{?dist}
Summary:        GRPC to JSON proxy generator following the gRPC HTTP spec

# Upstream license specification: BSD-3-Clause
License:        BSD
URL:            %{gourl}
Source0:        %{gosource}

%description
%{common_description}

%gopkg

%prep
%goprep
sed -i 's/\r$//' examples/internal/proto/examplepb/standalone_echo_service.yaml
sed -i 's/\r$//' examples/internal/proto/examplepb/unannotated_echo_service.yaml
find . -name ".gitignore" -exec rm {} \;
find . -name ".swagger-codegen" -exec rm -rf {} +
find . -name ".swagger-codegen-ignore" -exec rm {} \;

%generate_buildrequires
%go_generate_buildrequires

%build
for cmd in protoc-gen-grpc-gateway protoc-gen-openapiv2; 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}/
install -m 0755 -vd                     %{buildroot}%{_includedir}/protoc-gen-openapiv2/options
install -m 0755 -vp %{gobuilddir}/src/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/*.proto %{buildroot}%{_includedir}/protoc-gen-openapiv2/options

%if %{with check}
%check
%if 0%{?__isa_bits} == 64
%gocheck
%else
%gocheck -d protoc-gen-openapiv2/internal/genopenapi
%endif
%endif

%files
%license LICENSE.txt
%doc docs examples ADOPTERS.md CONTRIBUTING.md README.md
%{_bindir}/*
%{_includedir}/*

%gopkgfiles

%changelog
* Wed Aug 10 2022 Maxwell G <gotmax@e.email> - 2.7.3-7
- Rebuild to fix FTBFS

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

* Tue Jul 19 2022 Maxwell G <gotmax@e.email> - 2.7.3-5
- 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> - 2.7.3-4
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327, CVE-2022-27191,
  CVE-2022-29526, CVE-2022-30629

* Sat Apr 16 2022 Fabio Alessandro Locati <me@fale.io> - 2.7.3-3
- Rebuilt for CVE-2022-27191

* Fri Feb 11 2022 Fabio Alessandro Locati <fale@fedoraproject.org> - 2.7.3-2
- Add proto files

* Mon Feb 07 2022 Fabio Alessandro Locati <fale@fedoraproject.org> - 2.7.3-1
- Initial package