diff options
| author | Johannes Schneider <johannes.schneider@leica-geosystems.com> | 2025-10-17 01:41:23 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-27 17:20:42 +0000 |
| commit | 2a695b15aab8efd9ad6eb6ad5f5778248d810169 (patch) | |
| tree | 373118cbd6290e00c6c256adcd4ab5401054f031 /scripts/lib/devtool/deploy.py | |
| parent | 1666d6495d588700935c4230831adb71dbd7831c (diff) | |
| download | poky-2a695b15aab8efd9ad6eb6ad5f5778248d810169.tar.gz | |
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 <johannes.schneider@leica-geosystems.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/deploy.py')
| -rw-r--r-- | scripts/lib/devtool/deploy.py | 19 |
1 files changed, 14 insertions, 5 deletions
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 | |||
| 20 | 20 | ||
| 21 | logger = logging.getLogger('devtool') | 21 | logger = logging.getLogger('devtool') |
| 22 | 22 | ||
| 23 | deploylist_path = '/.devtool' | 23 | deploylist_dirname = '.devtool' |
| 24 | 24 | ||
| 25 | def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=False, nopreserve=False, nocheckspace=False): | 25 | def _prepare_remote_script(deploy, destdir='/', verbose=False, dryrun=False, undeployall=False, nopreserve=False, nocheckspace=False): |
| 26 | """ | 26 | """ |
| 27 | Prepare a shell script for running on the target to | 27 | Prepare a shell script for running on the target to |
| 28 | deploy/undeploy files. We have to be careful what we put in this | 28 | 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 | |||
| 31 | busybox rather than bash with coreutils). | 31 | busybox rather than bash with coreutils). |
| 32 | """ | 32 | """ |
| 33 | lines = [] | 33 | lines = [] |
| 34 | deploylist_path = os.path.join(destdir, deploylist_dirname) | ||
| 34 | lines.append('#!/bin/sh') | 35 | lines.append('#!/bin/sh') |
| 35 | lines.append('set -e') | 36 | lines.append('set -e') |
| 36 | if undeployall: | 37 | if undeployall: |
| @@ -146,7 +147,7 @@ def deploy(args, config, basepath, workspace): | |||
| 146 | except Exception as e: | 147 | except Exception as e: |
| 147 | raise DevtoolError('Exception parsing recipe %s: %s' % | 148 | raise DevtoolError('Exception parsing recipe %s: %s' % |
| 148 | (args.recipename, e)) | 149 | (args.recipename, e)) |
| 149 | 150 | ||
| 150 | srcdir = rd.getVar('D') | 151 | srcdir = rd.getVar('D') |
| 151 | workdir = rd.getVar('WORKDIR') | 152 | workdir = rd.getVar('WORKDIR') |
| 152 | path = rd.getVar('PATH') | 153 | path = rd.getVar('PATH') |
| @@ -244,6 +245,7 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce | |||
| 244 | tmpscript = '/tmp/devtool_deploy.sh' | 245 | tmpscript = '/tmp/devtool_deploy.sh' |
| 245 | tmpfilelist = os.path.join(os.path.dirname(tmpscript), 'devtool_deploy.list') | 246 | tmpfilelist = os.path.join(os.path.dirname(tmpscript), 'devtool_deploy.list') |
| 246 | shellscript = _prepare_remote_script(deploy=True, | 247 | shellscript = _prepare_remote_script(deploy=True, |
| 248 | destdir=destdir, | ||
| 247 | verbose=args.show_status, | 249 | verbose=args.show_status, |
| 248 | nopreserve=args.no_preserve, | 250 | nopreserve=args.no_preserve, |
| 249 | nocheckspace=args.no_check_space) | 251 | nocheckspace=args.no_check_space) |
| @@ -303,12 +305,19 @@ def undeploy(args, config, basepath, workspace): | |||
| 303 | scp_port = "-P %s" % args.port | 305 | scp_port = "-P %s" % args.port |
| 304 | ssh_port = "-p %s" % args.port | 306 | ssh_port = "-p %s" % args.port |
| 305 | 307 | ||
| 306 | args.target = args.target.split(':')[0] | 308 | try: |
| 309 | host, destdir = args.target.split(':') | ||
| 310 | except ValueError: | ||
| 311 | destdir = '/' | ||
| 312 | else: | ||
| 313 | args.target = host | ||
| 314 | if not destdir.endswith('/'): | ||
| 315 | destdir += '/' | ||
| 307 | 316 | ||
| 308 | tmpdir = tempfile.mkdtemp(prefix='devtool') | 317 | tmpdir = tempfile.mkdtemp(prefix='devtool') |
| 309 | try: | 318 | try: |
| 310 | tmpscript = '/tmp/devtool_undeploy.sh' | 319 | tmpscript = '/tmp/devtool_undeploy.sh' |
| 311 | shellscript = _prepare_remote_script(deploy=False, dryrun=args.dry_run, undeployall=args.all) | 320 | shellscript = _prepare_remote_script(deploy=False, destdir=destdir, dryrun=args.dry_run, undeployall=args.all) |
| 312 | # Write out the script to a file | 321 | # Write out the script to a file |
| 313 | with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: | 322 | with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: |
| 314 | f.write(shellscript) | 323 | f.write(shellscript) |
