Adopt to new packaging guidelines; other fixes

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-04-12 11:27:05 +02:00
parent 147d6207bf
commit 149b26576f
2 changed files with 79 additions and 87 deletions

View File

@ -1,158 +1,150 @@
%global commit d86995b748419bf6ca36f1c7f233727736d2efd5
%if 0%{?rhel} && 0%{?rhel} <= 7
%define python3_build 0
#%{!?__python2: %global __python2 /usr/bin/python2}
#%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
#%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%bcond_with python3
%else
%define python3_build 1
%bcond_without python3
%endif
Name: libcomps
Version: 0.1.7
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Comps XML file manipulation library
Group: Development/Libraries
License: GPLv2+
URL: https://github.com/midnightercz/libcomps/
Source0: https://github.com/midnightercz/libcomps/libcomps-0.1.7.tar.gz
URL: https://github.com/rpm-software-management/libcomps
Source0: %{url}/archive/%{name}-%{version}/%{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: libxml2-devel
BuildRequires: check-devel
BuildRequires: expat-devel
#%if 0%{?rhel} == 6
#BuildRequires: cmake28
#%else
BuildRequires: cmake
#%endif
%description
Libcomps is library for structure-like manipulation with content of
comps XML files. Supports read/write XML file, structure(s) modification.
%package devel
Summary: Development files for libcomps library
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for libcomps library.
%package doc
Summary: Documentation files for libcomps library
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
BuildRequires: doxygen
%description doc
Documentation files for libcomps library
Documentation files for libcomps library.
%package -n python-libcomps-doc
%package -n python-%{name}-doc
Summary: Documentation files for python bindings libcomps library
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
BuildRequires: python-sphinx
%description -n python-libcomps-doc
Documentation files for python bindings libcomps library
%description -n python-%{name}-doc
Documentation files for python bindings libcomps library.
%package devel
Summary: Development files for libcomps library
Group: Development/Libraries
%package -n python2-%{name}
Summary: Python 2 bindings for libcomps library
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for libcomps library
%description -n python2-%{name}
Python 2 bindings for libcomps library.
%package -n python-libcomps
Summary: Python2 bindings for libcomps library
Group: Development/Libraries
BuildRequires: python-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python-libcomps
Python2 bindings for libcomps library
%if %python3_build
%package -n python3-libcomps
Summary: Python3 bindings for libcomps library
Group: Development/Libraries
%if %{with python3}
%package -n python3-%{name}
Summary: Python 3 bindings for libcomps library
BuildRequires: python3-devel
%{?python_provide:%python_provide python3-%{name}}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-libcomps
Python3 bindings for libcomps library
%description -n python3-%{name}
Python3 bindings for libcomps library.
%endif
%prep
%setup -qn %{name}-%{commit}
%autosetup -n %{name}-%{name}-%{version}
%if %python3_build == 1
rm -rf py3
mkdir ../py3
cp -a . ../py3/
mv ../py3 ./
mkdir build
%if %{with python3}
mkdir build-py3
%endif
%build
%cmake -DPYTHON_DESIRED:STRING=2 libcomps/
make %{?_smp_mflags}
make %{?_smp_mflags} docs
make %{?_smp_mflags} pydocs
%if %python3_build == 1
pushd py3
%cmake -DPYTHON_DESIRED:STRING=3 libcomps/
make %{?_smp_mflags}
pushd build
%cmake ../libcomps/ -DPYTHON_DESIRED:STRING=2
%make_build
make %{?_smp_mflags} docs
make %{?_smp_mflags} pydocs
popd
%endif
%check
make test
%if %{python3_build}
pushd py3
make pytest
%if %{with python3}
pushd build-py3
%cmake ../libcomps/ -DPYTHON_DESIRED:STRING=3
%make_build
popd
%endif
%install
make install DESTDIR=%{buildroot}
pushd build
%make_install
popd
%if %{python3_build}
pushd py3
make install DESTDIR=%{buildroot}
%if %{with python3}
pushd build-py3
%make_install
popd
%endif
%clean
rm -rf $buildroot
%check
pushd build
make test
popd
%if %{with python3}
pushd build-py3
make pytest
popd
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%{_libdir}/libcomps.so.*
%doc README.md COPYING
%license COPYING
%doc README.md
%{_libdir}/%{name}.so.*
%files devel
%{_libdir}/libcomps.so
%{_includedir}/*
%{_libdir}/%{name}.so
%{_includedir}/%{name}/
%files doc
%doc docs/libcomps-doc/html
%doc build/docs/libcomps-doc/html
%files -n python-libcomps-doc
%doc src/python/docs/html
%files -n python-%{name}-doc
%doc build/src/python/docs/html
%files -n python-libcomps
%{_libdir}/python2*
#%exclude %{_libdir}/python2/libcomps/__pycache__
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%if %{python3_build}
%files -n python3-libcomps
%{_libdir}/python3*
#%exclude %{_libdir}/python3/libcomps/__pycache__
%if %{with python3}
%files -n python3-%{name}
%{python3_sitearch}/%{name}/
%endif
%changelog
* Tue Apr 12 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.1.7-4
- Adopt to new packaging guidelines
- Use %%license macro
- Fix file ownerships
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

View File

@ -1 +1 @@
59f37f86cd69d3ebeb700959aa606bdf libcomps-0.1.7.tar.gz
c5baced95e7b465dd7e9d8e5bd9094f6 libcomps-0.1.7.tar.gz