diff --git a/geoip-build.patch b/geoip-build.patch new file mode 100644 index 0000000..c8f7397 --- /dev/null +++ b/geoip-build.patch @@ -0,0 +1,13 @@ +--- pecl/geoip/trunk/geoip.c 2010/03/31 20:39:48 297236 ++++ pecl/geoip/trunk/geoip.c 2011/06/05 19:00:52 311837 +@@ -238,7 +238,9 @@ + + add_assoc_bool(row, "available", GeoIP_db_avail(i)); + add_assoc_string(row, "description", (char *)GeoIPDBDescription[i], 1); +- add_assoc_string(row, "filename", GeoIPDBFileName[i], 1); ++ if (GeoIPDBFileName[i]) { ++ add_assoc_string(row, "filename", GeoIPDBFileName[i], 1); ++ } + + add_index_zval(return_value, i, row); + } diff --git a/geoip-tests.patch b/geoip-tests.patch new file mode 100644 index 0000000..6dfd861 --- /dev/null +++ b/geoip-tests.patch @@ -0,0 +1,72 @@ +Index: tests/008.phpt +=================================================================== +--- tests/008.phpt (revision 311865) ++++ tests/008.phpt (working copy) +@@ -5,7 +5,11 @@ + --FILE-- + + --EXPECT-- +Index: tests/011.phpt +=================================================================== +--- tests/011.phpt (revision 311865) ++++ tests/011.phpt (working copy) +@@ -4,8 +4,12 @@ + + --FILE-- + + --EXPECTF-- +Index: tests/014.phpt +=================================================================== +--- tests/014.phpt (revision 311865) ++++ tests/014.phpt (working copy) +@@ -7,17 +7,15 @@ + --FILE-- + + --EXPECTF-- + string(%d) "America/%s" +-string(%d) "America/%s" +-string(%d) "America/%s" ++string(%d) "Africa/Lagos" + + Warning: geoip_time_zone_by_country_and_region(): You need to specify at least the country code. in %s on line %d + bool(false) +Index: geoip.c +=================================================================== +--- geoip.c (revision 311865) ++++ geoip.c (working copy) +@@ -118,6 +118,7 @@ + _GeoIP_setup_dbfilename(); + + /* For database type constants */ ++ REGISTER_LONG_CONSTANT("GEOIP_NUM_DB_TYPES", NUM_DB_TYPES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GEOIP_COUNTRY_EDITION", GEOIP_COUNTRY_EDITION, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GEOIP_REGION_EDITION_REV0", GEOIP_REGION_EDITION_REV0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("GEOIP_CITY_EDITION_REV0", GEOIP_CITY_EDITION_REV0, CONST_CS | CONST_PERSISTENT); diff --git a/php-pecl-geoip.spec b/php-pecl-geoip.spec index 38e40a6..e473974 100644 --- a/php-pecl-geoip.spec +++ b/php-pecl-geoip.spec @@ -1,4 +1,3 @@ -%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1) %{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} %{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}} @@ -6,14 +5,19 @@ Name: php-pecl-geoip Version: 1.0.7 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Extension to map IP addresses to geographic places Group: Development/Languages License: PHP URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# https://bugs.php.net/bug.php?id=60066 +Patch0: geoip-build.patch +# https://bugs.php.net/bug.php?id=59804 +Patch1: geoip-tests.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: GeoIP-devel BuildRequires: php-devel BuildRequires: php-pear >= 1:1.4.0 @@ -23,6 +27,12 @@ Requires(post): %{__pecl} Requires(postun): %{__pecl} Provides: php-pecl(%{pecl_name}) = %{version} +# RPM 4.8 +%{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$} +%{?filter_setup} +# RPM 4.9 +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$ + %description This PHP extension allows you to find the location of an IP address @@ -35,6 +45,11 @@ database [ -f package2.xml ] || %{__mv} package.xml package2.xml %{__mv} package2.xml %{pecl_name}-%{version}/%{pecl_name}.xml +cd %{pecl_name}-%{version} +%patch0 -p3 -b .build +%patch1 -p0 -b .tests + + %build cd %{pecl_name}-%{version} phpize @@ -57,6 +72,18 @@ EOF %{__install} -p -m 644 %{pecl_name}.xml %{buildroot}%{pecl_xmldir}/%{name}.xml +%check +cd %{pecl_name}-%{version} + +TEST_PHP_EXECUTABLE=%{_bindir}/php \ +REPORT_EXIT_STATUS=1 \ +NO_INTERACTION=1 \ +%{_bindir}/php run-tests.php \ + -n -q \ + -d extension_dir=modules \ + -d extension=%{pecl_name}.so + + %clean %{__rm} -rf %{buildroot} @@ -77,6 +104,12 @@ fi %{pecl_xmldir}/%{name}.xml %changelog +* Sat Oct 15 2011 Remi Collet - 1.0.7-7 +- fix segfault when build with latest GeoIP (#746417) +- run test suite during build +- add patch for tests, https://bugs.php.net/bug.php?id=59804 +- add filter to avoid private-shared-object-provides geoip.so + * Fri Jul 15 2011 Andrew Colin Kissa - 1.0.7-6 - Fix bugzilla #715693