Blob Blame History Raw
%if 0%{?rhel} <= 5
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

Name:    genders
Group: Development/Tools
Version: 1.18
Release: 5%{?dist}
Summary: Static cluster configuration database
License: GPLv2
URL: http://%{name}.sf.net
Source: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}-1/%{name}-%{version}.tar.gz
Patch0: %{name}-%{version}-shebang.patch
BuildRequires: bison, flex
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Genders is a static cluster configuration database used for cluster
configuration management.  It is used by a variety of tools and
scripts for management of large clusters.  The genders database is
typically replicated on every node of the cluster. It describes the
layout and configuration of the cluster so that tools and scripts can
sense the variations of cluster nodes. By abstracting this information
into a plain text file, it becomes possible to change the
configuration of a cluster by modifying only one file.

%package compat
Summary: Compatibility library 
Group: Development/Tools
BuildRequires: perl(ExtUtils::MakeMaker)
%if 0%{?rhel} >= 6 || 0%{?fedora} > 0
BuildArch: noarch
%endif
%description compat
Genders API that is compatible with earlier releases of genders.

%package perl
Summary: Perl libraries
Group: Development/Tools
BuildRequires: perl(ExtUtils::MakeMaker)
%description perl
Genders API bindings for perl.

%package python
Summary: Python libraries
Group: Development/Tools
BuildRequires: python, python-devel
%description python
Genders API bindings for python.

%{?filter_setup:
%filter_provides_in %{python_sitearch}/.*\.so$
%filter_provides_in %{perl_vendorarch}/.*\.so$
%filter_setup
}

%package -n libgenders
Summary: Genders libraries
Group: Development/Libraries
%description -n libgenders
Genders API for C.

%package -n libgenders-devel
Summary: Genders development libraries
Group: Development/Libraries
Requires: libgenders%{?_isa} = %{version}-%{release}
%description -n libgenders-devel
Genders development headers and libraries for C.

%package -n libgendersplusplus
Summary: Genders libraries for C++
Group: Development/Libraries
Requires: libgenders%{?_isa} = %{version}-%{release}
%description -n libgendersplusplus
Genders API for C++.

%package -n libgendersplusplus-devel
Summary: Genders development libraries
Group: Development/Libraries
Requires: libgenders-devel%{?_isa} = %{version}-%{release}
Requires: libgendersplusplus%{?_isa} = %{version}-%{release}
%description -n libgendersplusplus-devel
Genders development headers and libraries for C++.

%prep
%setup  -q -n %{name}-%{version}
%patch0 -p1

%if 0%{?rhel} <= 6
cat << \EOF > %{name}-python-prov
#!/bin/sh
%{__python_provides} $* |\
sed -e '/.*Lib%{name}.so.*/d'
EOF

%global __python_provides %{_builddir}/%{name}-%{version}/%{name}-python-prov
chmod +x %{__python_provides}

cat << \EOF > %{name}-perl-prov
#!/bin/sh
%{__perl_provides} $* |\
sed -e '/.*Lib%{name}.so.*/d'
EOF

%global __perl_provides %{_builddir}/%{name}-%{version}/%{name}-perl-prov
chmod +x %{__perl_provides}
%endif

%build
%configure \
    --with-perl-extensions \
    --with-perl-vendor-arch \
    --with-python-extensions \
    --with-cplusplus-extensions \
    --with-extension-destdir="%{buildroot}"
%{__make}

%install
rm -rf %{buildroot}
DESTDIR=%{buildroot} make install
rm -f %{buildroot}/%{_libdir}/*.la
rm -f %{buildroot}/%{_libdir}/*.a
chmod +w %{buildroot}/%{perl_vendorarch}/auto/Lib%{name}/Lib%{name}.so
%if 0%{?rhel} > 0
chmod g-w %{buildroot}/%{python_sitearch}/lib%{name}.so
%endif
rm -f %{buildroot}/%{perl_vendorarch}/auto/Lib%{name}/Lib%{name}.bs
rm -f %{buildroot}/%{perl_vendorarch}/auto/Lib%{name}/.packlist
mkdir -p %{buildroot}/%{_libexecdir}
chmod 0755 %{buildroot}/%{python_sitearch}/lib%{name}.so

%postun -n libgenders -p /sbin/ldconfig
%postun -n libgendersplusplus -p /sbin/ldconfig
%post -n libgenders -p /sbin/ldconfig
%post -n libgendersplusplus -p /sbin/ldconfig

%if 0%{?rhel} <= 6
%clean
rm -rf %{buildroot}
%endif

%files
%defattr(-,root,root,-)
%doc README NEWS ChangeLog DISCLAIMER DISCLAIMER.UC COPYING TUTORIAL genders.sample
%{_mandir}/man1/*
%{_mandir}/man3/genders.3*
%{_bindir}/*

%files -n libgenders
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_libdir}/libgenders.so.0*

%files -n libgenders-devel
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_mandir}/man3/genders_*
%{_mandir}/man3/libgenders* 
%{_includedir}/genders.h
%{_libdir}/libgenders.so

%files -n libgendersplusplus
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_libdir}/libgendersplusplus.so.1*

%files -n libgendersplusplus-devel
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_libdir}/libgendersplusplus.so
%{_includedir}/gendersplusplus*

%files perl
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_mandir}/man3/Libgenders*
%{_mandir}/man3/Genders*
%{perl_vendorarch}/*

%files python
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{python_sitearch}/%{name}.py*
%{python_sitearch}/lib%{name}.so
%{python_sitearch}/lib%{name}-*egg-info

%files compat
%defattr(-,root,root,-)
%doc DISCLAIMER DISCLAIMER.UC COPYING 
%{_mandir}/man3/gendlib*
%{_usr}/lib/genders/*

%changelog
* Fri Jul 5 2012 David Brown <david.brown@pnnl.gov> - 1.18-5
- change mode on python shared objects

* Thu Jul 5 2012 David Brown <david.brown@pnnl.gov> - 1.18-4
- move compat stuff back to hard coded lib directory
- remove parallel build doesn't work with yacc deps

* Thu Apr 12 2012 David Brown <david.brown@pnnl.gov> - 1.18-3
- Add some Groups for EPEL 5/6 repos
- Fix up Changelogs to add spaces

* Wed Apr 11 2012 David Brown <david.brown@pnnl.gov> - 1.18-2
- Followed advice from bugzilla
- Used proper BuildRoot tag
- Removed superfluous '.' from end of descriptions
- Fixed Requires by adding release and _isa
- Changed out RPM_BUILD_ROOT for %{buildroot}
- Added four argument defattr lines in files sections

* Mon Apr 9 2012 David Brown <david.brown@pnnl.gov> - 1.18-1
- initial packaging