Topic: php54-pecl-mailparse - no job control

Hi,

I changed structre for php52 and php53,php54 triple install structred.
php52,php53,php54 are working fine.

Regarding
php-pecl-mailparser-2.1.6-8.remi.src to php54-pecl-mailparse-2.1.6-8
I could rpmbuild completed.
php54-pecl-mailparse-2.1.6-8.cs5zc.x86_64.rpm

But rpm -ivh and rpm -e happen the error with fg: no job control
I am very much appriciated for your advice.

Kind regards,

-------------- spec file -----------------
%{!?phpname:            %{expand: %%global phpname     php54}}

%if %{phpname} == php
%global phpbindir      %{_bindir}
%global phpconfdir     %{_sysconfdir}
%global phpincldir     %{_includedir}
%else
%global phpbindir      %{_bindir}/%{phpname}
%global phpconfdir     %{_sysconfdir}/%{phpname}
%global phpincldir     %{_includedir}/%{phpname}
%endif

%{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/%{phpname}/pecl}}
%{!?__php:     %{expand: %%global __php     %{_bindir}/%{phpname}/php}}
%{!?php_extdir: %{expand: %%global php_extdir %(%{phpbindir}/php-config --extension-dir)}}
%global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)

%{?scl:          %scl_package         %{phpname}-pecl-mailparse}
%{!?php_inidir:  %global php_inidir   %{_sysconfdir}/%{phpname}/php.d}

%global pecl_name mailparse
%global with_zts  0%{?__ztsphp:1}
%if "%{php_version}" < "5.6"
# After mbstring
%global ini_name  z-%{pecl_name}.ini
%else
# After 20-mbstring
%global ini_name  40-%{pecl_name}.ini
%endif

Summary:   PHP PECL package for parsing and working with email messages
Name:      %{?scl_prefix}%{phpname}-pecl-mailparse
Version:   2.1.6
Release:   8%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License:   PHP
Group:     Development/Languages
# URL from mailparse.c header
Source1:   [url]http://www.php.net/license/2_02.txt[/url]

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: %{?scl_prefix}%{phpname}-devel
BuildRequires: %{?scl_prefix}%{phpname}-pear
# mbstring need for tests
BuildRequires: %{?scl_prefix}%{phpname}-mbstring
# Required by phpize
BuildRequires: autoconf, automake, libtool

Requires: %{?scl_prefix}%{phpname}-mbstring%{?_isa}
Requires: %{?scl_prefix}%{phpname}(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}%{phpname}(api) = %{php_core_api}
Requires(post): %{__pecl}
Requires(postun): %{__pecl}

Provides: %{?scl_prefix}%{phpname}-%{pecl_name} = %{version}
Provides: %{?scl_prefix}%{phpname}-%{pecl_name}%{?_isa} = %{version}
Provides: %{?scl_prefix}%{phpname}-pecl(%{pecl_name}) = %{version}
Provides: %{?scl_prefix}%{phpname}-pecl(%{pecl_name})%{?_isa} = %{version}

%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
Obsoletes:     php53-pecl-%{pecl_name}
Obsoletes:     php53u-pecl-%{pecl_name}
Obsoletes:     php54-pecl-%{pecl_name}
Obsoletes:     php54w-pecl-%{pecl_name}
%if "%{php_version}" > "5.5"
Obsoletes:     php55u-pecl-%{pecl_name}
Obsoletes:     php55w-pecl-%{pecl_name}
%endif
%if "%{php_version}" > "5.6"
Obsoletes:     php56u-pecl-%{pecl_name}
Obsoletes:     php56w-pecl-%{pecl_name}
%endif
%endif

%if 0%{?fedora} < 20 && 0%{?rhel} < 7
# Filter shared private
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
%endif


%description
Mailparse is an extension for parsing and working with email messages.
It can deal with rfc822 and rfc2045 (MIME) compliant messages.

%prep
%setup -q -c

mv %{pecl_name}-%{version} NTS

cd NTS
cp %{SOURCE1} LICENSE
extver=$(sed -n '/#define PHP_MAILPARSE_VERSION/{s/.* "//;s/".*$//;p}' php_mailparse.h)
if test "x${extver}" != "x%{version}"; then
   : Error: Upstream version is ${extver}, expecting %{version}.
   exit 1
fi
cd ..

cat > %{ini_name} << 'EOF'
; Enable mailparse extension module
extension = mailparse.so

; Set the default charset
;mailparse.def_charset = us-ascii
EOF

chmod -x NTS/*.{php,c,h}

%if %{with_zts}
cp -pr NTS ZTS
%endif

%build
cd NTS
%{phpbindir}/phpize
%configure --with-php-config=%{phpbindir}/php-config
make %{?_smp_mflags}

%if %{with_zts}
cd ../ZTS
%{phpbindir}/zts-phpize
%configure --with-php-config=%{phpbindir}/zts-php-config
make %{?_smp_mflags}
%endif

%install
rm -rf %{buildroot}
make -C NTS install INSTALL_ROOT=%{buildroot}
# Drop in the bit of configuration
install -Dpm 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}

%if %{with_zts}
make -C ZTS install INSTALL_ROOT=%{buildroot}
# Drop in the bit of configuration
install -Dpm 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
%endif

# Install XML package description
%define pecl_xmldir /usr/share/%{phpname}/pear
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml

# Test & Documentation
%define pecl_docdir /usr/share/doc/%{phpname}/pear
%define pecl_testdir /usr/share/%{phpname}/tests/pear
for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
done
for i in LICENSE $(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}/php --no-php-ini \
    --define extension=mbstring.so \
    --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
    --modules | grep %{pecl_name}

: Upstream test suite for NTS extension
cd NTS
TEST_PHP_EXECUTABLE=%{__php}/php \
NO_INTERACTION=1 \
%{__php}/php run-tests.php \
    -n -q \
    -d extension=mbstring.so \
    -d extension=$PWD/modules/%{pecl_name}.so

%if %{with_zts}
: Minimal load test for ZTS extension
%define __ztsphp /usr/include/php54/php54-zts/
%{__ztsphp}/php --no-php-ini \
    --define extension=mbstring.so \
    --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
    --modules | grep %{pecl_name}

: Upstream test suite for ZTS extension
cd ../ZTS
TEST_PHP_EXECUTABLE=%{__ztsphp}/php \
NO_INTERACTION=1 \
php run-tests.php \
    -n -q \
    -d extension=mbstring.so \
    -d extension=$PWD/modules/%{pecl_name}.so
%endif

%clean
rm -rf %{buildroot}


%post
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    %{pecl_uninstall} %{pecl_name} >/dev/null || :
fi

%files
%defattr(-,root,root,-)
%doc %{pecl_docdir}/%{pecl_name}
%doc %{pecl_testdir}/%{pecl_name}
# We prefix the config file with "z-" so that it loads after mbstring.ini
%config(noreplace) %{php_inidir}/%{ini_name}
%{php_extdir}/%{pecl_name}.so
%{pecl_xmldir}/%{name}.xml

%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{ini_name}
%{php_ztsextdir}/%{pecl_name}.so
%endif

php54 has structre as follows,

/usr/bin/php54
|-- pear
|-- peardev
|-- pecl
|-- phar -> phar.phar
|-- phar.phar
|-- php
|-- php-cgi
|-- php-config
|-- phpize
|-- zts-php
|-- zts-php-config
`-- zts-phpize

/usr/lib64/php54
|-- libphp5-5.4.36.so
|-- libphp5.so -> libphp5-5.4.36.so
`-- modules
    |-- bcmath.so
    |-- curl.so
    |-- dba.so
    |-- dom.so
    |-- enchant.so
    |-- fileinfo.so
    |-- gd.so
    |-- imap.so
    |-- interbase.so
    |-- intl.so
    |-- json.so
    |-- ldap.so
    |-- mailparse.so
    |-- mbstring.so
    |-- mcrypt.so
    |-- mysql.so
    |-- mysqli.so
    |-- odbc.so
    |-- pdo.so
    |-- pdo_firebird.so
    |-- pdo_mysql.so
    |-- pdo_odbc.so
    |-- pdo_pgsql.so
    |-- pdo_sqlite.so
    |-- pgsql.so
    |-- phar.so
    |-- posix.so
    |-- pspell.so
    |-- recode.so
    |-- snmp.so
    |-- soap.so
    |-- sysvmsg.so
    |-- sysvsem.so
    |-- sysvshm.so
    |-- tidy.so
    |-- wddx.so
    |-- xmlreader.so
    |-- xmlrpc.so
    |-- xmlwriter.so
    |-- xsl.so
    `-- zip.so

Re: php54-pecl-mailparse - no job control

Environment follows,
CentOS5.11 with openssl-0.9.8zc
macro environments are normal I guess.

Kind regards,
Noriyuki from Japan.

Re: php54-pecl-mailparse - no job control

Sorry can't say. Not enough information.

Perhaps a "rpm -q --scripts package" will helps

But again, I don't understand the need, especially
- when SCL package already does parallel installation in a sane way
- for CentOS-5 which is soon EOL.

Use CentOS-6 or 7 and take benefit of the existing package wink

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 26 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.9 x86_64 + EPEL + remi + remi-php70

Re: php54-pecl-mailparse - no job control

Mr.Remi,

Thank you for your reply.
Your advise was so helpful.
run the "rpm -q --scripts package"
I understand the cause that was "/usr/bin/pecl".
I changed post & unpost in the spec.
Solved this issue.

I hope you are well and have good day.

Kind regards,
Noriyuki