Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11327 - in main/trunk: bin pym/_emerge pym/portage
Date: Mon, 04 Aug 2008 17:54:17
Message-Id: E1KQ4G6-0005Tu-9i@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-08-04 17:54:12 +0000 (Mon, 04 Aug 2008)
3 New Revision: 11327
4
5 Modified:
6 main/trunk/bin/ebuild
7 main/trunk/bin/ebuild.sh
8 main/trunk/bin/isolated-functions.sh
9 main/trunk/pym/_emerge/__init__.py
10 main/trunk/pym/portage/__init__.py
11 main/trunk/pym/portage/const.py
12 Log:
13 Bug #233735 - Add support for src_configure and default_* functions with
14 new EAPI=2_pre2. Thanks to Arfrever Frehtes Taifersar Arahesis for the
15 initial patch which I've made a few adjustments to.
16
17
18 Modified: main/trunk/bin/ebuild
19 ===================================================================
20 --- main/trunk/bin/ebuild 2008-08-04 15:46:24 UTC (rev 11326)
21 +++ main/trunk/bin/ebuild 2008-08-04 17:54:12 UTC (rev 11327)
22 @@ -182,7 +182,7 @@
23 tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST")
24 portage._doebuild_manifest_exempt_depend += 1
25
26 -build_dir_phases = set(["setup", "unpack", "compile",
27 +build_dir_phases = set(["setup", "unpack", "configure", "compile",
28 "test", "install", "package", "rpm"])
29
30 def stale_env_warning():
31
32 Modified: main/trunk/bin/ebuild.sh
33 ===================================================================
34 --- main/trunk/bin/ebuild.sh 2008-08-04 15:46:24 UTC (rev 11326)
35 +++ main/trunk/bin/ebuild.sh 2008-08-04 17:54:12 UTC (rev 11327)
36 @@ -583,7 +583,7 @@
37 fi
38 }
39
40 -pkg_nofetch() {
41 +_default_pkg_nofetch() {
42 [ -z "${SRC_URI}" ] && return
43
44 echo "!!! The following are listed in SRC_URI for ${PN}:"
45 @@ -593,22 +593,25 @@
46 done
47 }
48
49 -src_unpack() {
50 +_default_src_unpack() {
51 [[ -n ${A} ]] && unpack ${A}
52 }
53
54 -src_compile() {
55 +_default_src_configure() {
56 if [ "${EAPI:-0}" == 0 ] ; then
57 [ -x ./configure ] && econf
58 elif [ -x "${ECONF_SOURCE:-.}/configure" ] ; then
59 econf
60 fi
61 +}
62 +
63 +_default_src_compile() {
64 if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
65 emake || die "emake failed"
66 fi
67 }
68
69 -src_test() {
70 +_default_src_test() {
71 if emake -j1 check -n &> /dev/null; then
72 vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
73 if ! emake -j1 check; then
74 @@ -626,6 +629,25 @@
75 fi
76 }
77
78 +pkg_nofetch() {
79 + _default_pkg_nofetch
80 +}
81 +
82 +src_unpack() {
83 + _default_src_unpack
84 +}
85 +
86 +src_compile() {
87 + hasq "$EAPI" 0 1 2_pre1 && \
88 + _default_src_configure
89 +
90 + _default_src_compile
91 +}
92 +
93 +src_test() {
94 + _default_src_test
95 +}
96 +
97 ebuild_phase() {
98 [ "$(type -t ${1})" == "function" ] && qa_call ${1}
99 }
100 @@ -822,6 +844,12 @@
101 trap SIGINT SIGQUIT
102 }
103
104 +abort_configure() {
105 + abort_handler src_configure $1
106 + rm -f "$PORTAGE_BUILDDIR/.configured"
107 + exit 1
108 +}
109 +
110 abort_compile() {
111 abort_handler "src_compile" $1
112 rm -f "${PORTAGE_BUILDDIR}/.compiled"
113 @@ -840,72 +868,45 @@
114 exit 1
115 }
116
117 -dyn_compile() {
118 - trap "abort_compile" SIGINT SIGQUIT
119 +dyn_configure() {
120 + hasq "$EAPI" 0 1 2_pre1 && return 0
121
122 - [ "$(type -t pre_src_compile)" == "function" ] && qa_call pre_src_compile
123 + if [[ $PORTAGE_BUILDDIR/.configured -nt $WORKDIR ]] ; then
124 + vecho ">>> It appears that '$PF' is already configured; skipping."
125 + vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration."
126 + return 0
127 + fi
128
129 - [ "${CFLAGS-unset}" != "unset" ] && export CFLAGS
130 - [ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS
131 - [ "${LIBCFLAGS-unset}" != "unset" ] && export LIBCFLAGS
132 - [ "${LIBCXXFLAGS-unset}" != "unset" ] && export LIBCXXFLAGS
133 - [ "${LDFLAGS-unset}" != "unset" ] && export LDFLAGS
134 - [ "${ASFLAGS-unset}" != "unset" ] && export ASFLAGS
135 + trap abort_configure SIGINT SIGQUIT
136
137 - [ "${CCACHE_DIR-unset}" != "unset" ] && export CCACHE_DIR
138 - [ "${CCACHE_SIZE-unset}" != "unset" ] && export CCACHE_SIZE
139 + [[ $(type -t pre_src_configure) = function ]] && \
140 + qa_call pre_src_configure
141
142 - [ "${DISTCC_DIR-unset}" == "unset" ] && export DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc"
143 - [ ! -z "${DISTCC_DIR}" ] && addwrite "${DISTCC_DIR}"
144 + vecho ">>> Configuring source in $srcdir ..."
145 + ebuild_phase src_configure
146 + vecho ">>> Source configured."
147 + #|| abort_configure "fail"
148 + cd "$PORTAGE_BUILDDIR"
149 + touch .configured
150 + [[ $(type -t post_src_configure) = function ]] && \
151 + qa_call post_src_configure
152
153 - LIBDIR_VAR="LIBDIR_${ABI}"
154 - if [ -z "${PKG_CONFIG_PATH}" -a -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
155 - export PKG_CONFIG_PATH="/usr/${!LIBDIR_VAR}/pkgconfig"
156 - fi
157 - unset LIBDIR_VAR
158 + trap SIGINT SIGQUIT
159 +}
160
161 - if hasq noauto $FEATURES && [ ! -f ${PORTAGE_BUILDDIR}/.unpacked ]; then
162 - echo
163 - echo "!!! We apparently haven't unpacked... This is probably not what you"
164 - echo "!!! want to be doing... You are using FEATURES=noauto so I'll assume"
165 - echo "!!! that you know what you are doing... You have 5 seconds to abort..."
166 - echo
167 +dyn_compile() {
168
169 - local x
170 - for x in 1 2 3 4 5 6 7 8; do
171 - echo -ne "\a"
172 - LC_ALL=C sleep 0.25
173 - done
174 -
175 - sleep 3
176 + if [[ $PORTAGE_BUILDDIR/.compiled -nt $WORKDIR ]] ; then
177 + vecho ">>> It appears that '${PF}' is already compiled; skipping."
178 + vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation."
179 + return 0
180 fi
181
182 - local srcdir=${PORTAGE_BUILDDIR}
183 - cd "${PORTAGE_BUILDDIR}"
184 - if [ ! -e "build-info" ]; then
185 - mkdir build-info
186 - fi
187 - cp "${EBUILD}" "build-info/${PF}.ebuild"
188 + trap abort_compile SIGINT SIGQUIT
189
190 - if [[ ${PORTAGE_BUILDDIR}/.compiled -nt ${WORKDIR} ]] ; then
191 - vecho ">>> It appears that '${PF}' is already compiled; skipping."
192 - vecho ">>> Remove '${PORTAGE_BUILDDIR}/.compiled' to force compilation."
193 - trap SIGINT SIGQUIT
194 - [ "$(type -t post_src_compile)" == "function" ] && qa_call post_src_compile
195 - return
196 - fi
197 - if [ -d "${S}" ]; then
198 - srcdir=${S}
199 - else
200 - srcdir=${WORKDIR}
201 - fi
202 - cd "${srcdir}"
203 - #our custom version of libtool uses $S and $D to fix
204 - #invalid paths in .la files
205 - export S D
206 - #some packages use an alternative to $S to build in, cause
207 - #our libtool to create problematic .la files
208 - export PWORKDIR="$WORKDIR"
209 + [[ $(type -t pre_src_compile) = function ]] && \
210 + qa_call pre_src_compile
211 +
212 vecho ">>> Compiling source in ${srcdir} ..."
213 ebuild_phase src_compile
214 vecho ">>> Source compiled."
215 @@ -1059,8 +1060,9 @@
216 echo " digest : create a manifest file for the package"
217 echo " manifest : create a manifest file for the package"
218 echo " unpack : unpack/patch sources (auto-fetch if needed)"
219 - echo " compile : compile sources (auto-fetch/unpack if needed)"
220 - echo " test : test package (auto-fetch/unpack/compile if needed)"
221 + echo " configure : configure sources (auto-fetch/unpack if needed)"
222 + echo " compile : compile sources (auto-fetch/unpack/configure if needed)"
223 + echo " test : test package (auto-fetch/unpack/configure/compile if needed)"
224 echo " preinst : execute pre-install instructions"
225 echo " postinst : execute post-install instructions"
226 echo " install : install the package to the temporary install directory"
227 @@ -1350,13 +1352,39 @@
228 PATH="${stripped_path}"
229 }
230
231 +# @FUNCTION: source_all_bashrcs
232 +# @DESCRIPTION:
233 +# Source a relevant bashrc files and perform other miscellaneous
234 +# environment initialization when appropriate:
235 +#
236 +# * If EAPI is set, define default_* functions provided by the current EAPI.
237 +#
238 source_all_bashrcs() {
239 [ -n "$EBUILD_PHASE" ] || return
240 + local x
241 + local default_phases="pkg_nofetch src_unpack src_configure
242 + src_compile src_test"
243 +
244 + if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2_pre1 ; then
245 + for x in $default_phases ; do
246 + eval "default_$x() { _default_$x \"\$@\" ; }"
247 + done
248 +
249 + [[ $(type -t src_configure) = function ]] || \
250 + src_configure() { _default_src_configure "$@" ; }
251 +
252 + else
253 + for x in $default_phases ; do
254 + eval "default_$x() {
255 + die \"default_$x() is not supported with EAPI='$EAPI'\"
256 + }"
257 + done
258 + fi
259 +
260 local OCC="${CC}" OCXX="${CXX}"
261 # source the existing profile.bashrc's.
262 save_IFS
263 IFS=$'\n'
264 - local x
265 for x in ${PROFILE_PATHS}; do
266 # Must unset it so that it doesn't mess up assumptions in the RCs.
267 unset IFS
268 @@ -1717,6 +1745,10 @@
269 debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
270 fi
271
272 + # Set default EAPI if necessary, so that most
273 + # code can simply assume that it's defined.
274 + [[ -n $EAPI ]] || EAPI=0
275 +
276 # add in dependency info from eclasses
277 IUSE="${IUSE} ${E_IUSE}"
278 DEPEND="${DEPEND} ${E_DEPEND}"
279 @@ -1756,7 +1788,11 @@
280 declare -r ${READONLY_EBUILD_METADATA} ${READONLY_PORTAGE_VARS}
281 fi
282
283 -if [ -n "${EBUILD_SH_ARGS}" ] ; then
284 +ebuild_main() {
285 + local f x
286 + local export_vars="ASFLAGS CCACHE_DIR CCACHE_SIZE
287 + CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS"
288 +
289 case ${EBUILD_SH_ARGS} in
290 nofetch)
291 ebuild_phase_with_hooks pkg_nofetch
292 @@ -1786,12 +1822,71 @@
293 )
294 fi
295 ;;
296 - unpack|compile|test|clean|install)
297 - if [ "${SANDBOX_DISABLED="0"}" == "0" ]; then
298 + unpack|configure|compile|test|clean|install)
299 + if [[ ${SANDBOX_DISABLED:-0} = 0 ]] ; then
300 export SANDBOX_ON="1"
301 else
302 export SANDBOX_ON="0"
303 fi
304 +
305 + case "$EBUILD_SH_ARGS" in
306 + configure|compile)
307 +
308 + for x in $export_vars ; do
309 + [[ ${!x-unset} != unset ]] && export $x
310 + done
311 +
312 + hasq distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \
313 + [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \
314 + addwrite "$DISTCC_DIR"
315 +
316 + x=LIBDIR_$ABI
317 + [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \
318 + export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig
319 +
320 + if hasq noauto $FEATURES && \
321 + [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then
322 + echo
323 + echo "!!! We apparently haven't unpacked..." \
324 + "This is probably not what you"
325 + echo "!!! want to be doing... You are using" \
326 + "FEATURES=noauto so I'll assume"
327 + echo "!!! that you know what you are doing..." \
328 + "You have 5 seconds to abort..."
329 + echo
330 +
331 + local x
332 + for x in 1 2 3 4 5 6 7 8; do
333 + echo -ne "\a"
334 + LC_ALL=C sleep 0.25
335 + done
336 +
337 + sleep 3
338 + fi
339 +
340 + cd "$PORTAGE_BUILDDIR"
341 + if [ ! -d build-info ] ; then
342 + mkdir build-info
343 + cp "$EBUILD" "build-info/$PF.ebuild"
344 + fi
345 +
346 + local srcdir
347 + if [[ -d $S ]] ; then
348 + srcdir=$S
349 + else
350 + srcdir=$WORKDIR
351 + fi
352 + cd "$srcdir"
353 + #our custom version of libtool uses $S and $D to fix
354 + #invalid paths in .la files
355 + export S D
356 + #some packages use an alternative to $S to build in, cause
357 + #our libtool to create problematic .la files
358 + export PWORKDIR=$WORKDIR
359 +
360 + ;;
361 + esac
362 +
363 if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
364 dyn_${EBUILD_SH_ARGS}
365 else
366 @@ -1857,8 +1952,10 @@
367 esac
368 [ -n "${EBUILD_EXIT_STATUS_FILE}" ] && \
369 touch "${EBUILD_EXIT_STATUS_FILE}" &>/dev/null
370 -fi
371 +}
372
373 +[[ -n $EBUILD_SH_ARGS ]] && ebuild_main
374 +
375 # Save the env only for relevant phases.
376 if [ -n "${EBUILD_SH_ARGS}" ] && \
377 ! hasq ${EBUILD_SH_ARGS} clean depend help info nofetch ; then
378
379 Modified: main/trunk/bin/isolated-functions.sh
380 ===================================================================
381 --- main/trunk/bin/isolated-functions.sh 2008-08-04 15:46:24 UTC (rev 11326)
382 +++ main/trunk/bin/isolated-functions.sh 2008-08-04 17:54:12 UTC (rev 11327)
383 @@ -499,13 +499,16 @@
384 best_version use_with use_enable register_die_hook check_KV \
385 keepdir unpack strip_duplicate_slashes econf einstall \
386 dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
387 - insopts diropts exeopts libopts abort_handler abort_compile \
388 - abort_test abort_install dyn_compile dyn_test dyn_install \
389 + insopts diropts exeopts libopts \
390 + abort_handler abort_configure abort_compile \
391 + abort_test abort_install dyn_configure \
392 + dyn_compile dyn_test dyn_install \
393 dyn_preinst dyn_help debug-print debug-print-function \
394 debug-print-section inherit EXPORT_FUNCTIONS newdepend newrdepend \
395 newpdepend do_newdepend remove_path_entry \
396 save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
397 - source_all_bashrcs ebuild_phase ebuild_phase_with_hooks \
398 + source_all_bashrcs ebuild_main \
399 + ebuild_phase ebuild_phase_with_hooks \
400 ${QA_INTERCEPTORS}
401
402 # portage config variables and variables set directly by portage
403
404 Modified: main/trunk/pym/_emerge/__init__.py
405 ===================================================================
406 --- main/trunk/pym/_emerge/__init__.py 2008-08-04 15:46:24 UTC (rev 11326)
407 +++ main/trunk/pym/_emerge/__init__.py 2008-08-04 17:54:12 UTC (rev 11327)
408 @@ -2587,7 +2587,7 @@
409
410 __slots__ = ("pkg", "scheduler", "settings") + ("_tree",)
411
412 - _phases = ("compile", "test", "install")
413 + _phases = ("configure", "compile", "test", "install")
414
415 _live_eclasses = frozenset([
416 "cvs",
417
418 Modified: main/trunk/pym/portage/__init__.py
419 ===================================================================
420 --- main/trunk/pym/portage/__init__.py 2008-08-04 15:46:24 UTC (rev 11326)
421 +++ main/trunk/pym/portage/__init__.py 2008-08-04 17:54:12 UTC (rev 11327)
422 @@ -4544,8 +4544,10 @@
423
424 def eapi_is_supported(eapi):
425 eapi = str(eapi).strip()
426 - if eapi == "2_pre1":
427 +
428 + if eapi in ("2_pre2", "2_pre1"):
429 return True
430 +
431 try:
432 eapi = int(eapi)
433 except ValueError:
434 @@ -5042,7 +5044,8 @@
435 actionmap_deps={
436 "setup": [],
437 "unpack": ["setup"],
438 - "compile":["unpack"],
439 + "configure": ["unpack"],
440 + "compile":["configure"],
441 "test": ["compile"],
442 "install":["test"],
443 "rpm": ["install"],
444 @@ -5063,7 +5066,8 @@
445 validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
446 "config", "info", "setup", "depend",
447 "fetch", "fetchall", "digest",
448 - "unpack","compile","test","install","rpm","qmerge","merge",
449 + "unpack", "configure", "compile", "test",
450 + "install", "rpm", "qmerge", "merge",
451 "package","unmerge", "manifest"]
452
453 if mydo not in validcommands:
454 @@ -5617,13 +5621,14 @@
455
456 # args are for the to spawn function
457 actionmap = {
458 -"setup": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":1, "sesandbox":0, "fakeroot":0}},
459 -"unpack": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0, "sesandbox":sesandbox, "fakeroot":0}},
460 -"compile":{"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}},
461 -"test": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}},
462 -"install":{"cmd":ebuild_sh, "args":{"droppriv":0, "free":0, "sesandbox":sesandbox, "fakeroot":fakeroot}},
463 -"rpm": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}},
464 -"package":{"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}},
465 +"setup": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":1, "sesandbox":0, "fakeroot":0}},
466 +"unpack": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0, "sesandbox":sesandbox, "fakeroot":0}},
467 +"configure":{"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}},
468 +"compile": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}},
469 +"test": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, "sesandbox":sesandbox, "fakeroot":0}},
470 +"install": {"cmd":ebuild_sh, "args":{"droppriv":0, "free":0, "sesandbox":sesandbox, "fakeroot":fakeroot}},
471 +"rpm": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}},
472 +"package": {"cmd":misc_sh, "args":{"droppriv":0, "free":0, "sesandbox":0, "fakeroot":fakeroot}},
473 }
474
475 # merge the deps in so we have again a 'full' actionmap
476
477 Modified: main/trunk/pym/portage/const.py
478 ===================================================================
479 --- main/trunk/pym/portage/const.py 2008-08-04 15:46:24 UTC (rev 11326)
480 +++ main/trunk/pym/portage/const.py 2008-08-04 17:54:12 UTC (rev 11327)
481 @@ -55,7 +55,8 @@
482 "ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
483 "CONFIG_PROTECT_MASK", "CONFIG_PROTECT",
484 "PRELINK_PATH", "PRELINK_PATH_MASK", "PROFILE_ONLY_VARIABLES"]
485 -EBUILD_PHASES = ["setup", "unpack", "compile", "test", "install",
486 +EBUILD_PHASES = ["setup", "unpack", "configure",
487 + "compile", "test", "install",
488 "package", "preinst", "postinst","prerm", "postrm",
489 "other"]