%global AIX_requirements \ Requires: AIX-rpm >= 7.1.3.0 \ Requires: AIX-rpm < 7.3.0.0 %global libmodulemd_version 1.5.1 %define __cmake_in_source_build 1 %define python3_version 3.9 # Bash completion (we need different approach for RHEL-6) %if 0%{?rhel} == 6 %global bash_completion %config%{_sysconfdir}/bash_completion.d/createrepo_c.bash %else %global bash_completion %{_datadir}/bash-completion/completions/* %endif %bcond_without python3 %bcond_with drpm %bcond_with zchunk %bcond_with libmodulemd Summary: Creates a common metadata repository Name: createrepo_c Version: 0.16.0 Release: 32_2 License: GPLv2+ URL: https://github.com/rpm-software-management/createrepo_c Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Patch1: createrepo_c-0.15.11-disable-doxygen.patch Patch2: createrepo_c-0.15.11-stat_conflict.patch Patch3: createrepo_c-0.15.11-rpmlib.patch Patch4: createrepo_c-0.15.11-python_interp.patch BuildRequires: cmake BuildRequires: gcc BuildRequires: bzip2-devel >= 1.0.8-2 #BuildRequires: doxygen BuildRequires: file-devel >= 5.39-1 BuildRequires: glib2-devel >= 2.56.1-3 BuildRequires: curl-devel >= 7.79.1-1 BuildRequires: libxml2-devel >= 2.9.11-1 #BuildRequires: openssl-devel BuildRequires: rpm-devel >= 4.15.1 BuildRequires: sqlite-devel >= 3.35.5-1 BuildRequires: xz-devel >= 5.2.5-1 BuildRequires: zlib-devel >= 1.2.11-2 %if %{with zchunk} BuildRequires: zchunk-devel >= 1.1.4-1 #BuildRequires: zchunk >= 1.1.4-1 Requires: zchunk-libs >= 1.1.4-32_1 %endif %if %{with libmodulemd} BuildRequires: libmodulemd-devel >= %{libmodulemd_version} BuildRequires: libmodulemd >= %{libmodulemd_version} Requires: libmodulemd%{?_isa} >= %{libmodulemd_version} %endif Requires: %{name}-libs = %{version}-%{release} %if 0%{?rhel} == 6 Requires: rpm >= 4.8.0-28 %else BuildRequires: bash-completion #Requires: rpm >= 4.9.0 %endif %if %{with drpm} BuildRequires: drpm-devel >= 0.5.0 %endif Obsoletes: createrepo < 0.11.0 Provides: createrepo = %{version}-%{release} %{AIX_requirements} %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 libs Summary: Library for repodata manipulation %if %{with drpm} Requires: drpm >= 0.5.0-32_1 %endif Requires: file-libs >= 5.39-1 Requires: bzip2 >= 1.0.8-2 Requires: curl >= 7.79.1-1 Requires: glib2 >= 2.56.1-3 Requires: gettext >= 0.20.2-1 Requires: xz-libs >= 5.2.5-1 Requires: libiconv >= 1.16-1 Requires: sqlite >= 3.35.5-1 Requires: libxml2 >= 2.9.11-1 Requires: zlib >= 1.2.11-2 Requires: rpm-python3 >= 4.15.1-32_2 %{AIX_requirements} %description libs Libraries for applications using the createrepo_c library for easy manipulation with a repodata. %package devel Summary: Library for repodata manipulation Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{AIX_requirements} %description devel This package contains the createrepo_c C library and header files. These development files are for easy manipulation with a repodata. %if %{with python2} %package -n python2-%{name} Summary: Python bindings for the createrepo_c library %{?python_provide:%python_provide python2-%{name}} BuildRequires: python2-devel BuildRequires: python2-nose %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: python-sphinx %else BuildRequires: python2-sphinx %endif Requires: %{name}-libs = %{version}-%{release} %description -n python2-%{name} Python bindings for the createrepo_c library. %endif %if %{with python3} %package -n python%{python3_version}-%{name} Summary: Python 3 bindings for the createrepo_c library %{?python_provide:%python_provide python3-%{name}} BuildRequires: python%{python3_version}-devel BuildRequires: python3-nose BuildRequires: python3-sphinx Requires: %{name}-libs = %{version}-%{release} Requires: python%{python3_version} >= %{python3_version}.13 %{AIX_requirements} %description -n python%{python3_version}-%{name} Python 3 bindings for the createrepo_c library. %endif %if %{with python3} %package -n python3-%{name} Summary: Meta package for Python 3 bindings for the createrepo_c library Requires: python%{python3_version}-%{name} = %{version}-%{release} Requires: python3 >= %{python3_version}.13 %description -n python3-%{name} Meta package for Python 3 bindings for the createrepo_c library. %endif %prep %autosetup -p1 %define is_python %(test -e /opt/freeware/libexec/python%{python3_version}_32 && echo 1 || echo 0) %if %{is_python} %define python3_sitelib %(/opt/freeware/libexec/python%{python3_version}_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))") %endif %if %{with python2} mkdir build-py2 %endif %if %{with python3} mkdir build-py3 %endif %build # Build createrepo_c with Python 2 %if %{with python2} pushd build-py2 %cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python2} %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF} make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}" %if %{without python3} # Build C documentation make doc-c %endif popd %endif # Build createrepo_c with Pyhon 3 %if %{with python3} cd build-py3 export LDFLAGS="-I/usr/opt/rpm/include -L/opt/freeware/lib -L/usr/opt/rpm/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -pthread -lm -lintl -liconv /opt/freeware/lib/libsqlite3.a" export CFLAGS="-fPIC -fpermissive -D_ALL_SOURCE -D_LARGE_FILES -D_XOPEN_SOURCE=700 -static-libgcc -static-libstdc++" export CXXFLAGS="-fPIC -fpermissive -D_ALL_SOURCE -D_LARGE_FILES -D_XOPEN_SOURCE=700 -static-libgcc -static-libstdc++" cmake .. \ -DPYTHON_EXECUTABLE=/opt/freeware/libexec/python%{python3_version}_32 \ -DPYTHON_INCLUDE_DIR=/opt/freeware/include/python%{python3_version} \ -DPYTHON_LIBRARY=/opt/freeware/lib/libpython%{python3_version}.a \ -DPYTHON_INCLUDE_PATH=/opt/freeware/include/python%{python3_version} \ -DPYTHON_INSTALL_DIR=/opt/freeware/lib/python%{python3_version}/site-packages \ -DENABLE_DOCS=OFF -DCMAKE_INSTALL_PREFIX:PATH=/opt/freeware \ -DPYTHON_DESIRED="3" -DPYTHON_VERSION_MAJOR="3" \ %{!?with_zchunk:-DWITH_ZCHUNK=OFF} \ %{!?with_libmodulemd:-DWITH_LIBMODULEMD=OFF} \ -DENABLE_DOCS=OFF \ -DENABLE_DRPM=OFF gmake VERBOSE=1 # Build C documentation #make doc-c %endif %check %if %{with python2} pushd build-py2 %if %{without python3} # Compile C tests make tests %endif # Run Python 2 tests make ARGS="-V" test popd %endif # Run Python 3 tests %if %{with python3} cd build-py3 # Compile C tests #make -k tests # Run Python 3 tests #make -k ARGS="-V" test #Fails with import error %endif %install %if %{with python2} pushd build-py2 # Install createrepo_c with Python 2 make install DESTDIR=%{buildroot} popd %endif %if %{with python3} cd build-py3 # Install createrepo_c with Python 3 make install DESTDIR=%{buildroot} cd ${RPM_BUILD_ROOT}/%{_libdir}/python%{python3_version}/site-packages/createrepo_c ar -x _createrepo_c.a _createrepo_c.so #mv lib_createrepo_c.so _createrepo_c.so rm _createrepo_c.a %endif # Strip the binaries strip %{buildroot}%{_bindir}/* || : ln -sr %{buildroot}%{_bindir}/createrepo_c %{buildroot}%{_bindir}/createrepo ln -sr %{buildroot}%{_bindir}/mergerepo_c %{buildroot}%{_bindir}/mergerepo ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo #%if 0%{?rhel} && 0%{?rhel} <= 7 #%post libs -p /sbin/ldconfig #%postun libs -p /sbin/ldconfig #%else #%ldconfig_scriptlets libs #%endif %pre #check if rpm.rte-4.15.1.0(32-bit) and higher is instlled. rpmver=`/usr/bin/lslpp -Lc rpm.rte | /usr/bin/awk 'FNR==2' | /usr/bin/awk -F':' '{print $3}'` rc=`/usr/bin/echo $rpmver | /usr/bin/awk '{ split($1, a, "."); rc=0; if ((a[1] == 4) && (a[2] == 15) && (a[3] == 1) && (a[4] >= 1010)) rc=0; else rc=1; print rc; }'` if [[ $rc -eq 1 ]] then echo "Please make sure rpm.rte-4.15.1.1010 and higher version is installed." exit 1 fi %pre libs #check if rpm.rte-4.15.1.0(32-bit) and higher is instlled. rpmver=`/usr/bin/lslpp -Lc rpm.rte | /usr/bin/awk 'FNR==2' | /usr/bin/awk -F':' '{print $3}'` rc=`/usr/bin/echo $rpmver | /usr/bin/awk '{ split($1, a, "."); rc=0; if ((a[1] == 4) && (a[2] == 15) && (a[3] == 1) && (a[4] >= 1010)) rc=0; else rc=1; print rc; }'` if [[ $rc -eq 1 ]] then echo "Please make sure rpm.rte-4.15.1.1010 and higher version is installed." exit 1 fi %pre -n python%{python3_version}-createrepo_c #check if rpm.rte-4.15.1.0(32-bit) and higher is instlled. rpmver=`/usr/bin/lslpp -Lc rpm.rte | /usr/bin/awk 'FNR==2' | /usr/bin/awk -F':' '{print $3}'` rc=`/usr/bin/echo $rpmver | /usr/bin/awk '{ split($1, a, "."); rc=0; if ((a[1] == 4) && (a[2] == 15) && (a[3] == 1) && (a[4] >= 1010)) rc=0; else rc=1; print rc; }'` if [[ $rc -eq 1 ]] then echo "Please make sure rpm.rte-4.15.1.1010 and higher version is installed." exit 1 fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %doc README.md #%{_mandir}/man8/createrepo_c.8* #%{_mandir}/man8/mergerepo_c.8* #%{_mandir}/man8/modifyrepo_c.8* #%{_mandir}/man8/sqliterepo_c.8* %{bash_completion} %{_bindir}/createrepo_c %{_bindir}/mergerepo_c %{_bindir}/modifyrepo_c %{_bindir}/sqliterepo_c %{_bindir}/createrepo %{_bindir}/mergerepo %{_bindir}/modifyrepo %files libs %license COPYING %{_libdir}/lib%{name}.a %files devel %if %{with python3} #%doc build-py3/doc/html %else %doc build-py2/doc/html %endif #%{_libdir}/lib%{name}.so %{_libdir}/pkgconfig/%{name}.pc %{_includedir}/%{name}/ %if %{with python2} %files -n python2-%{name} %{python2_sitearch}/%{name}/ %{python2_sitearch}/%{name}-%{version}-py%{python2_version}.egg-info %endif %if %{with python3} %files -n python%{python3_version}-%{name} %{python3_sitelib}/%{name}/ %{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info %endif %if %{with python3} %files -n python3-%{name} %endif %changelog * Mon Jan 23 20223 Sangamesh Mallayya 0.16.0-32_2 - Rebuild with python3.9. - Rebuild without brtl flag. * Thu Jan 20 2022 Sangamesh Mallayya 0.16.0-32_1 - As of now build without zchunk & drpm support. - And allow this to be installed on AIX 7.1 & 7.2 only. * Sat Aug 22 2020 Sangamesh Mallayya 0.15.11-1 - Initial release for AIX Toolbox.