From e2ef79b7e1c03dd77c85035030bac3befbf72a4c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Dec 08 2015 18:02:02 +0000 Subject: - now available on PECL - use sources from pecl - add virtual provides - add scriptlets for pecl registry (un)registration --- diff --git a/.gitignore b/.gitignore index 9432661..5be01e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +clog /php-smbclient-0.8.0-8b9587d.tgz +/smbclient-0.8.0RC1.tgz diff --git a/makesrc.sh b/makesrc.sh deleted file mode 100755 index 24fbf81..0000000 --- a/makesrc.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -NAME=$(basename $PWD) -OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) -PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) -VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) -COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) -SHORT=${COMMIT:0:7} - -echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" - -echo "Cloning..." -rm -rf $PROJECT-$COMMIT -git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT - -echo "Getting commit..." -pushd $PROJECT-$COMMIT -git checkout $COMMIT -popd - -echo "Archiving..." -tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT - -echo "Cleaning..." -rm -rf $PROJECT-$COMMIT - -echo "Done." diff --git a/php-smbclient.spec b/php-smbclient.spec index ca51ff7..f16dfd9 100644 --- a/php-smbclient.spec +++ b/php-smbclient.spec @@ -10,55 +10,56 @@ # Please, preserve the changelog entries # -%global gh_commit 8b9587df1a0859074eae6133c5210451d6527e38 -%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner eduardok -%global gh_project libsmbclient-php -%global gh_date 20150909 -%global prever -rc1 - %{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} %{!?__pecl: %global __pecl %{_bindir}/pecl} %{!?__php: %global __php %{_bindir}/php} -%global ext_name smbclient +%global prever RC1 +%global pecl_name smbclient %global with_zts 0%{?__ztsphp:1} %if "%{php_version}" < "5.6" -%global ini_name %{ext_name}.ini +%global ini_name %{pecl_name}.ini %else -%global ini_name 40-%{ext_name}.ini +%global ini_name 40-%{pecl_name}.ini %endif # Test suite requires a Samba server and configuration file %global with_tests 0%{?_with_tests:1} Name: php-smbclient Version: 0.8.0 -Release: 0.3.rc1%{?dist} +Release: 0.4.%{prever}%{?dist} Summary: PHP wrapper for libsmbclient Group: Development/Languages License: BSD URL: https://github.com/eduardok/libsmbclient-php -Source0: %{name}-%{version}-%{gh_short}.tgz -# git snapshot as upstream doesn't provide test suite -Source1: makesrc.sh +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz %if %{with_tests} -Source2: %{gh_project}-phpunit.xml +Source2: %{pecl_name}-phpunit.xml %endif BuildRequires: php-devel +BuildRequires: php-pear BuildRequires: libsmbclient-devel > 3.6 %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) BuildRequires: samba %endif +Requires(post): %{__pecl} +Requires(postun): %{__pecl} Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} -# Rename (and "php -m" reports both smbclient and libsmbclient) + +# Renamed (and "php -m" reports both smbclient and libsmbclient) Obsoletes: php-libsmbclient < 0.8.0-0.2 Provides: php-libsmbclient = %{version}-%{release} Provides: php-libsmbclient%{?_isa} = %{version}-%{release} +# PECL +Provides: php-pecl-%{pecl_name} = %{version}-%{release} +Provides: php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} +Provides: php-pecl(%{pecl_name}) = %{version} +Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} %if 0%{?fedora} < 20 && 0%{?rhel} < 7 # Filter private shared @@ -68,14 +69,17 @@ Provides: php-libsmbclient%{?_isa} = %{version}-%{release} %description -%{ext_name} is a PHP extension that uses Samba's libsmbclient +%{pecl_name} is a PHP extension that uses Samba's libsmbclient library to provide Samba related functions and 'smb' streams to PHP programs. %prep %setup -q -c -mv %{gh_project}-%{gh_commit} NTS +mv %{pecl_name}-%{version}%{?prever} NTS + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' -i package.xml cd NTS # Check extension version @@ -88,10 +92,9 @@ cd .. cat << 'EOF' | tee %{ini_name} ; Enable %{summary} extension module -extension=%{ext_name}.so +extension=%{pecl_name}.so EOF - %if %{with_zts} # Duplicate source tree for NTS / ZTS build cp -pr NTS ZTS @@ -118,23 +121,31 @@ make -C NTS install INSTALL_ROOT=%{buildroot} # install configuration install -Dpm 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 -Dpm 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}/%{pecl_name}/$i +done + %check : Minimal load test for NTS extension %{__php} --no-php-ini \ - --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so \ - --modules | grep %{ext_name} + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} %if %{with_zts} : Minimal load test for NTS extension %{__ztsphp} --no-php-ini \ - --define extension=%{buildroot}%{php_ztsextdir}/%{ext_name}.so \ - --modules | grep %{ext_name} + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} %endif %if %{with_tests} @@ -143,26 +154,42 @@ cd NTS cp %{SOURCE2} phpunit.xml %{__php} \ - --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ %{_bindir}/phpunit --verbose %endif +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + %files -%{!?_licensedir:%global license %%doc} -%license NTS/LICENSE -%doc NTS/README.md +%{?_licensedir:%license NTS/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} -%{php_extdir}/%{ext_name}.so +%{php_extdir}/%{pecl_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} -%{php_ztsextdir}/%{ext_name}.so +%{php_ztsextdir}/%{pecl_name}.so %endif %changelog +* Tue Dec 8 2015 Remi Collet - 0.8.0-0.4.RC1 +- now available on PECL +- use sources from pecl +- add virtual provides +- add scriptlets for pecl registry (un)registration + * Thu Sep 17 2015 Remi Collet - 0.8.0-0.3.rc1 - cleanup SCL compatibility for Fedora diff --git a/sources b/sources index 4f05fa1..f875fee 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4d8b8f33166c9b0f7d8b6e1dcd65c1b3 php-smbclient-0.8.0-8b9587d.tgz +3dc416a12ab1dd5788821c2bccd2685b smbclient-0.8.0RC1.tgz