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

1bcf609430

Related: RHEL-84033
This commit is contained in:
Jakub Jelen 2025-03-27 14:38:39 +01:00
parent 97f54e6bab
commit 56ab30f457
2 changed files with 12 additions and 8 deletions

View File

@ -145,6 +145,7 @@ popd
%endif %endif
%build %build
export ASSET_OUT_DIR=target/assets
%if %{with bundled_capnproto} %if %{with bundled_capnproto}
pushd bundled_capnproto pushd bundled_capnproto
%cmake -DBUILD_TESTING=OFF %cmake -DBUILD_TESTING=OFF
@ -160,13 +161,13 @@ popd
%cargo_install %cargo_install
# install manual pages # install manual pages
mkdir -p %{buildroot}/%{_mandir}/man1 mkdir -p %{buildroot}/%{_mandir}/man1
cp -pav target/release/build/%{crate}-*/out/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/ cp -pav target/assets/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/
# install shell completions # install shell completions
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.bash \ install -Dpm 0644 target/assets/shell-completions/sq.bash \
%{buildroot}/%{bash_completions_dir}/sq.bash %{buildroot}/%{bash_completions_dir}/sq.bash
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.fish \ install -Dpm 0644 target/assets/shell-completions/sq.fish \
%{buildroot}/%{fish_completions_dir}/sq.fish %{buildroot}/%{fish_completions_dir}/sq.fish
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/_sq \ install -Dpm 0644 target/assets/shell-completions/_sq \
%{buildroot}/%{zsh_completions_dir}/_sq %{buildroot}/%{zsh_completions_dir}/_sq
%if %{with check} %if %{with check}

View File

@ -21,16 +21,19 @@ prep.post = [
"rm -vr subplot/", "rm -vr subplot/",
"rm -v tests/sq-subplot.rs", "rm -v tests/sq-subplot.rs",
] ]
build.pre = [
"export ASSET_OUT_DIR=target/assets",
]
install.post = [ install.post = [
"# install manual pages", "# install manual pages",
"mkdir -p %{buildroot}/%{_mandir}/man1", "mkdir -p %{buildroot}/%{_mandir}/man1",
"cp -pav target/release/build/%{crate}-*/out/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/", "cp -pav target/assets/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/",
"# install shell completions", "# install shell completions",
"install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.bash \\", "install -Dpm 0644 target/assets/shell-completions/sq.bash \\",
" %{buildroot}/%{bash_completions_dir}/sq.bash", " %{buildroot}/%{bash_completions_dir}/sq.bash",
"install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.fish \\", "install -Dpm 0644 target/assets/shell-completions/sq.fish \\",
" %{buildroot}/%{fish_completions_dir}/sq.fish", " %{buildroot}/%{fish_completions_dir}/sq.fish",
"install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/_sq \\", "install -Dpm 0644 target/assets/shell-completions/_sq \\",
" %{buildroot}/%{zsh_completions_dir}/_sq", " %{buildroot}/%{zsh_completions_dir}/_sq",
] ]