[libvirt] Patch replaces scriptlets with new systemd macros

Eric Blake eblake at redhat.com
Wed Oct 24 17:30:20 UTC 2012


On 10/24/2012 04:37 AM, Václav Pavlín wrote:
> Hi,
> 
> I created patch for spec file to follow changes in guidelines with
> respect to new systemd macros (see
> https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd)
> 
> 
> new-systemd-macros.patch
> 
> 
> diff --git a/libvirt.spec b/libvirt.spec
> index b47ec0e..675290f 100644
> --- a/libvirt.spec
> +++ b/libvirt.spec

Upstream, we would want to patch libvirt.spec.in (the parent of
libvirt.spec).

> @@ -316,7 +316,7 @@
>  Summary: Library providing a simple virtualization API
>  Name: libvirt
>  Version: 0.10.2
> -Release: 3%{?dist}%{?extra_release}
> +Release: 4%{?dist}%{?extra_release}

This is a downstream-only change, since upstream libvirt.spec.in does
not track downstream releases.  Besides, downstream is more likely to
use the upstream v0.10.2-maint branch and use 0.10.2.1-1 as the next
build for Fedora 18.

>  %if %{with_systemd}
> -if [ $1 -eq 1 ] ; then
> -    # Initial installation
> -    /bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
> -    /bin/systemctl enable cgconfig.service >/dev/null 2>&1 || :
> -fi
> +%systemd_post libvirtd.service cgconfig.service

Hmm - we may have a pre-existing issue: this is a case of enabling a
service that we don't own, but where cgconfig.service is a prerequisite
of libvirtd.service.  Is this really the right order for enabling the
two services, and is it really necessary for use to explicitly enable
cgconfig.service, or should the contents of libvirtd.service be adequate
for systemd to automatically figure out the dependency?

>  
>  %changelog
> +* Fri Oct 19 2012 Václav Pavlín <vpavlin at redhat.com> - 0.10.2-4
> +- Scriptlets replaced with new systemd macros (#850186)

Again, %changelog is something only needed for downstream builds.  Also,
your patch is missing a conversion for libvirt-guests.service, also in
the spec file:

$ grep -C2 libvirt-guests.service libvirt.spec.in
# If the package is allowed to autostart:
/bin/systemctl --no-reload enable libvirt-guests.service >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del libvirt-guests >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirt-guests.service >/dev/null 2>&1 || :
%endif

--
%{_sysconfdir}/rc.d/init.d/libvirt-guests
%if %{with_systemd}
%{_unitdir}/libvirt-guests.service
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests


-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121024/0206484f/attachment-0001.sig>


More information about the libvir-list mailing list