# Define options %define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) %define enable_fuse %{?_have_fuse}%{!?_have_fuse:1} %define enable_zookeeper %{?_have_zookeeper}%{!?_have_zookeeper:1} %define enable_corosync %{?_have_corosync}%{!?_have_corosync:1} %define enable_shepherd %{?_have_shepherd}%{!?_have_shepherd:0} %define enable_http %{?_have_http}%{!?_have_http:0} %define enable_nfs %{?_have_nfs}%{!?_have_nfs:0} %define enable_diskvnodes %{?_have_diskvnodes}%{!?_have_diskvnodes:1} %define enable_lttng_ust %{?_have_lttng_ust}%{!?_have_lttng_ust:0} %define enable_accelio %{?_have_accelio}%{!?_have_accelio:0} %define enable_trace %{?_have_trace}%{!?_have_trace:0} # Main Name: sheepdog Summary: The Sheepdog Distributed Storage System for QEMU Version: 1.0_169_g65958e3 Release: 1%{?dist} License: GPLv2 and GPLv2+ Group: System Environment/Base URL: http://sheepdog.github.io/sheepdog Source0: https://github.com/sheepdog/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz # Runtime bits %if %{use_systemd} Requires: systemd %else Requires(post): chkconfig Requires(preun): chkconfig Requires(preun): initscripts %endif %if 0%{?enable_http} Requires: fcgi %endif %if 0%{?enable_lttng_ust} Requires: lttng-ust %endif # Build bits BuildRequires: autoconf automake libtool BuildRequires: userspace-rcu-devel yasm %if %{use_systemd} BuildRequires: systemd-units %endif %if 0%{?enable_http} BuildRequires: libcurl-devel fcgi-devel %endif %if 0%{?enable_nfs} BuildRequires: %{_includedir}/rpc/rpc.h %endif %if 0%{?enable_lttng_ust} BuildRequires: lttng-ust-devel %endif %if 0%{?enable_accelio} BuildRequires: %{_includedir}/libxio.h %endif BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description This package contains the Sheepdog server, and command line tool which offer a distributed object storage system for QEMU. # for libs %package libs Summary: Shared libraries for Sheepdog Group: Applications/File %description libs This package provides the libsheepdog shared library. # for devel %package devel Summary: Header files for Sheepdog Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel This package provides the header files for libsheepdog. # for zookeeper driver %if 0%{?enable_zookeeper} %package zookeeper Summary: ZooKeeper cluster driver for Sheepdog Group: Applications/File Conflicts: %{name}-corosync Requires: %{name}%{?_isa} = %{version}-%{release} BuildRequires: %{_includedir}/zookeeper/zookeeper.h %description zookeeper This package provides the ZooKeeper cluster driver for sheepdog. %endif # for corosync driver %if 0%{?enable_corosync} %package corosync Summary: Corosync cluster driver for Sheepdog Group: Applications/File Conflicts: %{name}-zookeeper Requires: %{name}%{?_isa} = %{version}-%{release} BuildRequires: %{_includedir}/corosync/cpg.h BuildRequires: %{_includedir}/corosync/cfg.h %description corosync This package provides the corosync cluster driver for sheepdog. %endif # for sheepfs %if 0%{?enable_fuse} %package sheepfs Summary: FUSE-based pseudo file system for Sheepdog Group: Applications/File Requires: %{name}%{?_isa} = %{version}-%{release} Requires: fuse BuildRequires: fuse-devel %description sheepfs This package provides the sheepfs. Sheepfs is a FUSE-based pseudo file system in userland to access both sheepdog's internal state (for e.g, cluster info, vdi list) as well as sheepdog's high reliable storage. %endif %prep %setup -q %build # Configure args %if 0%{?enable_fuse} %define fuse_configure_args $(echo "--enable-sheepfs") %else %define fuse_configure_args $(echo "--disable-sheepfs") %endif %if 0%{?enable_shepherd} %define shepherd_configure_args $(echo "--enable-shepherd") %else %define shepherd_configure_args $(echo "--disable-shepherd") %endif %if 0%{?enable_http} %define http_configure_args $(echo "--enable-http") %else %define http_configure_args $(echo "--disable-http") %endif %if 0%{?enable_nfs} %define nfs_configure_args $(echo "--enable-nfs") %else %define nfs_configure_args $(echo "--disable-nfs") %endif %if 0%{?enable_diskvnodes} %define diskvnodes_configure_args $(echo "--enable-diskvnodes") %else %define diskvnodes_configure_args $(echo "--disable-diskvnodes") %endif %if 0%{?enable_lttng_ust} %define lttng_ust_configure_args $(echo "--enable-lttng-ust") %else %define lttng_ust_configure_args $(echo "--disable-lttng-ust") %endif %if 0%{?enable_accelio} %define accelio_configure_args $(echo "--enable-accelio") %else %define accelio_configure_args $(echo "--disable-accelio") %endif %if 0%{?enable_trace} %define trace_configure_args $(echo "--enable-trace") %else %define trace_configure_args $(echo "--disable-trace") %endif # Autogen ./autogen.sh # for zookeeper driver %if 0%{?enable_zookeeper} %{configure} \ --with-initddir=%{_initrddir} \ --enable-zookeeper \ --disable-corosync \ %{?fuse_configure_args} \ %{?http_configure_args} \ %{?nfs_configure_args} \ %{?diskvnodes_configure_args} \ %{?lttng_ust_configure_args} \ %{?accelio_configure_args} \ %{?trace_configure_args} make %{?_smp_mflags} %{__mv} %{_builddir}/%{name}-%{version}/sheep/sheep \ %{_builddir}/%{name}-%{version}/sheep/sheep.zookeeper %{__mv} %{_builddir}/%{name}-%{version}/tools/zk_control \ %{_builddir}/%{name}-%{version}/tools/zk_control.zookeeper make clean %endif # for corosync driver %if 0%{?enable_corosync} %{configure} \ --with-initddir=%{_initrddir} \ --disable-zookeeper \ --enable-corosync \ %{?fuse_configure_args} \ %{?http_configure_args} \ %{?nfs_configure_args} \ %{?diskvnodes_configure_args} \ %{?lttng_ust_configure_args} \ %{?accelio_configure_args} \ %{?trace_configure_args} make %{?_smp_mflags} %{__mv} %{_builddir}/%{name}-%{version}/sheep/sheep \ %{_builddir}/%{name}-%{version}/sheep/sheep.corosync make clean %endif # for localonly driver %{configure} \ --with-initddir=%{_initrddir} \ --disable-zookeeper \ --disable-corosync \ %{?shepherd_configure_args} \ %{?fuse_configure_args} \ %{?http_configure_args} \ %{?nfs_configure_args} \ %{?diskvnodes_configure_args} \ %{?lttng_ust_configure_args} \ %{?accelio_configure_args} \ %{?trace_configure_args} make %{?_smp_mflags} %{__mv} %{_builddir}/%{name}-%{version}/sheep/sheep \ %{_builddir}/%{name}-%{version}/sheep/sheep.local %install %{__rm} -rf %{buildroot} make install DESTDIR=%{buildroot} # drop init file (systemd only) %if %{use_systemd} %{__rm} -f $RPM_BUILD_ROOT%{_initddir}/sheepdog %endif ## tree fixup # drop static libs %{__rm} -f %{buildroot}%{_libdir}/*.a # drop libtool library file %{__rm} -f %{buildroot}%{_libdir}/*.la # drop dirty sbin/sheep %{__rm} -f %{buildroot}%{_sbindir}/sheep # install collie command %{__ln_s} -f dog $RPM_BUILD_ROOT%{_bindir}/collie # install sysconfig template %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig %{__install} -m644 %{_builddir}/%{name}-%{version}/script/sheepdog.sysconfig \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sheepdog ## install drivers # install zookeeper driver %if 0%{?enable_zookeeper} %{__install} -m755 %{_builddir}/%{name}-%{version}/sheep/sheep.zookeeper \ $RPM_BUILD_ROOT%{_sbindir}/sheep.zookeeper %{__install} -m755 %{_builddir}/%{name}-%{version}/tools/zk_control.zookeeper \ $RPM_BUILD_ROOT%{_sbindir}/zk_control.zookeeper %endif # install corosync driver %if 0%{?enable_corosync} %{__install} -m755 %{_builddir}/%{name}-%{version}/sheep/sheep.corosync \ $RPM_BUILD_ROOT%{_sbindir}/sheep.corosync %endif # install localonly driver %{__install} -m755 %{_builddir}/%{name}-%{version}/sheep/sheep.local \ $RPM_BUILD_ROOT%{_sbindir}/sheep.local %clean %{__rm} -rf %{buildroot} %post %if %{use_systemd} %{_bindir}/systemctl preset sheepdog.service >/dev/null 2>&1 || : %else /sbin/chkconfig --add sheepdog %endif if [ ! -L %{_sbindir}/sheep ]; then %{__ln_s} -f sheep.local %{_sbindir}/sheep fi %if 0%{?enable_zookeeper} %post zookeeper %{__ln_s} -f sheep.zookeeper %{_sbindir}/sheep %{__ln_s} -f zk_control.zookeeper %{_sbindir}/zk_control %endif %if 0%{?enable_corosync} %post corosync %{__ln_s} -f sheep.corosync %{_sbindir}/sheep %endif %preun if [ $1 -eq 0 ] ; then %if %{use_systemd} %{_bindir}/systemctl --no-reload disable sheepdog.service >/dev/null 2>&1 || : %{_bindir}/systemctl stop sheepdog.service >/dev/null 2>&1 || : %else /sbin/service sheepdog stop >/dev/null 2>&1 /sbin/chkconfig --del sheepdog %endif fi %postun if [ "$1" -ge "1" ] ; then %if %{use_systemd} %{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || : %{_bindir}/systemctl try-restart sheepdog.service >/dev/null 2>&1 || : %else /sbin/service sheepdog condrestart >/dev/null 2>&1 || : %endif fi if [ $1 -eq 0 ] && [ -L %{_sbindir}/sheep ] ; then /bin/unlink %{_sbindir}/sheep fi %if 0%{?enable_zookeeper} %postun zookeeper if [ $1 -eq 0 ] ; then /bin/unlink %{_sbindir}/zk_control if [ ! -L %{_sbindir}/sheep ]; then %{__ln_s} -f sheep.local %{_sbindir}/sheep fi fi %endif %if 0%{?enable_corosync} %postun corosync if [ $1 -eq 0 ] && [ ! -L %{_sbindir}/sheep ]; then %{__ln_s} -f sheep.local %{_sbindir}/sheep fi %endif %files %defattr(-,root,root,-) %doc COPYING README INSTALL %{_sbindir}/sheep.local %{_bindir}/collie %{_bindir}/dog %dir %{_localstatedir}/lib/sheepdog %config %{_sysconfdir}/bash_completion.d/dog %{_mandir}/man8/sheep.8* %{_mandir}/man8/dog.8* %config %{_sysconfdir}/sysconfig/sheepdog %if %{use_systemd} %{_unitdir}/sheepdog.service %else %attr(755,-,-)%config %{_initddir}/sheepdog %endif %if 0%{?enable_shepherd} %{_sbindir}/shepherd %endif # for libs %files libs %defattr(-,root,root,-) %{_libdir}/*.so # for devel %files devel %defattr(-,root,root,-) %dir %{_includedir}/sheepdog %{_includedir}/sheepdog/*.h # for zookeeper driver %if 0%{?enable_zookeeper} %files zookeeper %defattr(-,root,root,-) %{_sbindir}/sheep.zookeeper %{_sbindir}/zk_control.zookeeper %endif # for corosync driver %if 0%{?enable_corosync} %files corosync %defattr(-,root,root,-) %{_sbindir}/sheep.corosync %endif # for sheepfs %if 0%{?enable_fuse} %files sheepfs %defattr(-,root,root,-) %{_sbindir}/sheepfs %{_mandir}/man8/sheepfs.8* %endif %changelog * Thu Aug 10 2017 Autotools generated version - 1.0_169_g65958e3-1.@alphatag@ - Autotools generated version