From ca2cf7466f60ba870d78c4902a3cc85cf4ce7961 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 27 Mar 2025 14:34:52 +0100 Subject: [PATCH] Make installation of shell completions and man pages more robust Without this, OpenScanHub fails to run the install step as it injects clippy build into the process, which creates different configuration and therefore different build directory. Taken from Fedora change https://src.fedoraproject.org/rpms/rust-sequoia-sqv/c/790309acb1ea3fba87c32013ea086f1c36b7d961 Related: RHEL-84164 --- rust-sequoia-sqv.spec | 9 +++++---- rust2rpm.toml | 12 +++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rust-sequoia-sqv.spec b/rust-sequoia-sqv.spec index d8da1de..956af82 100644 --- a/rust-sequoia-sqv.spec +++ b/rust-sequoia-sqv.spec @@ -108,6 +108,7 @@ License: %{shrink: %endif %build +export ASSET_OUT_DIR=target/assets %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies @@ -116,13 +117,13 @@ License: %{shrink: %cargo_install # install manual pages mkdir -p %{buildroot}/%{_mandir}/man1 -cp -pav target/release/build/%{crate}-*/out/man-pages/sqv*.1 %{buildroot}/%{_mandir}/man1/ +cp -pav target/assets/man-pages/sqv*.1 %{buildroot}/%{_mandir}/man1/ # install shell completions -install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sqv.bash \ +install -Dpm 0644 target/assets/shell-completions/sqv.bash \ %{buildroot}/%{bash_completions_dir}/sqv.bash -install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sqv.fish \ +install -Dpm 0644 target/assets/shell-completions/sqv.fish \ %{buildroot}/%{fish_completions_dir}/sqv.fish -install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/_sqv \ +install -Dpm 0644 target/assets/shell-completions/_sqv \ %{buildroot}/%{zsh_completions_dir}/_sqv %if %{with check} diff --git a/rust2rpm.toml b/rust2rpm.toml index a44c865..d8e8d03 100644 --- a/rust2rpm.toml +++ b/rust2rpm.toml @@ -1,7 +1,6 @@ [package] cargo-toml-patch-comments = [ "switch crypto backend from Nettle to OpenSSL", - "exclude files that are only useful for upstream development", "drop features for unsupported crypto backends", ] extra-files = [ @@ -12,16 +11,19 @@ extra-files = [ ] [scripts] +build.pre = [ + "export ASSET_OUT_DIR=target/assets", +] install.post = [ "# install manual pages", "mkdir -p %{buildroot}/%{_mandir}/man1", - "cp -pav target/release/build/%{crate}-*/out/man-pages/sqv*.1 %{buildroot}/%{_mandir}/man1/", + "cp -pav target/assets/man-pages/sqv*.1 %{buildroot}/%{_mandir}/man1/", "# install shell completions", - "install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sqv.bash \\", + "install -Dpm 0644 target/assets/shell-completions/sqv.bash \\", " %{buildroot}/%{bash_completions_dir}/sqv.bash", - "install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sqv.fish \\", + "install -Dpm 0644 target/assets/shell-completions/sqv.fish \\", " %{buildroot}/%{fish_completions_dir}/sqv.fish", - "install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/_sqv \\", + "install -Dpm 0644 target/assets/shell-completions/_sqv \\", " %{buildroot}/%{zsh_completions_dir}/_sqv", ]