1 |
The ready to cut ebuild at the bottom print it's environment (variable |
2 |
and functions) to a bunch of files into /var/tmp/fakebuild/. |
3 |
May be useful for who want to have a look at "what" and "when" is |
4 |
avaible during the various emerge phases (but not limited to). |
5 |
|
6 |
usage: |
7 |
# env -i \ |
8 |
PORTDIR_OVERLAY=/the/path/ \ |
9 |
fakebuild_progr=100 \ |
10 |
ebuild fakebuild-1.ebuild digest |
11 |
|
12 |
# env -i \ |
13 |
fakebuild_progr=200 \ |
14 |
PORTDIR_OVERLAY=/the/path/ \ |
15 |
emerge --buildpkgonly =fakebuild-1 |
16 |
|
17 |
hint: try also the following: |
18 |
- remove the egrep, sort after "typeset" to have also the sorce code of |
19 |
the functions |
20 |
- remove "{pkg,src}*" functions (after the previous step) to have a |
21 |
look at the predefined functions. |
22 |
|
23 |
|
24 |
--- app-misc/fakebuild -- |
25 |
# Copyright 1999-2005 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
# $Header: $ |
28 |
|
29 |
DESCRIPTION="fake ebuild to test environment" |
30 |
HOMEPAGE="http://dev.gentoo.org/~vivo/" |
31 |
SRC_URI="" |
32 |
|
33 |
LICENSE="GPL-2" |
34 |
SLOT="0" |
35 |
KEYWORDS="~x86" |
36 |
|
37 |
print_env() { |
38 |
local fakebuild_output_dir="/var/tmp/fakebuild" |
39 |
mkdir -p "${fakebuild_output_dir}" || die |
40 |
|
41 |
[[ -z "${fakebuild_progr}" ]] && fakebuild_progr=100 |
42 |
fakebuild_progr=$(( $fakebuild_progr +1 )) |
43 |
export fakebuild_progr |
44 |
|
45 |
local fakebuild_ext="${1}.${fakebuild_progr}" |
46 |
|
47 |
# not sorting, break multiline vars |
48 |
einfo "${fakebuild_output_dir}/env_${fakebuild_ext}" |
49 |
env \ |
50 |
&> "${fakebuild_output_dir}/env_${fakebuild_ext}" |
51 |
|
52 |
# Remove egrep and sort to see the source of every fx |
53 |
einfo "${fakebuild_output_dir}/fxlist_${fakebuild_ext}" |
54 |
typeset \ |
55 |
| egrep '^\b.* \(\)' \ |
56 |
| sort \ |
57 |
&> "${fakebuild_output_dir}/fxlist_${fakebuild_ext}" |
58 |
} |
59 |
|
60 |
print_env "global_scope" |
61 |
|
62 |
pkg_setup() { print_env "pkg_setup" ; } |
63 |
src_unpack() { print_env "src_unpack" ; } |
64 |
src_compile() { print_env "src_compile" ; } |
65 |
src_test() { print_env "src_test" ; } |
66 |
src_install() { print_env "src_install" ; } |
67 |
pkg_preinst() { print_env "pkg_preinst" ; } |
68 |
pkg_postinst() { print_env "pkg_postinst" ; } |
69 |
--- app-misc/fakebuild -- |
70 |
|
71 |
-- |
72 |
________ ___ _ _ ____ _____ ___ ____ ____ ___ |
73 |
/ ___/_ \_ \/ \ / / ___/ ___/ _ / ___/ _ \ /_ \ |
74 |
/ __/ _/__ / \ \/ / /__/ _/_ _\ \/ /__/ / / / / _/ |
75 |
/_/ /_/\_\/_/_/_/ \__/\___/____//___ \___/\____/ / /\_\o |
76 |
|
77 |
Simultaneous breaking of databases and backups since '90s. |
78 |
World wide since 2005.0 |
79 |
|
80 |
-- |
81 |
gentoo-dev@g.o mailing list |