Unify %prep with C10S

%cargo_prep with -V is deprecated and not supported anymore in C10S. In
C9S is still supported, but it extract the vendored crates to a
different path than the -v option in C10S. Unify the %prep steps between
both, based on the changes from commit 275c491a and 97cfe099.

An advantage of this is that the vendored crates are extracted to the
same path, so if we need to patch any (unrecommended), the patch can be
the same for C10S and C9S. Otherwise we would need to adjust the file
paths.
This commit is contained in:
Íñigo Huguet 2026-05-06 11:34:54 +02:00
parent ac933c2631
commit a63f3f6fef

View File

@ -78,12 +78,23 @@ This package contains the Python 3 library for Nmstate.
%prep
gpg2 --import --import-options import-export,import-minimal %{SOURCE2} > ./gpgkey-mantainers.gpg
gpgv2 --keyring ./gpgkey-mantainers.gpg %{SOURCE1} %{SOURCE0}
%autosetup -p1
%autosetup -n %{name}-%{version_no_tilde} -p1 %{?rhel:-a3}
# If we have a patch for a vendored dependency, cargo refuses to build,
# in order to prevent accidental manual changes to vendored crates.
# This is not needed in an rpm build. Clear the list of files for which
# to check the checksum.
find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
pushd rust
# Source3 is vendored dependencies
%cargo_prep -V 3
%if 0%{?rhel}
mv ../vendor ./
%cargo_prep -v vendor
%else
%cargo_prep
%endif
popd
%build
@ -92,6 +103,11 @@ pushd rust/src/python
popd
pushd rust
%cargo_build
%cargo_license_summary
%{cargo_license} > ../LICENSE.dependencies
%if 0%{?rhel}
%cargo_vendor_manifest
%endif
popd
%install
@ -108,6 +124,10 @@ popd
%files
%doc README.md
%license LICENSE.dependencies
%if 0%{?rhel}
%license rust/cargo-vendor.txt
%endif
%doc examples/
%{_mandir}/man8/nmstate.service.8*
%{_mandir}/man8/nmstatectl.8*