Subject: [alpine-aports] [PATCH v3] testing/php7.1: upgrade to 7.1.2

From: Valery Kartel <[email-masked]>
Date: Sat, 18 Feb 2017 13:41:06 +0200

--
some fixes with variables
fixes in provides, replaces
add loading xml extension in /usr/bin/pecl
---
v1 -> v2:
fix extension depends tracing I broke in previous commit
minor cleanups

v2 -> v3:
make pear scripts use strict php-cli binary
pear: make suffixed scripts and unsuffixed symlinks
phar-phar: make suffixed scripts and unsuffixed symplnks
---
 testing/php7.1/APKBUILD | 87 +++++++++++++++++++++++--------------------------
 1 file changed, 41 insertions(+), 46 deletions(-)

diff --git a/testing/php7.1/APKBUILD b/testing/php7.1/APKBUILD
index 5bde8169ac..7634b69c52 100644
--- a/testing/php7.1/APKBUILD
+++ b/testing/php7.1/APKBUILD
@@ -1,26 +1,25 @@
 # Contributor: Valery Kartel <[email-masked]>
 # Maintainer: Valery Kartel <[email-masked]>
-_suffix=7.1
-_pkgreal=php
-provides=$_pkgreal
-replaces=$provides
-pkgname=$_pkgreal$_suffix
-pkgver=7.1.1
-pkgrel=1
-_apiver="20160303"
-pkgdesc="The PHP${pkgver%.*} language runtime engine"
+pkgname=php7.1
+pkgver=7.1.2
+pkgrel=0
+_apiver=20160303
+_suffix=${pkgname#php}
+_pkgreal=${pkgname%$_suffix}
+pkgdesc="The PHP$_suffix language runtime engine"
 url="http://www.php.net/"
 arch="all"
 license="PHP-3"
 options=""
 depends="$pkgname-config"
 depends_dev="$pkgname"
+replaces="$_pkgreal $_pkgreal-cli"
+provides="$replaces $pkgname-cli"
 makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev
 	aspell-dev enchant-dev expat-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev
 	libical-dev libressl-dev openldap-dev net-snmp-dev db-dev krb5-dev gdbm-dev sqlite-dev
 	freetds-dev mariadb-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libxpm-dev
-	libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev gsoap-dev recode-dev
-	libedit-dev gettext-dev
+	libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
 	"
 source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
 	$_pkgreal-module.conf.in
@@ -214,7 +213,7 @@ dev() {
 }
 
 doc() {
-	provides=$_pkgreal-doc
+	provides=
 	replaces=
 	default_doc || return 1
 	install_if="docs $pkgname-config=$pkgver-r$pkgrel"
@@ -236,7 +235,7 @@ apache2() {
 	cp "$builddir"/sapi/apache2handler/lib$_pkgreal*.so \
 		"$subpkgdir"/usr/lib/apache2/mod_$pkgname.so || return 1
 
-	install -D -m644 "$builddir"/$_pkgreal-module.conf \
+	install -Dm644 "$builddir"/$_pkgreal-module.conf \
 		"$subpkgdir"/etc/apache2/conf.d/$pkgname-module.conf
 }
 
@@ -308,13 +307,14 @@ fpm() {
 			"$subpkgdir"/etc/$pkgname/$file || return 1
 	done
 
-	install -D -m755 "$builddir"/$_pkgreal-fpm.initd \
+	install -Dm755 "$builddir"/$_pkgreal-fpm.initd \
 		"$subpkgdir"/etc/init.d/$_pkgreal-fpm$_suffix || return 1
-	install -D -m644 "$builddir"/$_pkgreal-fpm.logrotate \
+	install -Dm644 "$builddir"/$_pkgreal-fpm.logrotate \
 		"$subpkgdir"/etc/logrotate.d/$_pkgreal-fpm$_suffix || return 1
 }
 
 pear() {
+	local file
 	provides=$_pkgreal-pear
 	replaces=$provides
 	pkgdesc="$pkgdesc (extension and application repository)"
@@ -323,19 +323,23 @@ pear() {
 	mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/etc/$pkgname
 
-	mv "$pkgdir"/usr/bin/pecl \
-		"$pkgdir"/usr/bin/pear \
-		"$pkgdir"/usr/bin/peardev \
-		"$subpkgdir"/usr/bin/ || return 1
-
 	mv "$pkgdir"/etc/$pkgname/pear.conf \
 		"$subpkgdir"/etc/$pkgname/ || return 1
 
 	mv "$pkgdir"/usr/share \
 		"$subpkgdir"/usr/ || return 1
 
-	# allow pecl to read php config
-	sed -ie "s/-C -n -q/-C -q/" "$subpkgdir"/usr/bin/pecl
+	sed -e "s/\$INCARG/\$INCARG -d extension=xml.so/" \
+		 -i "$pkgdir"/usr/bin/pecl || return 1
+
+	for file in pear peardev pecl; do
+		mv "$pkgdir"/usr/bin/$file \
+			"$subpkgdir"/usr/bin/$file$_suffix || return 1
+		sed -e "s:/usr/bin/php:/usr/bin/php$_suffix:g" \
+			-i "$subpkgdir"/usr/bin/$file$_suffix || return 1
+		ln -sf /usr/bin/$file$_suffix \
+			"$subpkgdir"/usr/bin/$file || return 1
+	done
 }
 
 config() {
@@ -356,6 +360,7 @@ config() {
 }
 
 _phar() {
+	local file
 	provides=$_pkgreal-phar-phar
 	replaces=$provides
 	pkgdesc="$pkgdesc (archive script)"
@@ -363,29 +368,33 @@ _phar() {
 
 	mkdir -p "$subpkgdir"/usr/bin
 
-	mv "$pkgdir"/usr/bin/phar* \
-		"$subpkgdir"/usr/bin/ || return 1
+	rm "$pkgdir"/usr/bin/phar || return 1
+	mv "$pkgdir"/usr/bin/phar.phar \
+		"$subpkgdir"/usr/bin/phar.phar$_suffix || return 1
+	for file in phar$_suffix phar phar.phar; do
+		ln -sf /usr/bin/phar.phar$_suffix \
+			"$subpkgdir"/usr/bin/$file || return 1
+	done
 }
 
 _extension() {
-	provides=
-	replaces=
-	depends=
-
+	local dep
 	local name=${subpkgname#$pkgname-}
 	local index=$(eval echo \$_index_$name)
+	provides="$_pkgreal-$name"
+	replaces=
+	depends=
 
 	pkgdesc=$(eval echo \$_pkgdesc_$name)
 	: ${pkgdesc:=$(head -n1 "$builddir"/ext/$name/CREDITS)}
-	pkgdesc="PHP${pkgver%.*} extension: ${pkgdesc:-$name}"
+	pkgdesc="PHP$_suffix extension: ${pkgdesc:-$name}"
 
-	local dep
 	for dep in $(grep -o "_DEP('$name'.*" "$builddir"/ext/$name/config.w32 | sed "s/[',);]//g"); do
 		[ -z "${_extensions##*$dep*}" ] && depends="$depends $pkgname-$dep"
 	done
 
 	: ${index:=$(echo $depends | wc -w)}
-	depends="phpapi=$_apiver $pkgname-config $depends"
+	depends="$pkgname-config phpapi=$_apiver $depends"
 
 	mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
 		"$subpkgdir"/etc/$pkgname/conf.d
@@ -397,21 +406,7 @@ _extension() {
 		"$subpkgdir"/etc/$pkgname/conf.d/$(printf %02d $index)_$name.ini
 }
 
-md5sums="cd5b7dfc4bcf99fe11cae7917e9453e1  php-7.1.1.tar.bz2
-95d27e9f8f62f91531fc2c76af9065d0  php-module.conf.in
-ad13602a44d28092abc5681778f82b31  php-fpm.logrotate.in
-f5e8b469983f851d7665e32a9d529bbf  php-fpm.initd.in
-d088f00c226840bf7234c465de4118bb  php-fpm.patch.in
-c32f5ba7412548e5b233319ab32b6e50  includedir.patch.in
-483bc0a85c50a9a9aedbe14a19ed4526  install-pear.patch"
-sha256sums="d791d39d7b54ec42441a05a5f06d68a495647d843210e3ae4f2c6adb99c675bc  php-7.1.1.tar.bz2
-c197232950e8d60f87bb8bbd231445737c2efc3ff1b907a70fe43db7a0a1c0f3  php-module.conf.in
-606741a9ec11ff2162d1dd4fe469fb0c1b66ee33ba302f0aac4cb6f0be2f8ae0  php-fpm.logrotate.in
-cdc24d2e2e0e74ef7b8823ec8e058128dedcf9298f1e57c0450f3590137e1148  php-fpm.initd.in
-110928a5d3f15f6826d8be0a97b393e7e6676acb57c2e1eac32b80dafb3b7a6f  php-fpm.patch.in
-dff44c133f5023b03f8771dd826ce7ad529fb996a84a933a82cf4c4f71e86b94  includedir.patch.in
-f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab  install-pear.patch"
-sha512sums="005471c0233e04fd95e159f8106ecfb059500076482cd49b26d2597ac390f4fa09ec14146058cdcd38e7d27665ac1d2afdc758f41b86e7fb88c8ba405b6e6415  php-7.1.1.tar.bz2
+sha512sums="b4a3492f4af92facd16e7dfb47ec16b43e4c5b25be193ff6e36418173893edb75ca4ca94767b643a6971d60578727fa1f67f20cc84b9a140cb1b9a367ec34a6f  php-7.1.2.tar.bz2
 e0f24eea250ed6a8c8286b2ed496a3feb1d9a2e399755f822387a4c26b34168bb346109c08d2b827d8230fe3103295d8b7f7b6bc09219e5b3ad4429271ece5d6  php-module.conf.in
 b25c0bcaae4ddc7e001a6484423dec48be8735168dc3ab7471f5a57ce631273f11514c924b368ff846fe9a04bd4e1c7f296f1c8527f6f239a79df84189841983  php-fpm.logrotate.in
 809e584304365412ecf80eb2ebb613439342e9a1faf36d0b04c76e60b1bf1345812799a16ffad76dbd3aa5f00c55329a051b308e451301d6e8d673813e37856b  php-fpm.initd.in
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Timo Teras <[email-masked]>
Date: Tue, 21 Feb 2017 08:57:56 +0200

On Sat, 18 Feb 2017 13:41:06 +0200

> add loading xml extension in /usr/bin/pecl

Applied.

Though, some split functions give errors like:

>>> php7.1-posix*: Running split function _extension...
grep: /home/tteras/aports/testing/php7.1/src/php-7.1.2/ext/posix/config.w32:
No such file or directory

You may want to fix this on later updates.

Thanks!

---

---

From: Valery Kartel <[email-masked]>
Date: Tue, 21 Feb 2017 09:49:20 +0200

It's ok.
I try to dig depends list from extension/config.w32.
But some extensions have not this config.
So just ignore it...