From cfe190c0946f12e15b241c0cc2e619973568c77b Mon Sep 17 00:00:00 2001 From: Sergey Safarov Date: Wed, 22 Jun 2022 18:16:41 +0000 Subject: [PATCH] pkg/kamailio/obs: added CentOS 9 support (cherry picked from commit 19edea067f890814c767581fef65713046c768c6) --- pkg/kamailio/obs/kamailio.spec | 91 +++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/pkg/kamailio/obs/kamailio.spec b/pkg/kamailio/obs/kamailio.spec index ee275e14825..cab1a685437 100644 --- a/pkg/kamailio/obs/kamailio.spec +++ b/pkg/kamailio/obs/kamailio.spec @@ -20,6 +20,7 @@ %bcond_without mongodb %bcond_without perl %bcond_without phonenum +%bcond_without python2 %bcond_without python3 %bcond_without rabbitmq %bcond_without redis @@ -53,6 +54,7 @@ %bcond_with mongodb %bcond_without perl %bcond_with phonenum +%bcond_without python2 %bcond_with python3 %bcond_with rabbitmq %bcond_with redis @@ -87,6 +89,7 @@ %bcond_without mongodb %bcond_without perl %bcond_without phonenum +%bcond_without python2 %bcond_without python3 %bcond_without rabbitmq %bcond_without redis @@ -131,6 +134,53 @@ %bcond_without mongodb %bcond_without perl %bcond_without phonenum +%bcond_without python2 +%bcond_without python3 +%bcond_without rabbitmq +%bcond_without redis +%bcond_without ruby +%bcond_without sctp +%bcond_without websocket +%bcond_without xmlrpc +%endif + +%if 0%{?rhel} == 9 +%if 0%{?centos_ver} +%define dist_name centos +%define dist_version %{?centos} +%define dist .el9.centos +%endif +%if 0%{?almalinux_ver} +%define dist_name centos +%define dist_version %{?almalinux} +%define dist .el9.almalinux +%endif +%if 0%{?rocky_ver} +%define dist_name centos +%define dist_version %{?rocky} +%define dist .el9.rocky +%endif +%if 0%{?centos_ver} == 0 && 0%{?almalinux_ver} == 0 && 0%{?rocky_ver} == 0 +%define dist_name rhel +%define dist_version %{?rhel} +%endif +%bcond_without cnxcc +%bcond_with dnssec +%bcond_without evapi +%bcond_without geoip +%bcond_without http_async_client +%bcond_without ims +%bcond_without jansson +%bcond_without json +%bcond_without lua +%bcond_without lwsc +%bcond_without kazoo +%bcond_without memcached +%bcond_without mongodb +%bcond_without nats +%bcond_without perl +%bcond_without phonenum +%bcond_with python2 %bcond_without python3 %bcond_without rabbitmq %bcond_without redis @@ -158,6 +208,7 @@ %bcond_with mongodb %bcond_without perl %bcond_with phonenum +%bcond_without python2 %bcond_without python3 %bcond_with rabbitmq %bcond_without redis @@ -768,13 +819,11 @@ SIP Presence (and RLS, XCAP, etc) support for Kamailio. %package python Summary: Python extensions for Kamailio Group: %{PKGGROUP} +%if %{with python2} Requires: python2, kamailio = %ver BuildRequires: python2, python2-devel -%if %{with python3} -%if 0%{?rhel} == 7 -Requires: python36, kamailio = %ver -BuildRequires: python36, python36-devel %endif +%if %{with python3} %if 0%{?rhel} == 8 Requires: python39, kamailio = %ver BuildRequires: python39, python39-devel @@ -804,7 +853,7 @@ RabbitMQ module for Kamailio. Summary: RADIUS modules for Kamailio Group: %{PKGGROUP} Requires: kamailio = %ver -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} == 8 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 Requires: freeradius-client BuildRequires: freeradius-client-devel %else @@ -1121,14 +1170,14 @@ sed -i -e 's/python3/python2/' utils/kamctl/dbtextdb/dbtextdb.py %endif # on latest dist need to add --atexit=no for Kamailio options. More details GH #2616 -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} == 8 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 sed -i -e 's|/usr/sbin/kamailio|/usr/sbin/kamailio --atexit=no|' pkg/kamailio/obs/kamailio.service %endif %build ln -s ../obs pkg/kamailio/%{dist_name}/%{dist_version} -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} == 8 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 export FREERADIUS=1 %endif make cfg prefix=/usr \ @@ -1143,10 +1192,10 @@ make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \ %if %{with openssl11} SSL_BUILDER="pkg-config libssl11" \ %endif -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} == 8 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 FREERADIUS=1 \ %endif -%if 0%{?rhel} == 8 +%if 0%{?rhel} >= 8 PYTHON3=python3.9 \ %endif group_include="kstandard kautheph kberkeley kcarrierroute \ @@ -1204,7 +1253,10 @@ make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \ %if %{with phonenum} kphonenum \ %endif - kpostgres kpresence kpython \ + kpostgres kpresence \ +%if %{with python2} + kpython \ +%endif %if %{with python3} kpython3 \ %endif @@ -1244,10 +1296,10 @@ make install-modules-all skip_modules="app_mono db_cassandra db_oracle \ %if %{with openssl11} SSL_BUILDER="pkg-config libssl11" \ %endif -%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} == 8 +%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} >= 8 FREERADIUS=1 \ %endif -%if 0%{?rhel} == 8 +%if 0%{?rhel} >= 8 PYTHON3=python3.9 \ %endif group_include="kstandard kautheph kberkeley kcarrierroute \ @@ -1305,7 +1357,10 @@ make install-modules-all skip_modules="app_mono db_cassandra db_oracle \ %if %{with phonenum} kphonenum \ %endif - kpostgres kpresence kpython \ + kpostgres kpresence \ +%if %{with python2} + kpython \ +%endif %if %{with python3} kpython3 \ %endif @@ -1368,8 +1423,8 @@ install -m644 pkg/kamailio/%{dist_name}/%{dist_version}/sipcapture.sysconfig \ %if 0%{?suse_version} %py_compile -O %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb %endif -%if 0%{?fedora} || 0%{?rhel} == 8 -%py_byte_compile %{__python2} %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb +%if 0%{?fedora} || 0%{?rhel} >= 8 +%py_byte_compile %{__python3} %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb %endif # Removing devel files @@ -1731,8 +1786,8 @@ fi %dir %{_libdir}/kamailio/kamctl/dbtextdb %{_libdir}/kamailio/kamctl/dbtextdb/dbtextdb.py -%{_libdir}/kamailio/kamctl/dbtextdb/dbtextdb.pyc -%{_libdir}/kamailio/kamctl/dbtextdb/dbtextdb.pyo +%dir %{_libdir}/kamailio/kamctl/dbtextdb/__pycache__ +%{_libdir}/kamailio/kamctl/dbtextdb/__pycache__/*.pyc %{_mandir}/man5/* %{_mandir}/man8/* @@ -2090,8 +2145,10 @@ fi %files python %defattr(-,root,root) +%if %{with python2} %doc %{_docdir}/kamailio/modules/README.app_python %{_libdir}/kamailio/modules/app_python.so +%endif %if %{with python3} %doc %{_docdir}/kamailio/modules/README.app_python3 %{_libdir}/kamailio/modules/app_python3.so