summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-04 13:07:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-05 14:24:43 +0000
commit82233cd647b1ecc256afb0c3378906cf8af46f8e (patch)
treea2f2f36ef823d4f62d1c9d25c1acf42766714283
parentf17a6937ab50452834dc85fab4e9712576e0c840 (diff)
downloadpoky-82233cd647b1ecc256afb0c3378906cf8af46f8e.tar.gz
eglibc-options: Rewrite so it benefits from bitbake's contains handling
Having eglibc rebuild every time DISTRO_FEATURES changes is suboptimal. This rewrite takes advantage of bitbake's understanding of the contains function so this doesn't happen. The code is marginally uglier but is worth the benefit in fewer libc rebuilds. (From OE-Core rev: 9a272ee6d72fc727a2dfe660ceded560a9f1ae88) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/eglibc/eglibc-options.inc204
1 files changed, 119 insertions, 85 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-options.inc b/meta/recipes-core/eglibc/eglibc-options.inc
index c55d05d163..0432758417 100644
--- a/meta/recipes-core/eglibc/eglibc-options.inc
+++ b/meta/recipes-core/eglibc/eglibc-options.inc
@@ -1,7 +1,7 @@
1def eglibc_cfg(feature, features, tokens, cnf): 1def eglibc_cfg(feature, tokens, cnf):
2 if type(tokens) == type(""): 2 if type(tokens) == type(""):
3 tokens = [tokens] 3 tokens = [tokens]
4 if type(features) == type([]) and feature in features: 4 if feature:
5 cnf.extend([token + '=y' for token in tokens]) 5 cnf.extend([token + '=y' for token in tokens])
6 else: 6 else:
7 for token in tokens: 7 for token in tokens:
@@ -10,119 +10,153 @@ def eglibc_cfg(feature, features, tokens, cnf):
10 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""]) 10 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""])
11 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""]) 11 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""])
12 12
13# arrange the dependencies among eglibc configuable options according to file option-groups.def from eglibc source code 13# Map distro features to eglibc options settings
14def distro_features_check_deps(distro_features): 14def features_to_eglibc_settings(d):
15 cnf = ([])
16
17 ipv4 = base_contains('DISTRO_FEATURES', 'ipv4', True, False, d)
18 ipv6 = base_contains('DISTRO_FEATURES', 'ipv6', True, False, d)
19 libc_backtrace = base_contains('DISTRO_FEATURES', 'libc-backtrace', True, False, d)
20 libc_big_macros = base_contains('DISTRO_FEATURES', 'libc-big-macros', True, False, d)
21 libc_bsd = base_contains('DISTRO_FEATURES', 'libc-bsd', True, False, d)
22 libc_cxx_tests = base_contains('DISTRO_FEATURES', 'libc-cxx-tests', True, False, d)
23 libc_catgets = base_contains('DISTRO_FEATURES', 'libc-catgets', True, False, d)
24 libc_charsets = base_contains('DISTRO_FEATURES', 'libc-charsets', True, False, d)
25 libc_crypt = base_contains('DISTRO_FEATURES', 'libc-crypt', True, False, d)
26 libc_crypt_ufc = base_contains('DISTRO_FEATURES', 'libc-crypt-ufc', True, False, d)
27 libc_db_aliases = base_contains('DISTRO_FEATURES', 'libc-db-aliases', True, False, d)
28 libc_envz = base_contains('DISTRO_FEATURES', 'libc-envz', True, False, d)
29 libc_fcvt = base_contains('DISTRO_FEATURES', 'libc-fcvt', True, False, d)
30 libc_fmtmsg = base_contains('DISTRO_FEATURES', 'libc-fmtmsg', True, False, d)
31 libc_fstab = base_contains('DISTRO_FEATURES', 'libc-fstab', True, False, d)
32 libc_ftraverse = base_contains('DISTRO_FEATURES', 'libc-ftraverse', True, False, d)
33 libc_getlogin = base_contains('DISTRO_FEATURES', 'libc-getlogin', True, False, d)
34 libc_idn = base_contains('DISTRO_FEATURES', 'libc-idn', True, False, d)
35 libc_inet_anl = base_contains('DISTRO_FEATURES', 'libc-inet-anl', True, False, d)
36 libc_libm = base_contains('DISTRO_FEATURES', 'libc-libm', True, False, d)
37 libc_locales = base_contains('DISTRO_FEATURES', 'libc-locales', True, False, d)
38 libc_locale_code = base_contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d)
39 libc_memusage = base_contains('DISTRO_FEATURES', 'libc-memusage', True, False, d)
40 libc_nis = base_contains('DISTRO_FEATURES', 'libc-nis', True, False, d)
41 libc_nsswitch = base_contains('DISTRO_FEATURES', 'libc-nsswitch', True, False, d)
42 libc_rcmd = base_contains('DISTRO_FEATURES', 'libc-rcmd', True, False, d)
43 libc_rtld_debug = base_contains('DISTRO_FEATURES', 'libc-rtld-debug', True, False, d)
44 libc_spawn = base_contains('DISTRO_FEATURES', 'libc-spawn', True, False, d)
45 libc_streams = base_contains('DISTRO_FEATURES', 'libc-streams', True, False, d)
46 libc_sunrpc = base_contains('DISTRO_FEATURES', 'libc-sunrpc', True, False, d)
47 libc_utmp = base_contains('DISTRO_FEATURES', 'libc-utmp', True, False, d)
48 libc_utmpx = base_contains('DISTRO_FEATURES', 'libc-utmpx', True, False, d)
49 libc_wordexp = base_contains('DISTRO_FEATURES', 'libc-wordexp', True, False, d)
50 libc_posix_clang_wchar = base_contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', True, False, d)
51 libc_posix_regexp = base_contains('DISTRO_FEATURES', 'libc-posix-regexp', True, False, d)
52 libc_posix_regexp_glibc = base_contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d)
53 libc_posix_wchar_io = base_contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d)
54
55 # arrange the dependencies among eglibc configuable options according to file option-groups.def from eglibc source code
15 new_dep = True 56 new_dep = True
16 while new_dep: 57 while new_dep:
17 new_dep = False 58 new_dep = False
18 59
19 if 'ipv6' in distro_features and 'ipv4' not in distro_features: 60 if ipv6 and not ipv4:
20 new_dep = True 61 new_dep = True
21 distro_features.extend(['ipv4']) 62 ipv4 = True
22 63
23 if 'ipv4' in distro_features and 'libc-nsswitch' not in distro_features: 64 if ipv4 and not libc_nsswitch:
24 new_dep = True 65 new_dep = True
25 distro_features.extend(['libc-nsswitch']) 66 libc_nsswitch = True
26 67
27 if 'libc-cxx-tests' in distro_features: 68 if libc_cxx_tests:
28 if 'libc-posix-wchar-io' not in distro_features: 69 if not libc_posix_wchar_io:
29 new_dep = True 70 new_dep = True
30 distro_features.extend(['libc-posix-wchar-io']) 71 libc_posix_wchar_io = True
31 if 'libc-libm' not in distro_features: 72 if not libc_libm:
32 new_dep = True 73 new_dep = True
33 distro_features.extend(['libc-libm']) 74 libc_libm = True
34 75
35 if 'libc-catgets' in distro_features and 'libc-locale-code' not in distro_features: 76 if libc_catgets and not libc_locale_code:
36 new_dep = True 77 new_dep = True
37 distro_features.extend(['libc-locale-code']) 78 libc_locale_code = True
38 79
39 if 'libc-crypt-ufc' in distro_features and 'libc-crypt' not in distro_features: 80 if libc_crypt_ufc and not libc_crypt:
40 new_dep = True 81 new_dep = True
41 distro_features.extend(['libc-crypt']) 82 libc_crypt = True
42 83
43 if 'libc-getlogin' in distro_features and 'libc-utmp' not in distro_features: 84 if libc_getlogin and not libc_utmp:
44 new_dep = True 85 new_dep = True
45 distro_features.extend(['libc-utmp']) 86 libc_utmp = True
46 87
47 if 'libc-inet-anl' in distro_features and 'ipv4' not in distro_features: 88 if libc_inet_anl and not ipv4:
48 new_dep = True 89 new_dep = True
49 distro_features.extend(['ipv4']) 90 ipv4 = True
50 91
51 if 'libc-locale-code' in distro_features and 'libc-posix-clang-wchar' not in distro_features: 92 if libc_locale_code and not libc_posix_clang_wchar:
52 new_dep = True 93 new_dep = True
53 distro_features.extend(['libc-posix-clang-wchar']) 94 libc_posix_clang_wchar = True
54 95
55 if 'libc-nis' in distro_features: 96 if libc_nis:
56 if 'ipv4' not in distro_features: 97 if not ipv4:
57 new_dep = True 98 new_dep = True
58 distro_features.extend(['ipv4']) 99 ipv4 = True
59 if 'libc-sunrpc' not in distro_features: 100 if not libc_sunrpc:
60 new_dep = True 101 new_dep = True
61 distro_features.extend(['libc-sunrpc']) 102 libc_sunrpc = True
62 103
63 if 'libc-rcmd' in distro_features and 'ipv4' not in distro_features: 104 if libc_rcmd and not ipv4:
64 new_dep = True 105 new_dep = True
65 distro_features.extend(['ipv4']) 106 ipv4 = True
66 107
67 if 'libc-sunrpc' in distro_features and 'ipv4' not in distro_features: 108 if libc_sunrpc and not ipv4:
68 new_dep = True 109 new_dep = True
69 distro_features.extend(['ipv4']) 110 ipv4 = True
70 111
71 if 'libc-utmpx' in distro_features and 'libc-utmp' not in distro_features: 112 if libc_utmpx and not libc_utmp:
72 new_dep = True 113 new_dep = True
73 distro_features.extend(['libc-utmp']) 114 libc_utmp = True
74 115
75 if 'libc-posix-regexp-glibc' in distro_features and 'libc-posix-regexp' not in distro_features: 116 if libc_posix_regexp_glibc and not libc_posix_regexp:
76 new_dep = True 117 new_dep = True
77 distro_features.extend(['libc-posix-regexp']) 118 libc_posix_regexp = True
78 119
79 if 'libc-posix-wchar-io' in distro_features and 'libc-posix-clang-wchar' not in distro_features: 120 if libc_posix_wchar_io and not libc_posix_clang_wchar:
80 new_dep = True 121 new_dep = True
81 distro_features.extend(['libc-posix-clang-wchar']) 122 libc_posix_clang_wchar = True
82 123
83# Map distro features to eglibc options settings 124 eglibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
84def features_to_eglibc_settings(d): 125 eglibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
85 cnf = ([]) 126 eglibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
86 distro_features = (d.getVar('DISTRO_FEATURES', True) or '').split() 127 eglibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
87 128 eglibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
88 distro_features_check_deps(distro_features) 129 eglibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
89 130 eglibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
90 eglibc_cfg('ipv6', distro_features, 'OPTION_EGLIBC_ADVANCED_INET6', cnf) 131 eglibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
91 eglibc_cfg('libc-backtrace', distro_features, 'OPTION_EGLIBC_BACKTRACE', cnf) 132 eglibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
92 eglibc_cfg('libc-big-macros', distro_features, 'OPTION_EGLIBC_BIG_MACROS', cnf) 133 eglibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
93 eglibc_cfg('libc-bsd', distro_features, 'OPTION_EGLIBC_BSD', cnf) 134 eglibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
94 eglibc_cfg('libc-cxx-tests', distro_features, 'OPTION_EGLIBC_CXX_TESTS', cnf) 135 eglibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
95 eglibc_cfg('libc-catgets', distro_features, 'OPTION_EGLIBC_CATGETS', cnf) 136 eglibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
96 eglibc_cfg('libc-charsets', distro_features, 'OPTION_EGLIBC_CHARSETS', cnf) 137 eglibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
97 eglibc_cfg('libc-crypt', distro_features, 'OPTION_EGLIBC_CRYPT', cnf) 138 eglibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
98 eglibc_cfg('libc-crypt-ufc', distro_features, 'OPTION_EGLIBC_CRYPT_UFC', cnf) 139 eglibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
99 eglibc_cfg('libc-db-aliases', distro_features, 'OPTION_EGLIBC_DB_ALIASES', cnf) 140 eglibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
100 eglibc_cfg('libc-envz', distro_features, 'OPTION_EGLIBC_ENVZ', cnf) 141 eglibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
101 eglibc_cfg('libc-fcvt', distro_features, 'OPTION_EGLIBC_FCVT', cnf) 142 eglibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
102 eglibc_cfg('libc-fmtmsg', distro_features, 'OPTION_EGLIBC_FMTMSG', cnf) 143 eglibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
103 eglibc_cfg('libc-fstab', distro_features, 'OPTION_EGLIBC_FSTAB', cnf) 144 eglibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
104 eglibc_cfg('libc-ftraverse', distro_features, 'OPTION_EGLIBC_FTRAVERSE', cnf) 145 eglibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
105 eglibc_cfg('libc-getlogin', distro_features, 'OPTION_EGLIBC_GETLOGIN', cnf) 146 eglibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
106 eglibc_cfg('libc-idn', distro_features, 'OPTION_EGLIBC_IDN', cnf) 147 eglibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
107 eglibc_cfg('ipv4', distro_features, 'OPTION_EGLIBC_INET', cnf) 148 eglibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
108 eglibc_cfg('libc-inet-anl', distro_features, 'OPTION_EGLIBC_INET_ANL', cnf) 149 eglibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
109 eglibc_cfg('libc-libm', distro_features, 'OPTION_EGLIBC_LIBM', cnf) 150 eglibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
110 eglibc_cfg('libc-locales', distro_features, 'OPTION_EGLIBC_LOCALES', cnf) 151 eglibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
111 eglibc_cfg('libc-locale-code', distro_features, 'OPTION_EGLIBC_LOCALE_CODE', cnf) 152 eglibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
112 eglibc_cfg('libc-memusage', distro_features, 'OPTION_EGLIBC_MEMUSAGE', cnf) 153 eglibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
113 eglibc_cfg('libc-nis', distro_features, 'OPTION_EGLIBC_NIS', cnf) 154 eglibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
114 eglibc_cfg('libc-nsswitch', distro_features, 'OPTION_EGLIBC_NSSWITCH', cnf) 155 eglibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
115 eglibc_cfg('libc-rcmd', distro_features, 'OPTION_EGLIBC_RCMD', cnf) 156 eglibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
116 eglibc_cfg('libc-rtld-debug', distro_features, 'OPTION_EGLIBC_RTLD_DEBUG', cnf) 157 eglibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
117 eglibc_cfg('libc-spawn', distro_features, 'OPTION_EGLIBC_SPAWN', cnf) 158 eglibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
118 eglibc_cfg('libc-streams', distro_features, 'OPTION_EGLIBC_STREAMS', cnf) 159 eglibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
119 eglibc_cfg('libc-sunrpc', distro_features, 'OPTION_EGLIBC_SUNRPC', cnf) 160 eglibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
120 eglibc_cfg('libc-utmp', distro_features, 'OPTION_EGLIBC_UTMP', cnf) 161
121 eglibc_cfg('libc-utmpx', distro_features, 'OPTION_EGLIBC_UTMPX', cnf) 162 return "\n".join(cnf)
122 eglibc_cfg('libc-wordexp', distro_features, 'OPTION_EGLIBC_WORDEXP', cnf)
123 eglibc_cfg('libc-posix-clang-wchar', distro_features, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
124 eglibc_cfg('libc-posix-regexp', distro_features, 'OPTION_POSIX_REGEXP', cnf)
125 eglibc_cfg('libc-posix-regexp-glibc', distro_features, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
126 eglibc_cfg('libc-posix-wchar-io', distro_features, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
127
128 return "\n".join(cnf)