From 701f14656cf162887d23296a513881c6a35b0db78993e88db9df0b332a5f80c3 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Tue, 5 Apr 2011 22:31:12 +0000 Subject: [PATCH] spec file hackery OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=113 --- libvirt.spec | 83 ++++++++++++++----- ...suse.patch => use-init-script-redhat.patch | 48 ++++++----- 2 files changed, 89 insertions(+), 42 deletions(-) rename use-libvirt-guests-on-suse.patch => use-init-script-redhat.patch (83%) diff --git a/libvirt.spec b/libvirt.spec index 5616f42..c5ca547 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -337,7 +337,7 @@ Patch102: xen-pv-cdrom.patch Patch103: xend-disk-order.patch # Our patches Patch200: libvirtd-defaults.patch -Patch201: use-libvirt-guests-on-suse.patch +Patch201: use-init-script-redhat.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -459,15 +459,18 @@ Authors: %if ! %{with_qemu} %define _without_qemu --without-qemu %endif -%if ! %{with_lxc} -%define _without_lxc --without-lxc -%endif %if ! %{with_openvz} %define _without_openvz --without-openvz %endif +%if ! %{with_lxc} +%define _without_lxc --without-lxc +%endif %if ! %{with_vbox} %define _without_vbox --without-vbox %endif +%if ! %{with_xenapi} +%define _without_xenapi --without-xenapi +%endif %if ! %{with_uml} %define _without_uml --without-uml %endif @@ -477,9 +480,30 @@ Authors: %if ! %{with_esx} %define _without_esx --without-esx %endif +%if ! %{with_vmware} +%define _without_vmware --without-vmware +%endif %if ! %{with_libxl} %define _without_libxl --without-libxl %endif +%if ! %{with_libvirtd} +%define _without_libvirtd --without-libvirtd +%endif +%if ! %{with_storage_fs} +%define _without_storage_fs --without-storage-fs +%endif +%if ! %{with_storage_lvm} +%define _without_storage_lvm --without-storage-lvm +%endif +%if ! %{with_storage_iscsi} +%define _without_storage_iscsi --without-storage-iscsi +%endif +%if ! %{with_storage_disk} +%define _without_storage_disk --without-storage-disk +%endif +%if ! %{with_storage_mpath} +%define _without_storage_mpath --without-storage-mpath +%endif %if ! %{with_numactl} %define _without_numactl --without-numactl %endif @@ -528,19 +552,26 @@ export CFLAGS="$RPM_OPT_FLAGS" %configure --disable-static --with-pic \ %{?_without_xen} \ %{?_without_qemu} \ - %{?_without_lxc} \ %{?_without_openvz} \ + %{?_without_lxc} \ %{?_without_vbox} \ + %{?_without_xenapi} \ %{?_without_uml} \ %{?_without_phyp} \ %{?_without_esx} \ + %{?_without_vmware} \ %{?_without_libxl} \ + %{?_without_libvirtd} \ + %{?_without_storage_fs} \ + %{?_without_storage_lvm} \ + %{?_without_storage_iscsi} \ + %{?_without_storage_disk} \ + %{?_without_storage_mpath} \ %{?_without_numactl} \ %{?_without_selinux} \ %{?_without_apparmor} \ %{?_without_capng} \ %{?_without_netcf} \ - %{?_without_network} \ %{?_without_hal} \ %{?_without_udev} \ %{?_without_yajl} \ @@ -552,6 +583,7 @@ export CFLAGS="$RPM_OPT_FLAGS" %{?_without_libpcap} \ --libexecdir=%{_libdir}/%{name} \ --with-remote-pid-file=%{_localstatedir}/run/libvirtd.pid \ + --with-init-script=redhat \ ac_cv_path_MODPROBE=/sbin/modprobe \ ac_cv_path_UDEVADM=/sbin/udevadm \ ac_cv_path_SHOWMOUNT=/usr/sbin/showmount @@ -567,7 +599,7 @@ mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a %find_lang %{name} %if %{with_network} -install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/ +install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/libvirt/dnsmasq/ install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/ cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \ $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml @@ -593,15 +625,10 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml %endif %if ! %{with_python} -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version} -%endif -%if %{client_only} -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} +rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-python %endif %if ! %{with_libvirtd} rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter -mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version}/html \ - $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-devel-%{version}/ %endif ln_dupes() @@ -622,9 +649,11 @@ ln_dupes() ) # init scripts mkdir -p $RPM_BUILD_ROOT/etc/init.d -install %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/libvirtd -ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT/usr/sbin/rclibvirtd -ln -s /etc/init.d/libvirt-guests $RPM_BUILD_ROOT/usr/sbin/rclibvirt-guests +%if %{with_libvirtd} +install %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirtd +ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd +%endif +ln -s /etc/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests %clean rm -rf $RPM_BUILD_ROOT @@ -632,10 +661,9 @@ rm -rf $RPM_BUILD_ROOT %post /sbin/ldconfig %if %{with_libvirtd} -%if 0%{?sles_version} -%{fillup_and_insserv -f -y libvirtd} -%endif -if test $? != 0 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml +%if %{with_network} +# Install the default network if one doesn't exist +if test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml then UUID=`/usr/bin/uuidgen` sed -e "s,,\n $UUID," \ @@ -643,6 +671,12 @@ then > %{_sysconfdir}/libvirt/qemu/networks/default.xml fi %endif +%if 0%{?sles_version} +%{fillup_and_insserv -y libvirtd} +%else +%{fillup_only -n libvirtd} +%endif +%endif %{fillup_only -n libvirt-guests} %preun @@ -671,16 +705,18 @@ fi %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart +%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/ +%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/ %dir %{_datadir}/libvirt/networks/ %{_datadir}/libvirt/networks/default.xml %endif %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/ %{_sysconfdir}/libvirt/nwfilter/*.xml +%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd %config /etc/init.d/libvirtd %{_sbindir}/rclibvirtd %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd -%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/ %dir %{_localstatedir}/lib/libvirt/ %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/images/ %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/boot/ @@ -717,10 +753,9 @@ fi %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/ #%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/ %endif -%if 0%{with_storage_disk} +%if %{with_storage_disk} %{_libdir}/%{name}/libvirt_parthelper %endif -%{_libdir}/%{name}/libvirt_iohelper %doc %{_mandir}/man8/libvirtd.8* %endif @@ -735,10 +770,12 @@ fi %{_bindir}/virsh %{_bindir}/virt-xml-validate %{_bindir}/virt-pki-validate +%dir %{_libdir}/%{name} %{_libdir}/lib*.so.* %{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests %config /etc/init.d/libvirt-guests %{_sbindir}/rclibvirt-guests +%{_libdir}/%{name}/libvirt_iohelper %dir %{_datadir}/libvirt/ %dir %{_datadir}/libvirt/schemas/ diff --git a/use-libvirt-guests-on-suse.patch b/use-init-script-redhat.patch similarity index 83% rename from use-libvirt-guests-on-suse.patch rename to use-init-script-redhat.patch index eac70f6..d22afa6 100644 --- a/use-libvirt-guests-on-suse.patch +++ b/use-init-script-redhat.patch @@ -2,11 +2,9 @@ Index: libvirt-0.9.0/tools/Makefile.am =================================================================== --- libvirt-0.9.0.orig/tools/Makefile.am +++ libvirt-0.9.0/tools/Makefile.am -@@ -129,18 +129,18 @@ install-data-local: install-init +@@ -131,16 +131,17 @@ uninstall-local: uninstall-init - uninstall-local: uninstall-init - --if LIBVIRT_INIT_SCRIPT_RED_HAT + if LIBVIRT_INIT_SCRIPT_RED_HAT install-init: libvirt-guests.init - mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d + mkdir -p $(DESTDIR)$(sysconfdir)/init.d @@ -14,32 +12,20 @@ Index: libvirt-0.9.0/tools/Makefile.am - $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests - mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig + $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests -+ mkdir -p $(DESTDIR)/var/adm/fillup-templates ++ mkdir -p $(DESTDIR)$(localstatedir)/adm/fillup-templates $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ - $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests -+ $(DESTDIR)/var/adm/fillup-templates/sysconfig.libvirt-guests ++ $(DESTDIR)$(localstatedir)/adm/fillup-templates/sysconfig.libvirt-guests uninstall-init: - rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests \ - $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests + rm -f $(DESTDIR)$(sysconfdir)/init.d/libvirt-guests \ + $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests \ -+ $(DESTDIR)/var/adm/fillup-templates/sysconfig.libvirt-guests ++ $(DESTDIR)$(localstatedir)/adm/fillup-templates/sysconfig.libvirt-guests BUILT_SOURCES += libvirt-guests.init -@@ -155,11 +155,6 @@ libvirt-guests.init: libvirt-guests.init - < $< > $@-t && \ - chmod a+x $@-t && \ - mv $@-t $@ --else --install-init: --uninstall-init: --libvirt-guests.init: --endif # LIBVIRT_INIT_SCRIPT_RED_HAT - - - CLEANFILES = $(bin_SCRIPTS) Index: libvirt-0.9.0/tools/libvirt-guests.sysconf =================================================================== --- libvirt-0.9.0.orig/tools/libvirt-guests.sysconf @@ -228,3 +214,27 @@ Index: libvirt-0.9.0/tools/libvirt-guests.init.sh esac -exit $RETVAL +rc_exit +Index: libvirt-0.9.0/daemon/Makefile.am +=================================================================== +--- libvirt-0.9.0.orig/daemon/Makefile.am ++++ libvirt-0.9.0/daemon/Makefile.am +@@ -280,16 +280,12 @@ install-logrotate: $(LOGROTATE_CONFS) + + if LIBVIRT_INIT_SCRIPT_RED_HAT + install-init: libvirtd.init +- mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d +- $(INSTALL_SCRIPT) libvirtd.init \ +- $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd +- mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig ++ mkdir -p $(DESTDIR)$(localstatedir)/adm/fillup-templates + $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd ++ $(DESTDIR)$(localstatedir)/adm/fillup-templates/sysconfig.libvirtd + + uninstall-init: +- rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd ++ rm -f $(DESTDIR)$(localstatedir)/adm/fillup-templates/sysconfig.libvirtd + + BUILT_SOURCES += libvirtd.init +