From c64efc8b27c0816f87fd11266ba265b82f3ee53c6cd9747517a2f55aaf9b5a9b Mon Sep 17 00:00:00 2001 From: Caleb Crane Date: Thu, 7 Mar 2024 15:46:02 +0000 Subject: [PATCH] Accepting request 1155986 from home:bnavigator:branches:Virtualization - Fix libexecdir move: rpm cannot replace a directory with a single file on upgrades -- boo#1220592 * Add pre scriptlet removing the directory on Tumbleweed during upgrades * Don't own plain %_libexecdir on Tumbleweed OBS-URL: https://build.opensuse.org/request/show/1155986 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtiofsd?expand=0&rev=21 --- virtiofsd.changes | 9 +++++++++ virtiofsd.spec | 22 ++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/virtiofsd.changes b/virtiofsd.changes index 1f89119..7820ccd 100644 --- a/virtiofsd.changes +++ b/virtiofsd.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Mar 7 14:03:20 UTC 2024 - Ben Greiner + +- Fix libexecdir move: rpm cannot replace a directory with a single + file on upgrades -- boo#1220592 + * Add pre scriptlet removing the directory on Tumbleweed during + upgrades + * Don't own plain %_libexecdir on Tumbleweed + ------------------------------------------------------------------- Wed Feb 28 15:08:19 UTC 2024 - Caleb Crane diff --git a/virtiofsd.spec b/virtiofsd.spec index 586aa1d..1a2fbc2 100644 --- a/virtiofsd.spec +++ b/virtiofsd.spec @@ -16,9 +16,10 @@ # -%define _virtiofsd_dir %{_libexecdir} -%if 0%{?suse_version} <= 1500 - %define _virtiofsd_dir %{_libexecdir}/%{name} +%if 0%{?suse_version} > 1500 + %define _virtiofsd_libexecdir %{_libexecdir} +%else + %define _virtiofsd_libexecdir %{_libexecdir}/%{name} %endif Name: virtiofsd @@ -47,23 +48,28 @@ mkdir .cargo cp %{SOURCE2} .cargo/config # Adjust libvirt/virtiofsd interop config file to handle differences in # the definition of libexecdir macro on SLE and Tumbleweed (bsc#1219772) -sed -i 's#@@LIBEXECDIR@@#%{_virtiofsd_dir}#' %{SOURCE3} +sed -i 's#@@LIBEXECDIR@@#%{_virtiofsd_libexecdir}#' %{SOURCE3} %build %{cargo_build} %install -mkdir -p %{buildroot}%{_virtiofsd_dir} -install -D -p -m 0755 %{_builddir}/%{name}-%{version}/target/release/virtiofsd %{buildroot}%{_virtiofsd_dir}/virtiofsd +mkdir -p %{buildroot}%{_virtiofsd_libexecdir} +install -D -p -m 0755 %{_builddir}/%{name}-%{version}/target/release/virtiofsd %{buildroot}%{_virtiofsd_libexecdir}/virtiofsd install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/qemu/vhost-user/50-virtiofsd.json %check %{cargo_test} +%if 0%{?suse_version} > 1500 +# transition from old subdirectory to single file: rpm can't replace a directory on upgrades, force delete +%pre +[ ! -d %{_libexecdir}/%{name} ] || rm -r %{_libexecdir}/%{name} +%endif + %files %doc README.md -%dir %{_virtiofsd_dir} -%{_virtiofsd_dir}/virtiofsd +%{_libexecdir}/virtiofsd %dir %{_datadir}/qemu %dir %{_datadir}/qemu/vhost-user %{_datadir}/qemu/vhost-user/50-virtiofsd.json