## 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.3
%bcond_without check

# Upstream dependencies change often and specific versions are needed that aren't
# always available in Fedora.
%bcond vendor 1

%global services        google-guest-agent.service google-startup-scripts.service google-shutdown-scripts.service

# https://github.com/GoogleCloudPlatform/guest-agent
%global goipath         github.com/GoogleCloudPlatform/guest-agent
Version:                20241025.00
%global tag             %{version}

%gometa -f

%global golicenses      LICENSE
%global godocs          CONTRIBUTING.md README.md

Name:           google-guest-agent
Release:        %{autorelease} 
Summary:        Google Compute Engine guest environment

License:        Apache-2.0
URL:            %{gourl}
Source0:        %{gosource}

# Bundled dependencies made with mkvendor.sh
Source1:        guest-agent-%{version}-vendor.tar.gz

# https://git.sr.ht/~gotmax23/fedora-scripts/tree/main/item/retired/go_vendor_licenses.py
Source2:        LICENSES.dependencies

# Google Cloud only offers Arm and x86 instances.
ExcludeArch:    ppc64le s390x

BuildRequires: systemd-rpm-macros

Requires: systemd

%description
This package contains scripts, configuration, and init files
for features specific to the Google Compute Engine cloud environment.

%gopkg

%prep
%autosetup -p1 %{forgesetupargs} %{?with_vendor:-b1}
%goprep -e %{?with_vendor:-k}
cp %{SOURCE2} .

# Skip wsfc_test.go: It's specific for Windows, and it assumes that network is available,
# so it fails in a network-jailed build environment.
rm google_guest_agent/wsfc_test.go


%generate_buildrequires
%if %{without vendor}
%go_generate_buildrequires
%endif


%build
for cmd in google_guest_agent google_metadata_script_runner; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done

%install
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vd                     %{buildroot}%{_sysconfdir}/default
install -m 0755 -vd                     %{buildroot}%{_unitdir}

install -m 0755 -vp %{gobuilddir}/bin/*             %{buildroot}%{_bindir}
install -m 0644 -vp instance_configs.cfg            %{buildroot}%{_sysconfdir}/default
install -m 0644 -vp google-guest-agent.service      %{buildroot}%{_unitdir}
install -m 0644 -vp google-startup-scripts.service  %{buildroot}%{_unitdir}
install -m 0644 -vp google-shutdown-scripts.service %{buildroot}%{_unitdir}

%if %{with check}
%check
# Skip tests that depend on networking or time out.
%gocheck -d google_guest_agent/network/manager -d google_guest_agent/events
%endif

%files
%license LICENSE %{?with_vendor:vendor/modules.txt LICENSES.dependencies}
%doc CONTRIBUTING.md README.md
%config(noreplace) %{_sysconfdir}/default/instance_configs.cfg
%{_bindir}/google_guest_agent
%{_bindir}/google_metadata_script_runner
%{_unitdir}/google-guest-agent.service
%{_unitdir}/google-startup-scripts.service
%{_unitdir}/google-shutdown-scripts.service

%post
%systemd_post %{services}

%preun
%systemd_preun %{services}

%postun
%systemd_postun_with_restart %{services}


%changelog
## START: Generated by rpmautospec
* Mon Oct 28 2024 Major Hayden <major@redhat.com> - 20241025.00-1
- Update to 20241025.00 rhbz#2319943

* Tue Oct 15 2024 Major Hayden <major@redhat.com> - 20241013.00-1
- Update to 20241013.00 rhbz#2317560

* Tue Oct 08 2024 Major Hayden <major@redhat.com> - 20240930.01-1
- Update to 20240930.01 rhbz#2316059

* Tue Aug 20 2024 Major Hayden <major@redhat.com> - 20240816.00-1
- Update to 20240618.00 rhbz#2306040

* Wed Aug 14 2024 Major Hayden <major@redhat.com> - 20240813.00-1
- Update to 20240813.00 rhbz#2304843

* Tue Aug 13 2024 Major Hayden <major@redhat.com> - 20240808.01-1
- Update to 20240808.01 rhbz#2303292

* Mon Aug 05 2024 Major Hayden <major@redhat.com> - 20240802.00-1
- Update to 20240802.00 rhbz#2302580

* Tue Jul 23 2024 Major Hayden <major@redhat.com> - 20240716.00-1
- Update to 20240716.00 rhbz#2298383

* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20240701.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Mon Jul 08 2024 Major Hayden <major@redhat.com> - 20240701.00-1
- Update to 20240701.00 rhbz#2295501

* Tue Jun 25 2024 Major Hayden <major@redhat.com> - 20240611.01-1
- Update to 20240611.01 rhbz#2291409

* Thu May 30 2024 Major Hayden <major@redhat.com> - 20240528.00-1
- Update to 20240528.00 rhbz#2283885

* Wed Apr 10 2024 Major Hayden <major@redhat.com> - 20240314.00-4
- Skip events test

* Wed Apr 10 2024 Major Hayden <major@redhat.com> - 20240314.00-3
- Fix typo in License filename

* Wed Apr 10 2024 Major Hayden <major@redhat.com> - 20240314.00-2
- Sync packit config with other GCP pkgs

* Wed Apr 10 2024 Major Hayden <major@redhat.com> - 20240314.00-1
- Update to 20240314.00 rhbz#2274184

* Wed Apr 10 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20230726.00-8
- Unretirement Releng Request: https://pagure.io/releng/issue/12057

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

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20230726.00-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 20230726.00-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Sep 06 2023 Major Hayden <major@redhat.com> - 20230726.00-4
- PRs to rawhide only

* Fri Jul 28 2023 Major Hayden <major@redhat.com> - 20230726.00-3
- Fix typo on ppc64le

* Fri Jul 28 2023 Major Hayden <major@redhat.com> - 20230726.00-2
- Disable ppc64/s390x arches

* Fri Jul 28 2023 Packit <hello@packit.dev> - 20230726.00-1
- [packit] 20230726.00 upstream release

* Tue Jul 25 2023 Major Hayden <major@redhat.com> - 20230725.00-2
- Disable koji auto build with packit

* Tue Jul 25 2023 Packit <hello@packit.dev> - 20230725.00-1
- [packit] 20230725.00 upstream release

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 20230711.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jul 12 2023 Major Hayden <major@redhat.com> - 20230711.00-1
- Update to 20230711.00 rhbz#2222161

* Wed Jul 12 2023 Major Hayden <major@redhat.com> - 20230707.00-2
- Add packit config 🤖

* Tue Jul 11 2023 Major Hayden <major@redhat.com> - 20230707.00-1
- Update to 20230707.00 rhbz#2221432

* Mon Jul 03 2023 Major Hayden <major@redhat.com> - 20230628.00-1
- Update to 20230628.00 rhbz#2218708

* Wed Jun 28 2023 Major Hayden <major@redhat.com> - 20230626.00-1
- Update to 20230626.00 rhbz#2218220

* Mon Jun 12 2023 Major Hayden <major@redhat.com> - 20230601.00-1
- Update to 20230601.00 rhbz#2211674

* Thu May 18 2023 Major Hayden <major@redhat.com> - 20230517.00-1
- Update to 20230517.00 rhbz#2208103

* Mon May 15 2023 Major Hayden <major@redhat.com> - 20230510.00-1
- Update to 20230510.00 rhbz#2198979

* Mon May 01 2023 Major Hayden <major@redhat.com> - 20230426.00-1
- Update to 20230426.00 rhbz#2190065

* Thu Apr 06 2023 Major Hayden <major@redhat.com> - 20230403.00-1
- Update to 20230403.00 rhbz#2183053

* Tue Mar 28 2023 Major Hayden <major@redhat.com> - 20230221.00-2
- Bump revision for rebuild rhbz#2178465

* Tue Feb 28 2023 Major Hayden <major@redhat.com> - 20230221.00-1
- Update to 20230221.00 rhbz#2172749

* Wed Feb 22 2023 Major Hayden <major@redhat.com> - 20230207.00-2
- Set SPDX license

* Mon Feb 13 2023 Major Hayden <major@redhat.com> - 20230207.00-1
- Update to 20230207.00 rhbz#2160637

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 20221109.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

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

* Wed Oct 26 2022 Major Hayden <major@redhat.com> - 20221025.00-1
- Update to 20221025.00 rhbz#2136314

* Wed Oct 12 2022 Major Hayden <major@redhat.com> - 20220927.00-1
- Update to 20220927.00 rhbz#2130931

* Thu Aug 25 2022 Major Hayden <major@redhat.com> - 20220824.00-1
- Update to 20220824.00 rhbz#2120895

* Thu Aug 18 2022 Major Hayden <major@redhat.com> - 20220816.01-1
- Update to 20220816.01 rhbz#2119456

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

* Tue Jul 19 2022 Maxwell G <gotmax@e.email> - 20201217.02-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> - 20201217.02-4
- 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> - 20201217.02-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

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

* Wed Mar 17 2021 Eric Edens <ericedens@google.com> - 20201217.02-1
- Initial import (#1925322).
## END: Generated by rpmautospec