Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: mpagano@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] kernel-2.eclass: set UNIPATCH_LIST_GENPATCHES in src_unpack()
Date: Sun, 06 Dec 2015 18:54:26
Message-Id: 1449428041-20235-1-git-send-email-mgorny@gentoo.org
1 Modify genpatches logic to delay setting UNIPATCH_LIST_GENPATCHES until
2 src_unpack(). The value of UNIPATCH_LIST_GENPATCHES depends on state of
3 'use experimental', therefore it can not be obtained in global scope.
4 Therefore, handle_genpatches() will only set the URI when called in
5 global scope, and it will set UNIPATCH_LIST_GENPATCHES on request which
6 is done during kernel-2_src_unpack().
7
8 Fixes: https://bugs.gentoo.org/show_bug.cgi?id=566520
9 ---
10 eclass/kernel-2.eclass | 19 ++++++++++++++++---
11 1 file changed, 16 insertions(+), 3 deletions(-)
12
13 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
14 index 1a508f1..02da62a 100644
15 --- a/eclass/kernel-2.eclass
16 +++ b/eclass/kernel-2.eclass
17 @@ -132,9 +132,20 @@ debug-print-kernel2-variables() {
18 #Eclass functions only from here onwards ...
19 #==============================================================
20 handle_genpatches() {
21 - local tarball
22 + local tarball want_unipatch_list
23 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
24
25 + if [[ -n ${1} ]]; then
26 + # set UNIPATCH_LIST_GENPATCHES only on explicit request
27 + # since that requires 'use' call which can be used only in phase
28 + # functions, while the function is also called in global scope
29 + if [[ ${1} == --set-unipatch-list ]]; then
30 + want_unipatch_list=1
31 + else
32 + die "Usage: ${FUNCNAME} [--set-unipatch-list]"
33 + fi
34 + fi
35 +
36 debug-print "Inside handle_genpatches"
37 local OKV_ARRAY
38 IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
39 @@ -161,11 +172,11 @@ handle_genpatches() {
40 use_cond_start="experimental? ( "
41 use_cond_end=" )"
42
43 - if use experimental ; then
44 + if [[ -n ${want_unipatch_list} ]] && use experimental ; then
45 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
46 debug-print "genpatches tarball: $tarball"
47 fi
48 - else
49 + elif [[ -n ${want_unipatch_list} ]]; then
50 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
51 debug-print "genpatches tarball: $tarball"
52 fi
53 @@ -1232,6 +1243,8 @@ kernel-2_src_unpack() {
54 universal_unpack
55 debug-print "Doing unipatch"
56
57 + # request UNIPATCH_LIST_GENPATCHES in phase since it calls 'use'
58 + handle_genpatches --set-unipatch-list
59 [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
60 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
61
62 --
63 2.6.3