summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r--meta/lib/oe/utils.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 7a79d752b6..ec91927233 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -156,6 +156,49 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""):
156 """ 156 """
157 return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) 157 return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d)
158 158
159def parallel_make(d):
160 """
161 Return the integer value for the number of parallel threads to use when
162 building, scraped out of PARALLEL_MAKE. If no parallelization option is
163 found, returns None
164
165 e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer.
166 """
167 pm = (d.getVar('PARALLEL_MAKE') or '').split()
168 # look for '-j' and throw other options (e.g. '-l') away
169 while pm:
170 opt = pm.pop(0)
171 if opt == '-j':
172 v = pm.pop(0)
173 elif opt.startswith('-j'):
174 v = opt[2:].strip()
175 else:
176 continue
177
178 return int(v)
179
180 return None
181
182def parallel_make_argument(d, fmt, limit=None):
183 """
184 Helper utility to construct a parallel make argument from the number of
185 parallel threads specified in PARALLEL_MAKE.
186
187 Returns the input format string `fmt` where a single '%d' will be expanded
188 with the number of parallel threads to use. If `limit` is specified, the
189 number of parallel threads will be no larger than it. If no parallelization
190 option is found in PARALLEL_MAKE, returns an empty string
191
192 e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return
193 "-n 10"
194 """
195 v = parallel_make(d)
196 if v:
197 if limit:
198 v = max(limit, v)
199 return fmt % v
200 return ''
201
159def packages_filter_out_system(d): 202def packages_filter_out_system(d):
160 """ 203 """
161 Return a list of packages from PACKAGES with the "system" packages such as 204 Return a list of packages from PACKAGES with the "system" packages such as