Accepting request 581016 from system:packagemanager

- [bnc#1075670] changed to provide createrepo as update-alternative
  because createrepo_c will replace createrepo because of switch to
  python3
- also provide createrepo-implementation

- Disable tests on SLE12 due to the python-nose requirements

- Switch to singlespec buidling of python bindings
- Make sure to use cmake macros to have it easier to gork what is
  happending by overriding %__builddir
- Sort out with spec-cleaner
- Fix embedding of date and time to documentation

OBS-URL: https://build.opensuse.org/request/show/581016
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/createrepo_c?expand=0&rev=5
This commit is contained in:
Dominique Leuenberger 2018-03-04 10:52:34 +00:00 committed by Git OBS Bridge
commit af3103e845
2 changed files with 137 additions and 63 deletions

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Wed Feb 21 15:58:06 UTC 2018 - FSchreiner@suse.com
- [bnc#1075670] changed to provide createrepo as update-alternative
because createrepo_c will replace createrepo because of switch to
python3
- also provide createrepo-implementation
-------------------------------------------------------------------
Tue Feb 13 11:53:58 UTC 2018 - tchvatal@suse.com
- Disable tests on SLE12 due to the python-nose requirements
-------------------------------------------------------------------
Mon Jan 22 11:58:46 UTC 2018 - tchvatal@suse.com
- Switch to singlespec buidling of python bindings
- Make sure to use cmake macros to have it easier to gork what is
happending by overriding %__builddir
- Sort out with spec-cleaner
- Fix embedding of date and time to documentation
-------------------------------------------------------------------
Sun Feb 19 12:57:21 UTC 2017 - ngompa13@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package createrepo_c
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015-2017 Neal Gompa <ngompa13@gmail.com>.
#
# All modifications and additions to the file contributed by third parties
@ -17,41 +17,44 @@
#
# Enable Python bindings selectively
%if (0%{?suse_version} == 1315 && 0%{?is_opensuse}) || 0%{?leap_version} || 0%{?suse_version} >= 1330
# Python bindings are enabled for openSUSE Leap and Tumbleweed
%bcond_without python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%if 0%{?is_opensuse} || 0%{?suse_version} >= 1330
%bcond_without python3
%bcond_without tests
%else
# Python bindings are disabled for older SUSE
%bcond_with python
%define skip_python3 1
%bcond_with tests
%bcond_with python3
%endif
# Enable enhanced DeltaRPM support
%bcond_with drpm
%define major 0
%define libname lib%{name}%{major}
%define devname lib%{name}-devel
%define version_unconverted 0.10.0.git20170131.04828e6
# prevent provides from nonstandard paths:
%global __provides_exclude ^(%{python_sitearch}/.*\\.so\\|%{python3_sitearch}/.*\\.so)$
# Enable Python bindings selectively
%bcond_without python2
# Enable enhanced DeltaRPM support
%bcond_with drpm
Name: createrepo_c
Summary: Creates a common metadata repository
License: GPL-2.0+
Group: System/Packages
Version: 0.10.0.git20170131.04828e6
Release: 0
Summary: Creates a common metadata repository
License: GPL-2.0-or-later
Group: System/Packages
Url: https://github.com/rpm-software-management/createrepo_c
Source0: %{name}-%{version}.tar.gz
BuildRequires: bash-completion
%if 0%{?suse_version} >= 1330
BuildRequires: bash-completion-devel
%if 0%{?is_opensuse} || 0%{?suse_version} >= 1330
BuildRequires: %{python_module devel}
%else
%if %{with python2}
BuildRequires: python-devel
%endif
%if %{with python3}
BuildRequires: python3-devel
%endif
%endif
BuildRequires: bash-completion
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: fdupes
@ -63,16 +66,18 @@ BuildRequires: libexpat-devel
BuildRequires: libxml2-devel
BuildRequires: lzma-devel
BuildRequires: openssl-devel
%if 0%{?is_opensuse} || 0%{?suse_version} >= 1330
BuildRequires: python-rpm-macros
%endif
BuildRequires: rpm-devel >= 4.9.0
BuildRequires: sqlite3-devel
BuildRequires: zlib-devel
%if %{with python}
BuildRequires: python-devel
BuildRequires: python-nose
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-nose
Requires: %{libname} = %{version}-%{release}
%if %{with tests}
BuildRequires: %{python_module nose}
%endif
%if 0%{?suse_version} >= 1330
BuildRequires: bash-completion-devel
%endif
%if %{with drpm}
BuildRequires: drpm-devel
@ -80,6 +85,11 @@ BuildRequires: drpm-devel
Requires: %{libname} = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: createrepo-implementation
# prevent provides from nonstandard paths:
%global __provides_exclude ^(%{python_sitearch}/.*\\.so\\|%{python3_sitearch}/.*\\.so)$
@ -103,116 +113,158 @@ for easy manipulation with a repodata.
%package -n %{devname}
Summary: Library for repodata manipulation
Group: Development/Libraries/C and C++
Provides: %{name}-devel = %{version}-%{release}
Requires: %{libname} = %{version}-%{release}
Requires: pkg-config
Requires: pkgconfig
Provides: %{name}-devel = %{version}-%{release}
%description -n %{devname}
This package contains the createrepo_c C library and header files.
These development files are for easy manipulation with a repodata.
%if %{with python}
%package -n python2-%{name}
Summary: Python 2 bindings for the createrepo_c library
Group: Development/Libraries/Python
Provides: python-%{name} = %{version}-%{release}
Requires: %{libname} = %{version}-%{release}
Provides: python-%{name} = %{version}-%{release}
%description -n python2-createrepo_c
Python 2 bindings for the createrepo_c library.
The python 2 bindings for the createrepo_c library.
%if %{with python3}
%package -n python3-%{name}
Summary: Python 3 bindings for the createrepo_c library
Group: Development/Libraries/Python
Requires: %{libname} = %{version}-%{release}
%description -n python3-createrepo_c
Python 3 bindings for the createrepo_c library.
%endif
%endif
The python 3 bindings for the createrepo_c library.
%prep
%setup -q
%if %{with python3}
rm -rf py3
mkdir py3
%endif
# do not hardcode date in the docs
sed -i -e '/HTML_TIMESTAMP/d' doc/Doxyfile.in.in
%build
%cmake -DENABLE_LEGACY_WEAKTAGS=1 %{!?with_drpm:-DENABLE_DRPM=OFF} %{!?with_python:-DENABLE_PYTHON=OFF}
%define __builddir build
%cmake \
-DENABLE_LEGACY_WEAKTAGS=1 \
%{!?with_drpm:-DENABLE_DRPM=OFF} \
%{!?with_python2:-DENABLE_PYTHON=OFF}
make %{?_smp_mflags}
make doc-c
make %{?_smp_mflags} doc-c
%if %{with python}
%if %{with python3}
pushd ../py3
%cmake -DPYTHON_DESIRED:str=3 ../../
cd ..
%define __builddir build-py3
%cmake \
-DENABLE_LEGACY_WEAKTAGS=1 \
%{!?with_drpm:-DENABLE_DRPM=OFF} \
%{!?with_python3:-DENABLE_PYTHON=OFF} \
-DPYTHON_DESIRED:str=3
make %{?_smp_mflags}
popd
%endif
%endif
%check
make tests -C build
make ARGS="-V" test -C build
%if %{with python}
%if %{with tests}
%define __builddir build
%ctest
%if %{with python3}
make tests -C py3/build
make ARGS="-V" test -C py3/build
%define __builddir build-py3
%ctest
%endif
%endif
%install
%make_install -C build
%if %{with python}
%define __builddir build
%cmake_install
%if %{with python3}
%make_install -C py3/build
%endif
%define __builddir build-py3
%cmake_install
%endif
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for i in createrepo mergerepo modifyrepo sqliterepo;do
ln -s %{_bindir}/$i\_c %{buildroot}%{_sysconfdir}/alternatives/$i
ln -s %{_sysconfdir}/alternatives/$i %{buildroot}%{_bindir}/$i
ln -s %{_mandir}/man8/$i\_c.8.gz %{buildroot}%{_sysconfdir}/alternatives/$i\.8.gz
ln -s %{_sysconfdir}/alternatives/$i\.8.gz %{buildroot}%{_mandir}/man8/$i\.8.gz
done
%fdupes %{buildroot}%{_prefix}
%fdupes build/doc/html
%post
update-alternatives --install \
%{_bindir}/createrepo createrepo %{_bindir}/createrepo_c 20 \
--slave %{_bindir}/mergerepo mergerepo %{_bindir}/mergerepo_c \
--slave %{_bindir}/modifyrepo modifyrepo %{_bindir}/modifyrepo_c \
--slave %{_bindir}/sqliterepo sqliterepo %{_bindir}/sqliterepo_c \
--slave %{_mandir}/man8/createrepo.8.gz createrepo.8.gz %{_mandir}/man8/createrepo_c.8.gz \
--slave %{_mandir}/man8/mergerepo.8.gz mergerepo.8.gz %{_mandir}/man8/mergerepo_c.8.gz \
--slave %{_mandir}/man8/modifyrepo.8.gz modifyrepo.8.gz %{_mandir}/man8/modifyrepo_c.8.gz \
--slave %{_mandir}/man8/sqliterepo.8.gz sqliterepo.8.gz %{_mandir}/man8/sqliterepo_c.8.gz
%postun
if [ ! -f %{_bindir}/createrepo_c ];then
update-alternatives --remove createrepo %{_bindir}/createrepo_c
fi
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc README.md COPYING
%{_mandir}/man8/createrepo_c.8*
%{_mandir}/man8/mergerepo_c.8*
%{_mandir}/man8/modifyrepo_c.8*
%{_mandir}/man8/sqliterepo_c.8*
%{_mandir}/man8/createrepo.8*
%{_mandir}/man8/mergerepo.8*
%{_mandir}/man8/modifyrepo.8*
%{_mandir}/man8/sqliterepo.8*
%{_datadir}/bash-completion/completions/
%{_bindir}/createrepo_c
%{_bindir}/mergerepo_c
%{_bindir}/modifyrepo_c
%{_bindir}/sqliterepo_c
%{_bindir}/createrepo
%{_bindir}/mergerepo
%{_bindir}/modifyrepo
%{_bindir}/sqliterepo
%ghost %_sysconfdir/alternatives/createrepo
%ghost %_sysconfdir/alternatives/mergerepo
%ghost %_sysconfdir/alternatives/modifyrepo
%ghost %_sysconfdir/alternatives/sqliterepo
%ghost %_sysconfdir/alternatives/createrepo.8.gz
%ghost %_sysconfdir/alternatives/mergerepo.8.gz
%ghost %_sysconfdir/alternatives/modifyrepo.8.gz
%ghost %_sysconfdir/alternatives/sqliterepo.8.gz
%files -n %{libname}
%defattr(-,root,root)
%doc COPYING
%{_libdir}/libcreaterepo_c.so.%{major}
%{_libdir}/libcreaterepo_c.so.%{major}.*
%files -n %{devname}
%defattr(-,root,root)
%doc build/doc/html COPYING
%{_libdir}/libcreaterepo_c.so
%{_libdir}/pkgconfig/createrepo_c.pc
%{_includedir}/createrepo_c/
%if %{with python}
%if %{with python2}
%files -n python2-%{name}
%defattr(-,root,root)
%doc COPYING
%{python_sitearch}/createrepo_c/
%endif
%if %{with python3}
%files -n python3-%{name}
%defattr(-,root,root)
%doc COPYING
%{python3_sitearch}/createrepo_c/
%endif
%endif
%changelog