From a63f3f6fef118288b6017b880d19bebb4c5839ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Wed, 6 May 2026 11:34:54 +0200 Subject: [PATCH] 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. --- nmstate.spec | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/nmstate.spec b/nmstate.spec index 9fedc11..9310b3a 100644 --- a/nmstate.spec +++ b/nmstate.spec @@ -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*