## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## 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

%global pypi_version 24.11

Name:           python-virt-firmware
Version:        %{pypi_version}
Release:        %autorelease
Summary:        Tools for virtual machine firmware volumes

License:        GPL-2.0-only
URL:            https://pypi.org/project/virt-firmware/
Source0:        virt_firmware-%{pypi_version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(cryptography)
BuildRequires:  python3dist(setuptools)
BuildRequires:  make help2man
BuildRequires:  systemd systemd-rpm-macros

%description
Tools for ovmf / armvirt firmware volumes This is a small collection of tools
for edk2 firmware images. They support decoding and printing the content of
firmware volumes. Variable stores (OVMF_VARS.fd) can be modified, for example
to enroll secure boot certificates.

%package -n     python3-virt-firmware
Summary:        %{summary}
%{?python_provide:%python_provide python3-virt-firmware}
Provides:       virt-firmware
Conflicts:      python3-virt-firmware-peutils < 23.9
Obsoletes:      python3-virt-firmware-peutils < 23.9
Requires:       python3dist(cryptography)
Requires:       python3dist(setuptools)
Requires:       python3dist(pefile)
Recommends:     qemu-img
Recommends:     dialog
%description -n python3-virt-firmware
Tools for ovmf / armvirt firmware volumes This is a small collection of tools
for edk2 firmware images. They support decoding and printing the content of
firmware volumes. Variable stores (OVMF_VARS.fd) can be modified, for example
to enroll secure boot certificates.

%package -n     python3-virt-firmware-tests
Summary:        %{summary} - test cases
Requires:       python3-virt-firmware
Requires:       python3dist(pytest)
Requires:       edk2-ovmf
%description -n python3-virt-firmware-tests
test cases

%package -n     uki-direct
Provides:       ukidirect
Summary:        %{summary} - manage UKI kernels.
Requires:       python3-virt-firmware
Conflicts:      systemd < 254
%description -n uki-direct
kernel-install plugin and systemd unit to manage automatic
UKI (unified kernel image) updates.

%prep
%autosetup -n virt_firmware-%{pypi_version}

%build
%py3_build

%install
%py3_install
# manpages
install -m 755 -d      %{buildroot}%{_mandir}/man1
install -m 644 man/*.1 %{buildroot}%{_mandir}/man1
# tests
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -ar tests %{buildroot}%{_datadir}/%{name}
# uki-direct
install -m 755 -d  %{buildroot}%{_unitdir}
install -m 755 -d  %{buildroot}%{_prefix}/lib/kernel/install.d
install -m 644 systemd/kernel-bootcfg-boot-successful.service %{buildroot}%{_unitdir}
install -m 755 systemd/99-uki-uefi-setup.install %{buildroot}%{_prefix}/lib/kernel/install.d

%post -n uki-direct
%systemd_post kernel-bootcfg-boot-successful.service

%preun -n uki-direct
%systemd_preun kernel-bootcfg-boot-successful.service

%postun -n uki-direct
%systemd_postun kernel-bootcfg-boot-successful.service

%files -n python3-virt-firmware
%license LICENSE
%doc README.md experimental
%{_bindir}/host-efi-vars
%{_bindir}/virt-fw-dump
%{_bindir}/virt-fw-vars
%{_bindir}/virt-fw-sigdb
%{_bindir}/kernel-bootcfg
%{_bindir}/uefi-boot-menu
%{_bindir}/migrate-vars
%{_bindir}/pe-dumpinfo
%{_bindir}/pe-listsigs
%{_bindir}/pe-addsigs
%{_bindir}/pe-inspect
%{_mandir}/man1/virt-*.1*
%{_mandir}/man1/kernel-bootcfg.1*
%{_mandir}/man1/uefi-boot-menu.1*
%{_mandir}/man1/pe-*.1*
%dir %{python3_sitelib}/virt
%{python3_sitelib}/virt/firmware
%{python3_sitelib}/virt/peutils
%{python3_sitelib}/virt_firmware-%{pypi_version}-py%{python3_version}.egg-info

%files -n python3-virt-firmware-tests
%{_datadir}/%{name}/tests

%files -n uki-direct
%{_unitdir}/kernel-bootcfg-boot-successful.service
%{_prefix}/lib/kernel/install.d/99-uki-uefi-setup.install

%changelog
## START: Generated by rpmautospec
* Fri Nov 29 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.11-1
- update to version 24.11

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 24.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Thu Jul 11 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.7-1
- update to version 24.7

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 24.4-3
- Rebuilt for Python 3.13

* Wed Apr 24 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.4-2
- add qemu-img and dialog as weak dependencies

* Fri Apr 12 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.4-1
- update to version 24.4

* Thu Feb 29 2024 Todd Zullinger <tmz@pobox.com> - 24.2-3
- Avoid unowned %%{python3_sitelib}/virt directory

* Thu Feb 29 2024 Davide Cavalca <dcavalca@fedoraproject.org> - 24.2-2
- Fix install path for kernel install.d hook

* Thu Feb 15 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.2-1
- update to version 24.2

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 24.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 24.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jan 10 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.1.1-2
- add pe test script

* Wed Jan 10 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.1.1-1
- update to version 24.1.1

* Tue Jan 09 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.1-2
- add pe-inspect manpage to file list

* Tue Jan 09 2024 Gerd Hoffmann <kraxel@redhat.com> - 24.1-1
- update to version 24.1

* Thu Nov 30 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.11-1
- update to version 23.11

* Tue Oct 10 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.10-4
- clarify uki-direct dependency on systemd >= 254

* Tue Oct 10 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.10-3
- add pe-inspect to filelist

* Tue Oct 10 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.10-2
- Revert "Add fixes for systemd unit + kernel-install plugin (from master
  branch)."

* Tue Oct 10 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.10-1
- update to version 23.10

* Tue Sep 19 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-6
- Add fixes for systemd unit + kernel-install plugin (from master branch).

* Tue Sep 19 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-5
- add Conflicts line for obsoleted subpackage

* Tue Sep 19 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-4
- use %%_libdir

* Mon Sep 18 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-3
- add uki-direct subpackage

* Mon Sep 18 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-2
- drop -peutils subpackage

* Mon Sep 18 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.9-1
- update to version 23.9

* Fri Sep 15 2023 Daniel P. Berrangé <berrange@redhat.com> - 23.6-4
- Convert to SPDX format

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 23.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Jun 26 2023 Python Maint <python-maint@redhat.com> - 23.6-2
- Rebuilt for Python 3.12

* Mon Jun 19 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.6-1
- update to version 23.6

* Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 23.5-2
- Rebuilt for Python 3.12

* Thu May 04 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.5-1
- update to version 23.5

* Fri Apr 14 2023 Gerd Hoffmann <kraxel@redhat.com> - 23.4-1
- update to version 23.4

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Mon Jan 16 2023 Gerd Hoffmann <kraxel@redhat.com> - 1.8-1
- update to version 1.8

* Fri Dec 02 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.7-1
- update to version 1.7

* Thu Nov 10 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.6-2
- add conflict declaration

* Thu Nov 10 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.6-1
- update to version 1.6
- split peutils to subpackage

* Wed Oct 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.5-1
- update to version 1.5

* Wed Oct 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.4-5
- turn on gating

* Wed Oct 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.4-4
- more test dependency tweaks

* Wed Oct 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.4-3
- tweak test dependencies

* Wed Oct 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.4-2
- add tests

* Tue Sep 27 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.4-1
- update to version 1.4
- add man-pages
- add tests sub-package

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jul 18 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.2-1
- update to version 1.2

* Fri Jul 01 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.1-1
- update to version 1.1

* Wed Jun 22 2022 Gerd Hoffmann <kraxel@redhat.com> - 1.0-1
- update to version 1.0

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.98-2
- Rebuilt for Python 3.11

* Tue May 24 2022 Gerd Hoffmann <kraxel@redhat.com> - 0.98-1
- update to version 0.98

* Mon Apr 11 2022 Gerd Hoffmann <kraxel@redhat.com> - 0.95-1
- Initial package.

## END: Generated by rpmautospec