diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2024-01-22 14:58:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-18 07:34:42 +0000 |
commit | 539c8801265d116e264342635886cf336ddcd42c (patch) | |
tree | b95dbdbd742e6889d03ad8db08fa1cc671086b81 /scripts/lib | |
parent | 946cac328aa57acabc0456a188118a5dc24dd1fe (diff) | |
download | poky-539c8801265d116e264342635886cf336ddcd42c.tar.gz |
devtool: ide-sdk make deploy-target quicker
(From OE-Core rev: 3b63e7adb5596739b846396304ff815859ce6a74)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rwxr-xr-x | scripts/lib/devtool/ide_sdk.py | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py index 27389026be..3986dc1436 100755 --- a/scripts/lib/devtool/ide_sdk.py +++ b/scripts/lib/devtool/ide_sdk.py | |||
@@ -13,6 +13,7 @@ import re | |||
13 | import shutil | 13 | import shutil |
14 | import stat | 14 | import stat |
15 | import subprocess | 15 | import subprocess |
16 | import sys | ||
16 | from argparse import RawTextHelpFormatter | 17 | from argparse import RawTextHelpFormatter |
17 | from enum import Enum | 18 | from enum import Enum |
18 | 19 | ||
@@ -20,7 +21,7 @@ import scriptutils | |||
20 | import bb | 21 | import bb |
21 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError, parse_recipe | 22 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError, parse_recipe |
22 | from devtool.standard import get_real_srctree | 23 | from devtool.standard import get_real_srctree |
23 | from devtool.ide_plugins import BuildTool, get_devtool_deploy_opts | 24 | from devtool.ide_plugins import BuildTool |
24 | 25 | ||
25 | 26 | ||
26 | logger = logging.getLogger('devtool') | 27 | logger = logging.getLogger('devtool') |
@@ -742,6 +743,39 @@ class RecipeModified: | |||
742 | 743 | ||
743 | return self.write_script(cmd_lines, 'delete_package_dirs') | 744 | return self.write_script(cmd_lines, 'delete_package_dirs') |
744 | 745 | ||
746 | def gen_deploy_target_script(self, args): | ||
747 | """Generate a script which does what devtool deploy-target does | ||
748 | |||
749 | This script is much quicker than devtool target-deploy. Because it | ||
750 | does not need to start a bitbake server. All information from tinfoil | ||
751 | is hard-coded in the generated script. | ||
752 | """ | ||
753 | cmd_lines = ['#!/usr/bin/env python3'] | ||
754 | cmd_lines.append('import sys') | ||
755 | cmd_lines.append('devtool_sys_path = %s' % str(sys.path)) | ||
756 | cmd_lines.append('devtool_sys_path.reverse()') | ||
757 | cmd_lines.append('for p in devtool_sys_path:') | ||
758 | cmd_lines.append(' if p not in sys.path:') | ||
759 | cmd_lines.append(' sys.path.insert(0, p)') | ||
760 | cmd_lines.append('from devtool.deploy import deploy_no_d') | ||
761 | args_filter = ['debug', 'dry_run', 'key', 'no_check_space', 'no_host_check', | ||
762 | 'no_preserve', 'port', 'show_status', 'ssh_exec', 'strip', 'target'] | ||
763 | filtered_args_dict = {key: value for key, value in vars( | ||
764 | args).items() if key in args_filter} | ||
765 | cmd_lines.append('filtered_args_dict = %s' % str(filtered_args_dict)) | ||
766 | cmd_lines.append('class Dict2Class(object):') | ||
767 | cmd_lines.append(' def __init__(self, my_dict):') | ||
768 | cmd_lines.append(' for key in my_dict:') | ||
769 | cmd_lines.append(' setattr(self, key, my_dict[key])') | ||
770 | cmd_lines.append('filtered_args = Dict2Class(filtered_args_dict)') | ||
771 | cmd_lines.append( | ||
772 | 'setattr(filtered_args, "recipename", "%s")' % self.bpn) | ||
773 | cmd_lines.append('deploy_no_d("%s", "%s", "%s", "%s", "%s", "%s", %d, "%s", "%s", filtered_args)' % | ||
774 | (self.d, self.workdir, self.path, self.strip_cmd, | ||
775 | self.libdir, self.base_libdir, self.max_process, | ||
776 | self.fakerootcmd, self.fakerootenv)) | ||
777 | return self.write_script(cmd_lines, 'deploy_target') | ||
778 | |||
745 | def gen_install_deploy_script(self, args): | 779 | def gen_install_deploy_script(self, args): |
746 | """Generate a script which does install and deploy""" | 780 | """Generate a script which does install and deploy""" |
747 | cmd_lines = ['#!/bin/bash'] | 781 | cmd_lines = ['#!/bin/bash'] |
@@ -759,10 +793,9 @@ class RecipeModified: | |||
759 | cmd_lines.append( | 793 | cmd_lines.append( |
760 | 'bitbake %s -c install --force || { echo "bitbake %s -c install --force failed"; exit 1; }' % (self.bpn, self.bpn)) | 794 | 'bitbake %s -c install --force || { echo "bitbake %s -c install --force failed"; exit 1; }' % (self.bpn, self.bpn)) |
761 | 795 | ||
762 | # devtool deploy-target | 796 | # Self contained devtool deploy-target |
763 | deploy_opts = ' '.join(get_devtool_deploy_opts(args)) | 797 | cmd_lines.append(self.gen_deploy_target_script(args)) |
764 | cmd_lines.append("devtool deploy-target %s %s" % | 798 | |
765 | (self.bpn, deploy_opts)) | ||
766 | return self.write_script(cmd_lines, 'install_and_deploy') | 799 | return self.write_script(cmd_lines, 'install_and_deploy') |
767 | 800 | ||
768 | def write_script(self, cmd_lines, script_name): | 801 | def write_script(self, cmd_lines, script_name): |