diff options
-rw-r--r-- | scripts/lib/recipetool/create.py | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index f5d541eb6c..5c5ac7ae40 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -423,6 +423,36 @@ def create_recipe(args): | |||
423 | storeTagName = '' | 423 | storeTagName = '' |
424 | pv_srcpv = False | 424 | pv_srcpv = False |
425 | 425 | ||
426 | handled = [] | ||
427 | classes = [] | ||
428 | |||
429 | # Find all plugins that want to register handlers | ||
430 | logger.debug('Loading recipe handlers') | ||
431 | raw_handlers = [] | ||
432 | for plugin in plugins: | ||
433 | if hasattr(plugin, 'register_recipe_handlers'): | ||
434 | plugin.register_recipe_handlers(raw_handlers) | ||
435 | # Sort handlers by priority | ||
436 | handlers = [] | ||
437 | for i, handler in enumerate(raw_handlers): | ||
438 | if isinstance(handler, tuple): | ||
439 | handlers.append((handler[0], handler[1], i)) | ||
440 | else: | ||
441 | handlers.append((handler, 0, i)) | ||
442 | handlers.sort(key=lambda item: (item[1], -item[2]), reverse=True) | ||
443 | for handler, priority, _ in handlers: | ||
444 | logger.debug('Handler: %s (priority %d)' % (handler.__class__.__name__, priority)) | ||
445 | setattr(handler, '_devtool', args.devtool) | ||
446 | handlers = [item[0] for item in handlers] | ||
447 | |||
448 | fetchuri = None | ||
449 | for handler in handlers: | ||
450 | if hasattr(handler, 'process_url'): | ||
451 | ret = handler.process_url(args, classes, handled, extravalues) | ||
452 | if 'url' in handled and ret: | ||
453 | fetchuri = ret | ||
454 | break | ||
455 | |||
426 | if os.path.isfile(source): | 456 | if os.path.isfile(source): |
427 | source = 'file://%s' % os.path.abspath(source) | 457 | source = 'file://%s' % os.path.abspath(source) |
428 | 458 | ||
@@ -431,7 +461,8 @@ def create_recipe(args): | |||
431 | if re.match(r'https?://github.com/[^/]+/[^/]+/archive/.+(\.tar\..*|\.zip)$', source): | 461 | if re.match(r'https?://github.com/[^/]+/[^/]+/archive/.+(\.tar\..*|\.zip)$', source): |
432 | logger.warning('github archive files are not guaranteed to be stable and may be re-generated over time. If the latter occurs, the checksums will likely change and the recipe will fail at do_fetch. It is recommended that you point to an actual commit or tag in the repository instead (using the repository URL in conjunction with the -S/--srcrev option).') | 462 | logger.warning('github archive files are not guaranteed to be stable and may be re-generated over time. If the latter occurs, the checksums will likely change and the recipe will fail at do_fetch. It is recommended that you point to an actual commit or tag in the repository instead (using the repository URL in conjunction with the -S/--srcrev option).') |
433 | # Fetch a URL | 463 | # Fetch a URL |
434 | fetchuri = reformat_git_uri(urldefrag(source)[0]) | 464 | if not fetchuri: |
465 | fetchuri = reformat_git_uri(urldefrag(source)[0]) | ||
435 | if args.binary: | 466 | if args.binary: |
436 | # Assume the archive contains the directory structure verbatim | 467 | # Assume the archive contains the directory structure verbatim |
437 | # so we need to extract to a subdirectory | 468 | # so we need to extract to a subdirectory |
@@ -638,8 +669,6 @@ def create_recipe(args): | |||
638 | # We'll come back and replace this later in handle_license_vars() | 669 | # We'll come back and replace this later in handle_license_vars() |
639 | lines_before.append('##LICENSE_PLACEHOLDER##') | 670 | lines_before.append('##LICENSE_PLACEHOLDER##') |
640 | 671 | ||
641 | handled = [] | ||
642 | classes = [] | ||
643 | 672 | ||
644 | # FIXME This is kind of a hack, we probably ought to be using bitbake to do this | 673 | # FIXME This is kind of a hack, we probably ought to be using bitbake to do this |
645 | pn = None | 674 | pn = None |
@@ -718,25 +747,6 @@ def create_recipe(args): | |||
718 | if args.npm_dev: | 747 | if args.npm_dev: |
719 | extravalues['NPM_INSTALL_DEV'] = 1 | 748 | extravalues['NPM_INSTALL_DEV'] = 1 |
720 | 749 | ||
721 | # Find all plugins that want to register handlers | ||
722 | logger.debug('Loading recipe handlers') | ||
723 | raw_handlers = [] | ||
724 | for plugin in plugins: | ||
725 | if hasattr(plugin, 'register_recipe_handlers'): | ||
726 | plugin.register_recipe_handlers(raw_handlers) | ||
727 | # Sort handlers by priority | ||
728 | handlers = [] | ||
729 | for i, handler in enumerate(raw_handlers): | ||
730 | if isinstance(handler, tuple): | ||
731 | handlers.append((handler[0], handler[1], i)) | ||
732 | else: | ||
733 | handlers.append((handler, 0, i)) | ||
734 | handlers.sort(key=lambda item: (item[1], -item[2]), reverse=True) | ||
735 | for handler, priority, _ in handlers: | ||
736 | logger.debug('Handler: %s (priority %d)' % (handler.__class__.__name__, priority)) | ||
737 | setattr(handler, '_devtool', args.devtool) | ||
738 | handlers = [item[0] for item in handlers] | ||
739 | |||
740 | # Apply the handlers | 750 | # Apply the handlers |
741 | if args.binary: | 751 | if args.binary: |
742 | classes.append('bin_package') | 752 | classes.append('bin_package') |