Follow new packaging guidelines; Other fixes

Reviewed-by: Tomas Mlcoch <tmlcoch@redhat.com>
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1325669
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-04-10 15:52:18 +02:00
parent 90ed72d716
commit 448300b9e8
3 changed files with 73 additions and 85 deletions

1
.gitignore vendored
View File

@ -38,3 +38,4 @@
/createrepo_c-a3aaa03.tar.xz /createrepo_c-a3aaa03.tar.xz
/createrepo_c-7b68123.tar.xz /createrepo_c-7b68123.tar.xz
/createrepo_c-7a74bb7.tar.xz /createrepo_c-7a74bb7.tar.xz
/createrepo_c-0.10.0.tar.gz

View File

@ -1,15 +1,15 @@
%global gitrev 7a74bb7 %{!?_licensedir:%global license %%doc}
# gitrev is output of: git rev-parse --short HEAD
# Bash completion (we need different approach for RHEL-6) # Bash completion (we need different approach for RHEL-6)
%if 0%{?rhel} == 6 %if 0%{?rhel} == 6
%define bash_completion %config%{_sysconfdir}/bash_completion.d/createrepo_c.bash %global bash_completion %config%{_sysconfdir}/bash_completion.d/createrepo_c.bash
%else %else
%define bash_completion %{_datadir}/bash-completion/completions/* %global bash_completion %{_datadir}/bash-completion/completions/*
%endif %endif
# Python 3 bindings (we don't want python3 bindings in RHEL-7) %{!?python2_sitearch:%global python2_sitearch %{python_sitearch}}
%if 0%{?rhel} != 0 && 0%{?rhel} <= 7
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3 %bcond_with python3
%else %else
%bcond_without python3 %bcond_without python3
@ -18,18 +18,14 @@
Summary: Creates a common metadata repository Summary: Creates a common metadata repository
Name: createrepo_c Name: createrepo_c
Version: 0.10.0 Version: 0.10.0
Release: 3%{?dist} Release: 4%{?dist}
License: GPLv2 License: GPLv2+
Group: System Environment/Base URL: https://github.com/rpm-software-management/createrepo_c
# Use the following commands to generate the tarball: Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# git clone https://github.com/Tojaj/createrepo_c.git
# cd createrepo_c
# utils/make_tarball.sh %{gitrev}
Source0: createrepo_c-%{gitrev}.tar.xz
URL: https://github.com/Tojaj/createrepo_c
BuildRequires: bzip2-devel
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc
BuildRequires: bzip2-devel
BuildRequires: doxygen BuildRequires: doxygen
BuildRequires: expat-devel BuildRequires: expat-devel
BuildRequires: file-devel BuildRequires: file-devel
@ -48,7 +44,7 @@ Requires: rpm >= 4.8.0-28
BuildRequires: bash-completion BuildRequires: bash-completion
Requires: rpm >= 4.9.0 Requires: rpm >= 4.9.0
%endif %endif
%if 0%{?fedora} >= 21 %if 0%{?fedora}
BuildRequires: drpm-devel >= 0.1.3 BuildRequires: drpm-devel >= 0.1.3
%endif %endif
@ -60,123 +56,109 @@ rpm packages and maintaining it.
%package libs %package libs
Summary: Library for repodata manipulation Summary: Library for repodata manipulation
Group: Development/Libraries
%description libs %description libs
Libraries for applications using the createrepo_c library Libraries for applications using the createrepo_c library
for easy manipulation with a repodata. for easy manipulation with a repodata.
%package devel %package devel
Summary: Library for repodata manipulation Summary: Library for repodata manipulation
Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: pkgconfig >= 1:0.14
Requires: %{name}-libs = %{version}-%{release}
%description devel %description devel
This package contains the createrepo_c C library and header files. This package contains the createrepo_c C library and header files.
These development files are for easy manipulation with a repodata. These development files are for easy manipulation with a repodata.
%package -n python-createrepo_c %package -n python2-%{name}
Summary: Python bindings for the createrepo_c library Summary: Python bindings for the createrepo_c library
Group: Development/Languages %{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-nose BuildRequires: python-nose
BuildRequires: python-sphinx BuildRequires: python-sphinx
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
%description -n python-createrepo_c %description -n python2-%{name}
Python bindings for the createrepo_c library. Python bindings for the createrepo_c library.
%if %{with python3} %if %{with python3}
%package -n python3-createrepo_c %package -n python3-%{name}
Summary: Python 3 bindings for the createrepo_c library Summary: Python 3 bindings for the createrepo_c library
Group: Development/Languages %{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-nose BuildRequires: python3-nose
BuildRequires: python3-sphinx BuildRequires: python3-sphinx
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
%description -n python3-createrepo_c %description -n python3-%{name}
Python 3 bindings for the createrepo_c library. Python 3 bindings for the createrepo_c library.
%endif %endif
############
%prep %prep
%setup -q -n createrepo_c %setup -q
mkdir build
%if %{with python3} %if %{with python3}
rm -rf py3 mkdir build-py3
mkdir ../py3
cp -a . ../py3/
mv ../py3 ./
%endif %endif
############
%build %build
# Build createrepo_c with Python 2 # Build createrepo_c with Python 2
%cmake . pushd build
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %cmake ../
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
popd
# Build createrepo_c with Pyhon 3 # Build createrepo_c with Pyhon 3
%if %{with python3} %if %{with python3}
pushd py3 pushd build-py3
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_DESIRED:str=3 . %cmake ../ -DPYTHON_DESIRED:str=3
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
popd popd
%endif %endif
# Build C documentation # Build C documentation
make doc-c pushd build
make doc-c
popd
############
%check %check
pushd build
# Compile C tests
make tests
# Compile C tests # Run Python 2 tests
make tests make ARGS="-V" test
popd
# Run Python 2 tests
make ARGS="-V" test
# Run Python 3 tests # Run Python 3 tests
%if %{with python3} %if %{with python3}
pushd py3 pushd build-py3
make ARGS="-V" test make ARGS="-V" test
popd popd
%endif %endif
############
%install %install
# Install createrepo_c with Python 2 pushd build
make install DESTDIR=$RPM_BUILD_ROOT/ # Install createrepo_c with Python 2
make install DESTDIR=%{buildroot}
popd
# Install createrepo_c with Python 3 # Install createrepo_c with Python 3
%if %{with python3} %if %{with python3}
pushd py3 pushd build-py3
make install DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=%{buildroot}
popd popd
%endif %endif
%post libs -p /sbin/ldconfig
############ %postun libs -p /sbin/ldconfig
%post -n %{name}-libs -p /sbin/ldconfig
%postun -n %{name}-libs -p /sbin/ldconfig
%files %files
%doc README.md %doc README.md
%doc COPYING %{_mandir}/man8/createrepo_c.8*
%_mandir/man8/createrepo_c.8.* %{_mandir}/man8/mergerepo_c.8*
%_mandir/man8/mergerepo_c.8.* %{_mandir}/man8/modifyrepo_c.8*
%_mandir/man8/modifyrepo_c.8.* %{_mandir}/man8/sqliterepo_c.8*
%_mandir/man8/sqliterepo_c.8.*
%{bash_completion} %{bash_completion}
%{_bindir}/createrepo_c %{_bindir}/createrepo_c
%{_bindir}/mergerepo_c %{_bindir}/mergerepo_c
@ -184,27 +166,32 @@ popd
%{_bindir}/sqliterepo_c %{_bindir}/sqliterepo_c
%files libs %files libs
%doc COPYING %license COPYING
%{_libdir}/libcreaterepo_c.so.* %{_libdir}/lib%{name}.so.*
%files devel %files devel
%{_libdir}/libcreaterepo_c.so %doc build/doc/html
%{_libdir}/pkgconfig/createrepo_c.pc %{_libdir}/lib%{name}.so
%{_includedir}/createrepo_c/* %{_libdir}/pkgconfig/%{name}.pc
%doc COPYING %{_includedir}/%{name}/
%doc doc/html
%files -n python-createrepo_c %files -n python2-%{name}
%{python_sitearch}/createrepo_c/ %{python2_sitearch}/%{name}/
%if %{with python3} %if %{with python3}
%files -n python3-createrepo_c %files -n python3-%{name}
%{python3_sitearch}/ %{python3_sitearch}/%{name}/
%endif %endif
############
%changelog %changelog
* Sun Apr 10 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.10.0-4
- Don't own python3_sitearch dir in python3 subpkg
- Use %%license macro
- Follow modern packaging guidelines
- Cleanups in spec file
- Follow packaging guidelines about SourceURL
- Fix license
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-3 * Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.0-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 @@
3ae5ba404975bf1cf4a0e6a45a81db3f createrepo_c-7a74bb7.tar.xz 2e14b3e5d289875b894000ab1e54f1ec createrepo_c-0.10.0.tar.gz