## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%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.12.0
%bcond_without check

# https://github.com/opentofu/opentofu
%global goipath         github.com/opentofu/opentofu
Version:                1.7.0

%gometa -L -f

%global common_description %{expand:
OpenTofu lets you declaratively manage your cloud infrastructure.}

Name:           opentofu
Release:        %autorelease
Summary:        OpenTofu lets you declaratively manage your cloud infrastructure

License:        Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unlicense
URL:            %{gourl}
Source0:        %{gosource}
Source1:        %{archivename}-vendor.tar.xz
Source2:        go-vendor-tools.toml

BuildRequires:  go-vendor-tools

%description %{common_description}

%prep
%goprep -A
%setup -q -T -D -a1 %{forgesetupargs}
%autopatch -p1

%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}

%build
export LDFLAGS="-X github.com/opentofu/opentofu/version.dev=no"
%gobuild -o %{gobuilddir}/bin/tofu %{goipath}/cmd/tofu

%install
%go_vendor_license_install -c %{S:2}
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%check
%go_vendor_license_check -c %{S:2}
%if %{with check}
for test in "TestResourceProvider_ApplyCustomWorkingDirectory" \
; do
awk -i inplace '/^func.*'"$test"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' $(grep -rl $test)
done
%gocheck
%endif

%files -f %{go_vendor_license_filelist}
%license vendor/modules.txt
%doc docs CODE_OF_CONDUCT.md SECURITY.md CHANGELOG.md CONTRIBUTING.md README.md
%doc TSC_SUMMARY.md WEEKLY_UPDATES.md
%{_bindir}/tofu

%changelog
## START: Generated by rpmautospec
* Tue Apr 30 2024 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.7.0-1
- Update to 1.7.0 - Closes rhbz#2278018

* Fri Feb 23 2024 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.6.2-1
- Update to 1.6.2 - Closes rhbz#2265533

* Sun Feb 11 2024 Maxwell G <maxwell@gtmx.me> - 1.6.1-3
- Rebuild for golang 1.22.0

* Thu Feb 08 2024 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.6.1-2
- Don't include devel files

* Mon Feb 05 2024 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.6.1-1
- Initial package - Closes rhbz#2258867
## END: Generated by rpmautospec