[libvirt] [PATCH] build: move file deleting action from %files list to %install

When building libvirt rpms on rhel5, I got the following error: File must begin with "/": rm File must begin with "/": -f File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd Installed (but unpackaged) file(s) found: /etc/sysctl.d/libvirtd It is triggerd by the %files list of libvirt daemon: %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %else rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf %endif After checking document of rpm spec file, I think it would be better to move the file deleting line from %files list to %install script. --- libvirt.spec.in | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 52da4f4..4872c07 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1420,6 +1420,10 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \ %endif %endif +%if 0%{?fedora} < 14 || 0%{?rhel} == 5 +rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf +%endif + %clean rm -fr %{buildroot} @@ -1679,8 +1683,6 @@ fi %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf -%else -rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf %endif %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/ -- 1.7.4.1

On 01/09/2013 05:18 AM, Yufang Zhang wrote:
When building libvirt rpms on rhel5, I got the following error:
File must begin with "/": rm File must begin with "/": -f File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd Installed (but unpackaged) file(s) found: /etc/sysctl.d/libvirtd
It is triggerd by the %files list of libvirt daemon:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %else rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf %endif
After checking document of rpm spec file, I think it would be better to move the file deleting line from %files list to %install script.
Correct intention, but not quite the right patch.
+%if 0%{?fedora} < 14 || 0%{?rhel} == 5
Oops; this fails on RHEL 6 (since there, %{?fedora} is 0 so the left half is always true); and on RHEL 4 (if anyone seriously tries to port that far back). The correct inversion of: %if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 would be: %if 0%{?fedoa} < 14 && 0%{?rhel} < 6 ACK with that change, and will push shortly. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 01/09/2013 05:13 PM, Eric Blake wrote:
On 01/09/2013 05:18 AM, Yufang Zhang wrote:
When building libvirt rpms on rhel5, I got the following error:
File must begin with "/": rm File must begin with "/": -f File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd Installed (but unpackaged) file(s) found: /etc/sysctl.d/libvirtd
It is triggerd by the %files list of libvirt daemon:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %else rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf
ACK with that change, and will push shortly.
And since I recently introduced that bug on v0.10.2-maint as well, I'm backporting this patch too. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 01/09/2013 07:13 PM, Eric Blake wrote:
On 01/09/2013 05:18 AM, Yufang Zhang wrote:
When building libvirt rpms on rhel5, I got the following error:
File must begin with "/": rm File must begin with "/": -f File must begin with "/": $RPM_BUILD_ROOT/etc/sysctl.d/libvirtd Installed (but unpackaged) file(s) found: /etc/sysctl.d/libvirtd
It is triggerd by the %files list of libvirt daemon:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %else rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf %endif
After checking document of rpm spec file, I think it would be better to move the file deleting line from %files list to %install script. Correct intention, but not quite the right patch.
+%if 0%{?fedora} < 14 || 0%{?rhel} == 5
Oops; this fails on RHEL 6 (since there, %{?fedora} is 0 so the left half is always true); and on RHEL 4 (if anyone seriously tries to port that far back). The correct inversion of:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
would be:
%if 0%{?fedoa} < 14 && 0%{?rhel} < 6
ACK with that change, and will push shortly.
Does anybody other than RHEL or Fedora use the specfile? If they ever did, yours would fail too :-)

On 01/10/2013 06:47 AM, Laine Stump wrote:
It is triggerd by the %files list of libvirt daemon:
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6 %config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf %else rm -f $RPM_BUILD_ROOT%{_prefix}/lib/sysctl.d/libvirtd.conf %endif
%if 0%{?fedoa} < 14 && 0%{?rhel} < 6
ACK with that change, and will push shortly.
Does anybody other than RHEL or Fedora use the specfile? If they ever did, yours would fail too :-)
No - if anyone other than RHEL or Fedora uses the specfile, then %{_prefix}/lib/sysctl.d/libvirtd.conf is never installed, so it must be removed to avoid rpm complaining about leftover files. It some other distro wants libvirtd.conf installed, they have to touch both code places, keeping the conditions in sync (and if that is the case, there's probably a lot of other conditions they'd want to tweak). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Laine Stump
-
Yufang Zhang