Bug 650324 noticed some inconsistencies with how user patches are applied.

Previously, it attempted to call default_src_prepare per target.
This, of course, would not reapply user patches for each target.

These patches bring this back into alignment and adjust packages which
would be negatively affected by this change.

Brian
From c0693eeafe8004ab698d2b46fa8a8c66aa1851a7 Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:19:36 -0400
Subject: [PATCH 1/7] eclass: php-ext-sources-r3 - Apply user patches to all
 targets

The original eclass copied sources as part of the exported src_unpack
and then attempted to apply default_src_prepare to every PHP_TARGET.

As the bug shows, this fails on eapply_user because that function will
only ever apply once.

Instead, eliminate the php-ext-sources-r3_src_unpack. Move the copy
function to src_prepare phase after patches were applied,
optionally disabled by PHP_EXT_SKIP_PATCHES=yes.

This eclass will only apply patches to PHP_EXT_S.

Fixes: https://bugs.gentoo.org/650324
---
 eclass/php-ext-source-r3.eclass | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
index dfcec487685..22f07f8827b 100644
--- a/eclass/php-ext-source-r3.eclass
+++ b/eclass/php-ext-source-r3.eclass
@@ -11,7 +11,7 @@
 
 inherit autotools
 
-EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install src_test
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test
 
 case ${EAPI} in
 	6) ;;
@@ -141,23 +141,16 @@ DEPEND="${DEPEND}
 # @ECLASS-VARIABLE: PHP_EXT_SKIP_PHPIZE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# By default, we run "phpize" in php-ext-source-r3_src_unpack(). Set
+# By default, we run "phpize" in php-ext-source-r3_src_prepare(). Set
 # PHP_EXT_SKIP_PHPIZE="yes" in your ebuild if you do not want to run
 # phpize (and the autoreconf that becomes necessary afterwards).
 
-# @FUNCTION: php-ext-source-r3_src_unpack
+# @ECLASS-VARIABLE: PHP_EXT_SKIP_PATCHES
+# @DEFAULT_UNSET
 # @DESCRIPTION:
-# Runs the default src_unpack and then makes a copy for each PHP slot.
-php-ext-source-r3_src_unpack() {
-	default
-
-	local slot orig_s="${PHP_EXT_S}"
-	for slot in $(php_get_slots); do
-		cp --recursive --preserve "${orig_s}" "${WORKDIR}/${slot}" || \
-			die "failed to copy sources from ${orig_s} to ${WORKDIR}/${slot}"
-	done
-}
-
+# By default, we run default_src_prepare to PHP_EXT_S.
+# Set PHP_EXT_SKIP_PATCHES="yes" in your ebuild if you
+# want to apply patches yourself.
 
 # @FUNCTION: php-ext-source-r3_src_prepare
 # @DESCRIPTION:
@@ -165,9 +158,16 @@ php-ext-source-r3_src_unpack() {
 # src_prepare() for PATCHES/eapply_user support, and then call
 # php-ext-source-r3_phpize.
 php-ext-source-r3_src_prepare() {
+	local slot orig_s="${PHP_EXT_S}"
+	if [[ "${PHP_EXT_SKIP_PATCHES}" != 'yes' ]] ; then
+		pushd "${orig_s}" > /dev/null || die
+		default
+		popd > /dev/null || die
+	fi
 	for slot in $(php_get_slots); do
+		cp --recursive --preserve "${orig_s}" "${WORKDIR}/${slot}" || \
+			die "failed to copy sources from ${orig_s} to ${WORKDIR}/${slot}"
 		php_init_slot_env "${slot}"
-		default
 		php-ext-source-r3_phpize
 	done
 }
-- 
2.16.1

From 5f6b52cdbfa4458a7ea4940b01d115c4dc2bae4c Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:29:26 -0400
Subject: [PATCH 2/7] sci-geosciences/mapserver: Apply php-ext-source-r3
 changes to src_unpack

---
 sci-geosciences/mapserver/mapserver-7.0.5.ebuild | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sci-geosciences/mapserver/mapserver-7.0.5.ebuild b/sci-geosciences/mapserver/mapserver-7.0.5.ebuild
index 69fae655f2c..a412b4ed85e 100644
--- a/sci-geosciences/mapserver/mapserver-7.0.5.ebuild
+++ b/sci-geosciences/mapserver/mapserver-7.0.5.ebuild
@@ -83,12 +83,10 @@ pkg_setup() {
 }
 
 src_unpack() {
-	# unpack A and then copy the php thingies into workdir/php-slot
-	php-ext-source-r3_src_unpack
-	# HACK: and then remove it and replace by symlink
+	default
+	# HACK: Make symlinks for php targets
 	local slot
 	for slot in $(php_get_slots); do
-		rm -rf "${WORKDIR}/${slot}" || die
 		ln -s "${PHP_EXT_S}" "${WORKDIR}/${slot}" || die
 	done
 }
-- 
2.16.1

From 22aff5b20453f792966b8a3a6372bb7c3c39426e Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:31:23 -0400
Subject: [PATCH 3/7] dev-php/twig: Remove src_unpack as changes to eclass make
 it obsolete

---
 dev-php/twig/twig-1.31.0.ebuild | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/dev-php/twig/twig-1.31.0.ebuild b/dev-php/twig/twig-1.31.0.ebuild
index e62d3486a73..7e678f068e6 100644
--- a/dev-php/twig/twig-1.31.0.ebuild
+++ b/dev-php/twig/twig-1.31.0.ebuild
@@ -27,15 +27,6 @@ DEPEND="test? ( dev-php/phpunit )"
 # requires *specific* versions.
 RDEPEND="dev-lang/php"
 
-src_unpack() {
-	# Don't make copies of the source tree if they won't be used.
-	if use extension; then
-		php-ext-source-r3_src_unpack
-	else
-		default
-	fi
-}
-
 src_prepare(){
 	# We need to call eapply_user ourselves, because it may be skipped
 	# if either the "extension" USE flag is not set, or if the user's
-- 
2.16.1

From 53c68d3214ead07f01b7ca743b641ac50603b0b4 Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:33:36 -0400
Subject: [PATCH 4/7] dev-php/pecl-zmq: Remove src_unpack as changes to eclass
 make it obsolete

---
 dev-php/pecl-zmq/pecl-zmq-9999.ebuild | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/dev-php/pecl-zmq/pecl-zmq-9999.ebuild b/dev-php/pecl-zmq/pecl-zmq-9999.ebuild
index 9e61585d5f6..3cf1f7076c2 100644
--- a/dev-php/pecl-zmq/pecl-zmq-9999.ebuild
+++ b/dev-php/pecl-zmq/pecl-zmq-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -20,11 +20,6 @@ SRC_URI=""
 EGIT_REPO_URI="https://github.com/mkoppanen/php-zmq.git";
 EGIT_CHECKOUT_DIR="${PHP_EXT_S}"
 
-src_unpack() {
-	git-r3_src_unpack
-	php-ext-source-r3_src_unpack
-}
-
 src_configure() {
 	local PHP_EXT_ECONF_ARGS=( $(use_with czmq) )
 	php-ext-source-r3_src_configure
-- 
2.16.1

From 9c3cf085fda37422bdef15db5b7ed03725c77181 Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:35:05 -0400
Subject: [PATCH 5/7] dev-php/pecl-ssh2: Remove src_unpack as changes to eclass
 make it obsolete

---
 dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild b/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
index ee9effc3e76..63cee3d068b 100644
--- a/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
+++ b/dev-php/pecl-ssh2/pecl-ssh2-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -22,11 +22,6 @@ RDEPEND="${DEPEND}
 	php_targets_php5-6? ( dev-php/pecl-ssh2:0[php_targets_php5-6] )"
 HOMEPAGE="https://pecl.php.net/package/ssh2";
 
-src_unpack() {
-	git-r3_src_unpack
-	php-ext-source-r3_src_unpack
-}
-
 src_prepare() {
 	if use php_targets_php7-0 || use php_targets_php7-1 ; then
 		php-ext-source-r3_src_prepare
-- 
2.16.1

From fa7b8edae65d012d9ee4ddc6e3c10b9cd7fa9262 Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:36:41 -0400
Subject: [PATCH 6/7] dev-php/maxmind-db-reader: Remove src_unpack as changes
 to eclass make it obsolete

---
 dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild b/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild
index 6d5d40ddc9c..344af793832 100644
--- a/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild
+++ b/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -28,15 +28,6 @@ DEPEND="${COMMON_DEPEND}"
 RDEPEND="${COMMON_DEPEND}
 		dev-php/fedora-autoloader"
 
-src_unpack() {
-	# Don't make copies of the source tree if they won't be used.
-	if use extension; then
-		php-ext-source-r3_src_unpack
-	else
-		default
-	fi
-}
-
 src_prepare(){
 	# We need to call eapply_user ourselves, because it may be skipped
 	# if either the "extension" USE flag is not set, or if the user's
-- 
2.16.1

From 1b26111038bb71464118aa0b128c1ef602fb8f76 Mon Sep 17 00:00:00 2001
From: Brian Evans <[email protected]>
Date: Mon, 12 Mar 2018 20:51:49 -0400
Subject: [PATCH 7/7] dev-libs/ossp-uuid: Rearrange src_prepare for eclass
 changes

Skip patching in php-ext-source-r3 and handle them here
before copying to slots.
---
 dev-libs/ossp-uuid/ossp-uuid-1.6.2-r6.ebuild | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/dev-libs/ossp-uuid/ossp-uuid-1.6.2-r6.ebuild b/dev-libs/ossp-uuid/ossp-uuid-1.6.2-r6.ebuild
index 1d735746f34..67d3db31145 100644
--- a/dev-libs/ossp-uuid/ossp-uuid-1.6.2-r6.ebuild
+++ b/dev-libs/ossp-uuid/ossp-uuid-1.6.2-r6.ebuild
@@ -10,6 +10,7 @@ PHP_EXT_INI="yes"
 PHP_EXT_ZENDEXT="no"
 PHP_EXT_S="${WORKDIR}/${MY_P}/php"
 PHP_EXT_OPTIONAL_USE="php"
+PHP_EXT_SKIP_PATCHES="yes"
 USE_PHP="php5-6 php7-0 php7-1"
 
 GENTOO_DEPEND_ON_PERL="no"
@@ -41,21 +42,18 @@ src_prepare() {
 		"${FILESDIR}/${P}-fix-whatis-entries.patch" \
 		"${FILESDIR}/${P}-fix-data-uuid-from-string.patch"
 
+	eapply_user
 	if use php; then
-		local slot
-		for slot in $(php_get_slots); do
-			php_init_slot_env ${slot}
-			eapply -p2 \
-				"${FILESDIR}/${P}-gentoo-php.patch" \
-				"${FILESDIR}/uuid-${PV}-php54.patch" \
-				"${FILESDIR}/${P}-php70.patch"
-		done
-
+		pushd "${PHP_EXT_S}" > /dev/null || die
+		eapply -p2 \
+			"${FILESDIR}/${P}-gentoo-php.patch" \
+			"${FILESDIR}/uuid-${PV}-php54.patch" \
+			"${FILESDIR}/${P}-php70.patch"
+		popd > /dev/null || die
 		php-ext-source-r3_src_prepare
+
 		#Remove call by reference which is error
 		sed -i -e 's/\&\$/\$/' -e '/?>/d' "${S}/php/uuid.php5" || die
-	else
-		eapply_user
 	fi
 }
 
-- 
2.16.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to