diff options
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) |
