Adopt to new packaging guidelines; Cleanups in spec file

Acked-by: Tomas Mlcoch <tmlcoch@redhat.com>
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1324840
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-04-07 14:21:46 +02:00
parent 19670f5031
commit 98638e6d85
3 changed files with 51 additions and 54 deletions

1
.gitignore vendored
View File

@ -38,3 +38,4 @@
/librepo-d9bed0d.tar.xz
/librepo-7ba0722.tar.xz
/librepo-68724dc.tar.xz
/librepo-1.7.18.tar.gz

View File

@ -1,7 +1,7 @@
%{!?gitrev: %global gitrev 68724dc}
# gitrev is output of: git rev-parse --short HEAD
%if 0%{?rhel} != 0 && 0%{?rhel} <= 7
%if 0%{?rhel} && 0%{?rhel} <= 7
# Do not build bindings for python3 for RHEL <= 7
%bcond_with python3
# python-flask is not in RHEL7
@ -13,20 +13,16 @@
Name: librepo
Version: 1.7.18
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Repodata downloading library
Group: System Environment/Libraries
License: LGPLv2+
URL: https://github.com/Tojaj/librepo
# Use the following commands to generate the tarball:
# git clone https://github.com/Tojaj/librepo.git
# cd librepo
# utils/make_tarball.sh %{gitrev}
Source0: librepo-%{gitrev}.tar.xz
URL: https://github.com/rpm-software-management/librepo
Source0: %{url}/archive/%{name}-%{version}/%{name}-%{version}.tar.gz
BuildRequires: check-devel
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: check-devel
BuildRequires: doxygen
BuildRequires: expat-devel
BuildRequires: glib2-devel >= 2.26.0
@ -35,28 +31,20 @@ BuildRequires: libattr-devel
BuildRequires: libcurl-devel >= 7.19.0
BuildRequires: openssl-devel
# prevent provides from nonstandard paths:
%filter_provides_in %{python_sitearch}/.*\.so$
%if %{with python3}
%filter_provides_in %{python3_sitearch}/.*\.so$
%endif
%filter_setup
%description
A library providing C and Python (libcURL like) API to downloading repository
metadata.
%package devel
Summary: Repodata downloading library
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for librepo.
%package -n python-librepo
%package -n python2-%{name}
Summary: Python bindings for the librepo library
Group: Development/Languages
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: pygpgme
BuildRequires: python2-devel
%if %{with tests}
@ -67,62 +55,65 @@ BuildRequires: python-sphinx
BuildRequires: pyxattr
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python-librepo
Python bindings for the librepo library.
%description -n python2-%{name}
Python 2 bindings for the librepo library.
%if %{with python3}
%package -n python3-librepo
%package -n python3-%{name}
Summary: Python 3 bindings for the librepo library
Group: Development/Languages
%{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-pygpgme
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3-flask
BuildRequires: python3-nose
%endif
BuildRequires: python3-sphinx
BuildRequires: python3-pyxattr
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-librepo
%description -n python3-%{name}
Python 3 bindings for the librepo library.
%endif
%prep
%setup -q -n librepo
%autosetup -n %{name}-%{name}-%{version}
%if %{with python3}
rm -rf py3
mkdir ../py3
cp -a . ../py3/
mv ../py3 ./
%endif
mkdir build build-py3
%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .
make %{?_smp_mflags}
pushd build
%cmake ..
%make_build
popd
%if %{with python3}
pushd py3
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_DESIRED:str=3 .
make %{?_smp_mflags}
pushd build-py3
%cmake -DPYTHON_DESIRED:str=3 ..
%make_build
popd
%endif
%check
%if %{with tests}
make ARGS="-V" test
%check
pushd build
ctest -VV
popd
%if %{with python3}
pushd py3
make ARGS="-V" test
pushd build-py3
ctest -VV
popd
%endif
%endif
%install
make install DESTDIR=$RPM_BUILD_ROOT
pushd build
%make_install
popd
%if %{with python3}
pushd py3
make install DESTDIR=$RPM_BUILD_ROOT
pushd build-py3
%make_install
popd
%endif
@ -131,23 +122,28 @@ popd
%postun -p /sbin/ldconfig
%files
%doc COPYING README.md
%{_libdir}/librepo.so.*
%license COPYING
%doc README.md
%{_libdir}/%{name}.so.*
%files devel
%{_libdir}/librepo.so
%{_libdir}/pkgconfig/librepo.pc
%{_includedir}/librepo/
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}/
%files -n python-librepo
%{python_sitearch}/librepo/
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%if %{with python3}
%files -n python3-librepo
%{python3_sitearch}/
%files -n python3-%{name}
%{python3_sitearch}/%{name}/
%endif
%changelog
* Thu Apr 07 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.7.18-2
- Adopt to new packaging guidelines
- Cleanups in spec file
* Fri Mar 4 2016 Tomas Mlcoch <tmlcoch@redhat.com> - 1.7.18-1
- Add new option LRO_FTPUSEEPSV
- Update AUTHORS

View File

@ -1 +1 @@
9c034c118551b37b599feca04442f8df librepo-68724dc.tar.xz
4b28cfad651110b4b033825dc8f8b7cf librepo-1.7.18.tar.gz