# remirepo spec file for php-pecl-molten # # Copyright (c) 2017-2018 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # %if 0%{?scl:1} %global sub_prefix %{scl_prefix} %scl_package php-pecl-molten %endif %global proj_name Molten %global pecl_name molten %global with_zts 0 %if "%{php_version}" < "5.6" %global ini_name z-%{pecl_name}.ini %else %global ini_name 60-%{pecl_name}.ini %endif # Not ready %global with_tests 0 %global upstream_version 0.1.2 %global upstream_prever beta Summary: Extension for application tracing Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: ASL 2.0 Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{proj_name}-%{upstream_version}%{?upstream_prever}.tgz BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 5.4 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-json BuildRequires: %{?scl_prefix}php-curl BuildRequires: %{?scl_prefix}php-pecl-memcached BuildRequires: %{?scl_prefix}php-pecl(redis) BuildRequires: %{?scl_prefix}php-pecl-mongodb BuildRequires: %{?scl_prefix}php-mysqlnd BuildRequires: %{?scl_prefix}php-pdo BuildRequires: curl-devel BuildRequires: librdkafka-devel Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} Requires: %{?scl_prefix}php-curl%{?_isa} Requires: %{?scl_prefix}php-mysqlnd%{?_isa} Requires: %{?scl_prefix}php-pdo%{?_isa} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} %if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 Suggests: %{?scl_prefix}php-pecl-memcached%{?_isa} Suggests: %{?scl_prefix}php-pecl-redis%{?_isa} Suggests: %{?scl_prefix}php-pecl-mongodb%{?_isa} %endif Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl(%{proj_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{proj_name})%{?_isa} = %{version} %if "%{?scl_prefix}" != "%{?sub_prefix}" Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff Obsoletes: php56u-pecl-%{pecl_name} <= %{version} Obsoletes: php56w-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "7.0" Obsoletes: php70u-pecl-%{pecl_name} <= %{version} Obsoletes: php70w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.1" Obsoletes: php71u-pecl-%{pecl_name} <= %{version} Obsoletes: php71w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" Obsoletes: php73u-pecl-%{pecl_name} <= %{version} Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 # Filter shared private %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} %endif %description Molten is transparency tool for application tracing it self module call. It trace php app core call and output zipkin/opentracing format trace log. Provides features about muliti trace sapi, multi sampling type, upload tracing status, module control and muliti sink type. It very easy to build a distributed systems tracing infrastructure base on php, already run on thousand instance on production env. Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. %prep %setup -q -c mv %{proj_name}-%{upstream_version}%{?upstream_prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml cd NTS # TODO: use some other directory sed -e '/DEFAULT_LOG_DIR/s:"/var/wd/log/tracing/php/":"/tmp/":' -i molten_log.h # Fix version sed -e '/MOLTEN_EXT_VERSION/s/1.0.0/%{upstream_version}%{?upstream_prever}/' -i molten_util.h # Sanity check, really often broken extver=$(sed -n '/MOLTEN_EXT_VERSION/{s/.* "//;s/".*$//;p}' molten_util.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then : Error: Upstream extension version is ${extver}, expecting %{upstream_version}%{?upstream_prever}. exit 1 fi cd .. %if %{with_zts} # Duplicate source tree for NTS / ZTS build cp -pr NTS ZTS %endif # Create configuration file cat << 'EOF' | tee %{ini_name} ; Enable "%{pecl_name}" extension module extension=%{pecl_name}.so ; Configuration ;molten.enable = 1 ;molten.sink_log_path = '/tmp/tracing' ;molten.service_name = 'default' ;molten.tracing_cli = 0 ;molten.sampling_type = 1 ;molten.sampling_request = 1000 ;molten.sampling_rate = 64 ;molten.span_format = 'zipkin' ;molten.report_interval = 60 ;molten.notify_uri = '' ;molten.report_limit = 100 ;molten.sink_type = 1 ;molten.output_type = 1 ;molten.sink_http_uri = '' ;molten.sink_syslog_unix_socket = '' ;molten.sink_kafka_brokers= '' ;molten.sink_kafka_topic = '' EOF %build %{?dtsenable} cd NTS %{_bindir}/phpize %configure \ --enable-molten \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %{_bindir}/zts-phpize %configure \ --enable-molten \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} %endif %install %{?dtsenable} make -C NTS install INSTALL_ROOT=%{buildroot} # install config file install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml %if %{with_zts} make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{proj_name}/$i done %if 0%{?fedora} < 24 && 0%{?rhel} < 8 # when pear installed alone, after us %triggerin -- %{?scl_prefix}php-pear if [ -x %{__pecl} ] ; then %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : fi # posttrans as pear can be installed after us %posttrans if [ -x %{__pecl} ] ; then %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : fi %postun if [ $1 -eq 0 -a -x %{__pecl} ] ; then %{pecl_uninstall} %{proj_name} >/dev/null || : fi %endif %check : Minimal load test for NTS extension MODREQ= for mod in curl json pdo; do if [ -f %{php_extdir}/${mod}.so ]; then MODREQ="$MODREQ -d extension=${mod}.so" fi done MODOPT= for mod in igbinary msgpack memcached mongodb redis mysqlnd mysqli; do if [ -f %{php_extdir}/${mod}.so ]; then MODOPT="$MODOPT -d extension=${mod}.so" fi done cd NTS %{__php} --no-php-ini $MODREQ \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} %if %{with_tests} # Upstream test suite TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n $MODREQ $MODOPT -d extension=$PWD/modules/%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php --show-diff %endif %if %{with_zts} : Minimal load test for ZTS extension cd ../ZTS %{__ztsphp} --no-php-ini $MODREQ \ $modules \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} %if %{with_tests} # Upstream test suite TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n $MODREQ $MODOPT -d extension=$PWD/modules/%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php --show-diff %endif %endif %files %{!?_licensedir:%global license %%doc} %license NTS/LICENSE %doc %{pecl_docdir}/%{proj_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} %{php_ztsextdir}/%{pecl_name}.so %endif %changelog * Thu Aug 16 2018 Remi Collet - 0.1.2~beta-5 - rebuild for 7.3.0beta2 new ABI * Wed Jul 18 2018 Remi Collet - 0.1.2~beta-4 - rebuild for 7.3.0alpha4 new ABI * Thu Jun 28 2018 Remi Collet - 0.1.2~beta-3 - cleanup * Thu Aug 24 2017 Remi Collet - 0.1.2~beta-2 - License is ASL 2.0 - make dependency on mongodb, redis and memcached optional * Thu Aug 17 2017 Remi Collet - 0.1.2~beta-1 - initial package