Gentoo Archives: gentoo-commits

From: "Peter Alfredsen (loki_val)" <loki_val@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: base.eclass
Date: Sun, 09 Nov 2008 15:48:01
Message-Id: E1KzCVv-0004ey-Bj@stork.gentoo.org
1 loki_val 08/11/09 15:47:47
2
3 Modified: base.eclass
4 Log:
5 Apply EAPI-2 support for base.eclass as discussed on gentoo-dev ml.
6
7 Revision Changes Path
8 1.35 eclass/base.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/base.eclass?rev=1.35&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/base.eclass?rev=1.35&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/base.eclass?r1=1.34&r2=1.35
13
14 Index: base.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/base.eclass,v
17 retrieving revision 1.34
18 retrieving revision 1.35
19 diff -u -r1.34 -r1.35
20 --- base.eclass 17 Jul 2008 09:49:14 -0000 1.34
21 +++ base.eclass 9 Nov 2008 15:47:47 -0000 1.35
22 @@ -1,31 +1,77 @@
23 # Copyright 1999-2008 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.34 2008/07/17 09:49:14 pva Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.35 2008/11/09 15:47:47 loki_val Exp $
27
28 # @ECLASS: base.eclass
29 # @MAINTAINER:
30 -# ???
31 +# Peter Alfredsen <loki_val@g.o>
32 #
33 # Original author Dan Armak <danarmak@g.o>
34 # @BLURB: The base eclass defines some default functions and variables.
35 # @DESCRIPTION:
36 # The base eclass defines some default functions and variables. Nearly
37 # everything else inherits from here.
38 +#
39 +# NOTE: You must define EAPI before inheriting from base, or the wrong functions
40 +# may be exported.
41
42
43 inherit eutils
44
45 +case "${EAPI:-0}" in
46 + 2)
47 + EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
48 + ;;
49 + *)
50 + EXPORT_FUNCTIONS src_unpack src_compile src_install
51 + ;;
52 +esac
53 +
54 DESCRIPTION="Based on the $ECLASS eclass"
55
56 # @FUNCTION: base_src_unpack
57 # @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
58 # @DESCRIPTION:
59 # The base src_unpack function, which is exported. If no argument is given,
60 -# "all" is assumed.
61 +# "all" is assumed if EAPI!=2, "unpack" if EAPI=2.
62 base_src_unpack() {
63
64 - debug-print-function $FUNCNAME $*
65 - [ -z "$1" ] && base_src_unpack all
66 + debug-print-function $FUNCNAME "$@"
67 +
68 + if [ -z "$1" ]
69 + then
70 + case "${EAPI:-0}" in
71 + 2)
72 + base_src_util unpack
73 + ;;
74 + *)
75 + base_src_util all
76 + ;;
77 + esac
78 + else
79 + base_src_util $@
80 + fi
81 +}
82 +
83 +# @FUNCTION: base_src_prepare
84 +# @DESCRIPTION:
85 +# The base src_prepare function, which is exported when EAPI=2. Performs
86 +# "base_src_util autopatch".
87 +base_src_prepare() {
88 +
89 + debug-print-function $FUNCNAME "$@"
90 +
91 + base_src_util autopatch
92 +}
93 +
94 +# @FUNCTION: base_src_util
95 +# @USAGE: [ unpack ] [ patch ] [ autopatch ] [ all ]
96 +# @DESCRIPTION:
97 +# The base_src_util function is the grunt function for base src_unpack
98 +# and base src_prepare.
99 +base_src_util() {
100 +
101 + debug-print-function $FUNCNAME "$@"
102
103 cd "${WORKDIR}"
104
105 @@ -59,7 +105,7 @@
106 ;;
107 all)
108 debug-print-section all
109 - base_src_unpack unpack autopatch
110 + base_src_util unpack autopatch
111 ;;
112 esac
113
114 @@ -68,15 +114,49 @@
115
116 }
117
118 +# @FUNCTION: base_src_configure
119 +# @DESCRIPTION:
120 +# The base src_prepare function, which is exported when EAPI=2. Performs
121 +# "base_src_work configure".
122 +base_src_configure() {
123 +
124 + debug-print-function $FUNCNAME "$@"
125 +
126 + base_src_work configure
127 +}
128 +
129 # @FUNCTION: base_src_compile
130 # @USAGE: [ configure ] [ make ] [ all ]
131 # @DESCRIPTION:
132 # The base src_compile function, which is exported. If no argument is given,
133 -# "all" is asasumed.
134 +# "all" is assumed if EAPI!=2, "make" if EAPI=2.
135 base_src_compile() {
136
137 - debug-print-function $FUNCNAME $*
138 - [ -z "$1" ] && base_src_compile all
139 + debug-print-function $FUNCNAME "$@"
140 +
141 + if [ -z "$1" ]
142 + then
143 + case "${EAPI:-0}" in
144 + 2)
145 + base_src_work make
146 + ;;
147 + *)
148 + base_src_work all
149 + ;;
150 + esac
151 + else
152 + base_src_work $@
153 + fi
154 +}
155 +
156 +# @FUNCTION: base_src_work
157 +# @USAGE: [ configure ] [ make ] [ all ]
158 +# @DESCRIPTION:
159 +# The base_src_work function is the grunt function for base src_configure
160 +# and base src_compile.
161 +base_src_work() {
162 +
163 + debug-print-function $FUNCNAME "$@"
164
165 cd "${S}"
166
167 @@ -93,7 +173,7 @@
168 ;;
169 all)
170 debug-print-section all
171 - base_src_compile configure make
172 + base_src_work configure make
173 ;;
174 esac
175
176 @@ -109,7 +189,7 @@
177 # "all" is assumed.
178 base_src_install() {
179
180 - debug-print-function $FUNCNAME $*
181 + debug-print-function $FUNCNAME "$@"
182 [ -z "$1" ] && base_src_install all
183
184 cd "${S}"
185 @@ -131,5 +211,3 @@
186 done
187
188 }
189 -
190 -EXPORT_FUNCTIONS src_unpack src_compile src_install