mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
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>
This commit is contained in:
parent
1666d6495d
commit
2a695b15aa
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user