# # spec file for package createrepo_c # # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2015-2017 Neal Gompa . # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} %if 0%{?is_opensuse} || 0%{?suse_version} >= 1330 %bcond_without python3 %bcond_without tests %else %define skip_python3 1 %bcond_with tests %bcond_with python3 %endif %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 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 %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 BuildRequires: file-devel BuildRequires: glib2-devel >= 2.22.0 BuildRequires: libbz2-devel BuildRequires: libcurl-devel 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 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 %endif 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)$ %description C implementation of Createrepo. A set of utilities (createrepo_c, mergerepo_c, modifyrepo_c) for generating a common metadata repository from a directory of rpm packages and maintaining it. %package -n %{libname} Summary: Library for repodata manipulation # The function to create DeltaRPMs calls /usr/bin/makedeltarpm, # which is part of the 'deltarpm' package Group: System/Libraries Requires: deltarpm %description -n %{libname} Libraries for applications using the createrepo_c library for easy manipulation with a repodata. %package -n %{devname} Summary: Library for repodata manipulation Group: Development/Libraries/C and C++ Requires: %{libname} = %{version}-%{release} 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. %package -n python2-%{name} Summary: Python 2 bindings for the createrepo_c library Group: Development/Libraries/Python Requires: %{libname} = %{version}-%{release} Provides: python-%{name} = %{version}-%{release} %description -n python2-createrepo_c The python 2 bindings for the createrepo_c library. %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 The python 3 bindings for the createrepo_c library. %prep %setup -q # do not hardcode date in the docs sed -i -e '/HTML_TIMESTAMP/d' doc/Doxyfile.in.in %build %define __builddir build %cmake \ -DENABLE_LEGACY_WEAKDEPS=1 \ %{!?with_drpm:-DENABLE_DRPM=OFF} \ %{!?with_python2:-DENABLE_PYTHON=OFF} make %{?_smp_mflags} make %{?_smp_mflags} doc-c %if %{with python3} cd .. %define __builddir build-py3 %cmake \ -DENABLE_LEGACY_WEAKDEPS=1 \ %{!?with_drpm:-DENABLE_DRPM=OFF} \ %{!?with_python3:-DENABLE_PYTHON=OFF} \ -DPYTHON_DESIRED:str=3 make %{?_smp_mflags} %endif %check %if %{with tests} %define __builddir build %ctest %if %{with python3} %define __builddir build-py3 %ctest %endif %endif %install %define __builddir build %cmake_install %if %{with python3} %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 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 %changelog