php-pear package build problem

TASAKA Mamoru mtasaka at fedoraproject.org
Tue Sep 6 14:47:46 UTC 2011


Pavel Alexeev (aka Pahan-Hubbitus) wrote, at 09/06/2011 07:00 PM +9:00:
> 05.09.2011 19:17, TASAKA Mamoru wrote:

>> First:
>> * php-devel is not installed when trying to package srpm from spec and sources. This is
>> what koji (build server) always does. i.e. koji tries to package srpm first, at that time
>> only minimum buildroot packages are installed. Then after srpm is successfully packaged,
>> koji (yum) installs additional packages specified by BuildRequires. After that koji will
>> actually try to build binary rpms from the spec file.
>>
> No, in this case it was scratch build, so initially srpm was submitted.

Well, it is still true that at the first time only minimum buildroot packages
are installed, because at this time koji does not know what packages are needed yet.
So koji first unpacks your srpm and parse your spec to check what packages
are listed in BuildRequires. Again this time no packages
listed in BuildRequires are installed yet. So if parsing your spec file fails
when only buildroot packages are installed, still no BuildRequires packages
are installed, even on scratch build.

>> So you must ensure that your srpm can successfully packaged even if none of packages
>> in BuildRequires are installed (and only minimum buildroot packages are installed).
>>
>> * Then looking at your spec file, there are actually two issues which prevents srpm
>> from being properly packaged.
>>
>> 1. The line 63
>>
>> %if %( php -r 'echo version_compare(PHP_VERSION, "5.3.0", ">=") ? 1 : 0;' )
>>
>> cannot be parsed when php is not installed (again, when koji first tries to package
>> srpm, BuildRequires rpms are not installed yet). The correct line would be something
>> like:
>>
>> %if %( which php &>/dev/null && php -r 'echo version_compare(PHP_VERSION, "5.3.0", ">=") ? 1 : 0'|| echo -n 0 )
>>
>> However please reconsider if you really want this complicated line.
> This line needed and I don't see any problems with it:
> which php &>/dev/null && php -r 'echo version_compare(PHP_VERSION, "5.3.0", ">=") ? 1 : 0'|| echo -n 0
>
> always should return with 0 exit status and produce only 0 or 1 as result, even if php not installed.
>
>>
>> 2. The line 28
>>
>> %if %{?php_zend_api}0
>>
>> cannot be parsed when %php_zend_api is not integer (and this is actually happening
>> currently). The correct line would be something like
>>
>> %if 0%{?php_zend_api?1:0}
>>
>> however it seems this line is no longer needed on Fedora:
>> http://fedoraproject.org/wiki/Packaging:PHP#C_extensions_.28PECL_and_others.29
> It stil needed for EPEL http://fedoraproject.org/wiki/Packaging:EPEL#PHP_ABI_Check_Handling and exactly in this form

Then you have to write this only for EPEL build. Again on F-17 parsing
"%if %{?php_zend_api}0" actually failed, because php_zend_api is not integer
(actually %php_zend_api is now 20090626-x86-32 on F-17 i686)
This EPEL form is no longer valid on Fedora (at least on F-17).

However "%if 0%{?php_zend_api?1:0}" is also wrong and this should be
"%if 0%{?php_zend_api:1}" if you want to use (guessing php_zend_api
is not defined as "0" even on EPEL)

Regards,
Mamoru




More information about the devel mailing list