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