| 241 | |
| 242 | |
| 243 | def get_recipe_order_and_bootstrap(ctx, names, bs=None, blacklist=None): |
| 244 | # Get set of recipe/dependency names, clean up and add bootstrap deps: |
| 245 | names = set(names) |
| 246 | if bs is not None and bs.recipe_depends: |
| 247 | names = names.union(set(bs.recipe_depends)) |
| 248 | names = fix_deplist([ |
| 249 | ([name] if not isinstance(name, (list, tuple)) else name) |
| 250 | for name in names |
| 251 | ]) |
| 252 | if blacklist is None: |
| 253 | blacklist = set() |
| 254 | blacklist = {bitem.lower() for bitem in blacklist} |
| 255 | |
| 256 | # Remove all values that are in the blacklist: |
| 257 | names_before_blacklist = list(names) |
| 258 | names = [] |
| 259 | for name in names_before_blacklist: |
| 260 | cleaned_up_tuple = tuple([ |
| 261 | item for item in name if item not in blacklist |
| 262 | ]) |
| 263 | if cleaned_up_tuple: |
| 264 | names.append(cleaned_up_tuple) |
| 265 | |
| 266 | # Do check for obvious conflicts (that would trigger in any order, and |
| 267 | # without committing to any specific choice in a multi-choice tuple of |
| 268 | # dependencies): |
| 269 | obvious_conflict_checker(ctx, names, blacklist=blacklist) |
| 270 | # If we get here, no obvious conflicts! |
| 271 | |
| 272 | # get all possible order graphs, as names may include tuples/lists |
| 273 | # of alternative dependencies |
| 274 | possible_orders = [] |
| 275 | for name_set in product(*names): |
| 276 | new_possible_orders = [RecipeOrder(ctx)] |
| 277 | for name in name_set: |
| 278 | new_possible_orders = recursively_collect_orders( |
| 279 | name, ctx, name_set, orders=new_possible_orders, |
| 280 | blacklist=blacklist |
| 281 | ) |
| 282 | possible_orders.extend(new_possible_orders) |
| 283 | |
| 284 | # turn each order graph into a linear list if possible |
| 285 | orders = [] |
| 286 | for possible_order in possible_orders: |
| 287 | try: |
| 288 | order = find_order(possible_order) |
| 289 | except ValueError: # a circular dependency was found |
| 290 | info('Circular dependency found in graph {}, skipping it.'.format( |
| 291 | possible_order)) |
| 292 | continue |
| 293 | orders.append(list(order)) |
| 294 | |
| 295 | # prefer python3 and SDL2 if available |
| 296 | orders = sorted(orders, |
| 297 | key=lambda order: -('python3' in order) - ('sdl2' in order)) |
| 298 | |
| 299 | if not orders: |
| 300 | raise BuildInterruptingException( |