public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] kernel-2.eclass: set UNIPATCH_LIST_GENPATCHES in src_unpack()
@ 2015-12-06 18:54 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2015-12-06 18:54 UTC (permalink / raw
  To: gentoo-dev; +Cc: mpagano, Michał Górny

Modify genpatches logic to delay setting UNIPATCH_LIST_GENPATCHES until
src_unpack(). The value of UNIPATCH_LIST_GENPATCHES depends on state of
'use experimental', therefore it can not be obtained in global scope.
Therefore, handle_genpatches() will only set the URI when called in
global scope, and it will set UNIPATCH_LIST_GENPATCHES on request which
is done during kernel-2_src_unpack().

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=566520
---
 eclass/kernel-2.eclass | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 1a508f1..02da62a 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -132,9 +132,20 @@ debug-print-kernel2-variables() {
 #Eclass functions only from here onwards ...
 #==============================================================
 handle_genpatches() {
-	local tarball
+	local tarball want_unipatch_list
 	[[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
 
+	if [[ -n ${1} ]]; then
+		# set UNIPATCH_LIST_GENPATCHES only on explicit request
+		# since that requires 'use' call which can be used only in phase
+		# functions, while the function is also called in global scope
+		if [[ ${1} == --set-unipatch-list ]]; then
+			want_unipatch_list=1
+		else
+			die "Usage: ${FUNCNAME} [--set-unipatch-list]"
+		fi
+	fi
+
 	debug-print "Inside handle_genpatches"
 	local OKV_ARRAY
 	IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
@@ -161,11 +172,11 @@ handle_genpatches() {
 			use_cond_start="experimental? ( "
 			use_cond_end=" )"
 
-			if use experimental ; then
+			if [[ -n ${want_unipatch_list} ]] && use experimental ; then
 				UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
 				debug-print "genpatches tarball: $tarball"
 			fi
-		else
+		elif [[ -n ${want_unipatch_list} ]]; then
 			UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
 			debug-print "genpatches tarball: $tarball"
 		fi
@@ -1232,6 +1243,8 @@ kernel-2_src_unpack() {
 	universal_unpack
 	debug-print "Doing unipatch"
 
+	# request UNIPATCH_LIST_GENPATCHES in phase since it calls 'use'
+	handle_genpatches --set-unipatch-list
 	[[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
 		unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
 
-- 
2.6.3



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-06 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-06 18:54 [gentoo-dev] [PATCH] kernel-2.eclass: set UNIPATCH_LIST_GENPATCHES in src_unpack() Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox