From 2a695b15aab8efd9ad6eb6ad5f5778248d810169 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 17 Oct 2025 01:41:23 +0000 Subject: devtool: un-/deploy-target: put deploylist into destdir When deploying on devices with a RO root-filesystem, devtool would fail on writing to the hard-coded "deploylist_path = '/.devtool'" Since devtool already supports deploying to a different root-prefix with: hostname[:destdir], we can make use of this guaranteed RW location to place the deployment-list there. Add the destdir parameter to the _prepare_remote_script function, to construct the deploylist_path from it. For the 'undeploy' the same host:destdir splitting logic is used as in 'deploy'. Now it is possible to modify and build a recipe 'foo-bar' with devtool, and have its ./image content deployed through: $build> devtool deploy foo-bar target:/opt/development-overlay Or removed again with: $build> devtool undeploy foo-bar target:/opt/development-overlay (From OE-Core rev: 216a4c4a4ee58222127c830ac56126bdbb95308d) Signed-off-by: Johannes Schneider Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- scripts/lib/devtool/deploy.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'scripts/lib/devtool/deploy.py') diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py index b5ca8f2c2f..a98b33c571 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py @@ -20,9 +20,9 @@ from devtool import exec_fakeroot_no_d, setup_tinfoil, check_workspace_recipe, D logger = logging.getLogger('devtool') -deploylist_path = '/.devtool' +deploylist_dirname = '.devtool' -def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=False, nopreserve=False, nocheckspace=False): +def _prepare_remote_script(deploy, destdir='/', verbose=False, dryrun=False, undeployall=False, nopreserve=False, nocheckspace=False): """ Prepare a shell script for running on the target to deploy/undeploy files. We have to be careful what we put in this @@ -31,6 +31,7 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals busybox rather than bash with coreutils). """ lines = [] + deploylist_path = os.path.join(destdir, deploylist_dirname) lines.append('#!/bin/sh') lines.append('set -e') if undeployall: @@ -146,7 +147,7 @@ def deploy(args, config, basepath, workspace): except Exception as e: raise DevtoolError('Exception parsing recipe %s: %s' % (args.recipename, e)) - + srcdir = rd.getVar('D') workdir = rd.getVar('WORKDIR') path = rd.getVar('PATH') @@ -244,6 +245,7 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce tmpscript = '/tmp/devtool_deploy.sh' tmpfilelist = os.path.join(os.path.dirname(tmpscript), 'devtool_deploy.list') shellscript = _prepare_remote_script(deploy=True, + destdir=destdir, verbose=args.show_status, nopreserve=args.no_preserve, nocheckspace=args.no_check_space) @@ -303,12 +305,19 @@ def undeploy(args, config, basepath, workspace): scp_port = "-P %s" % args.port ssh_port = "-p %s" % args.port - args.target = args.target.split(':')[0] + try: + host, destdir = args.target.split(':') + except ValueError: + destdir = '/' + else: + args.target = host + if not destdir.endswith('/'): + destdir += '/' tmpdir = tempfile.mkdtemp(prefix='devtool') try: tmpscript = '/tmp/devtool_undeploy.sh' - shellscript = _prepare_remote_script(deploy=False, dryrun=args.dry_run, undeployall=args.all) + shellscript = _prepare_remote_script(deploy=False, destdir=destdir, dryrun=args.dry_run, undeployall=args.all) # Write out the script to a file with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: f.write(shellscript) -- cgit v1.2.3-54-g00ecf