[libvirt] Patch replaces scriptlets with new systemd macros
Václav Pavlín
vpavlin at redhat.com
Thu Oct 25 10:10:55 UTC 2012
Hi,
sorry, I didn't realize I have to modify upstream version.
I added Requires stanza to libvirtd service file for cgconfig.service,
so you should not need to call enable in spec file for it.
I added %with_systemd_macros so it should now work in F17 with old
scriptlets and in F18+/RHEL7+ with systemd macros
I missed libvirt-guests.service because there is no systemctl call for
it. So I only added systemd macros calls.
Release and Changelog are untouched so you can modify it as you need.
Regards
Vaclav
Eric Blake píše v St 24. 10. 2012 v 11:30 -0600:
> 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
>
>
More information about the libvir-list
mailing list