summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rwxr-xr-xscripts/lib/devtool/ide_sdk.py43
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
13import shutil 13import shutil
14import stat 14import stat
15import subprocess 15import subprocess
16import sys
16from argparse import RawTextHelpFormatter 17from argparse import RawTextHelpFormatter
17from enum import Enum 18from enum import Enum
18 19
@@ -20,7 +21,7 @@ import scriptutils
20import bb 21import bb
21from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError, parse_recipe 22from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError, parse_recipe
22from devtool.standard import get_real_srctree 23from devtool.standard import get_real_srctree
23from devtool.ide_plugins import BuildTool, get_devtool_deploy_opts 24from devtool.ide_plugins import BuildTool
24 25
25 26
26logger = logging.getLogger('devtool') 27logger = 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):