<div dir="ltr">ping?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 6, 2018 at 2:11 PM, Trevor Woerner <span dir="ltr"><<a href="mailto:twoerner@gmail.com" target="_blank">twoerner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Instead of installing an entire recipe's build output (i.e. ${D}), allow the<br>
user to optionally specify the name of one package at a time from said recipe<br>
to be installed (i.e. ${PKGDEST}/<package>).<br>
<br>
NOTE: mixing "deploy-target" commands that have this new --package option and<br>
"deploy-target" commands without --package against the same recipe is not<br>
ideal.<br>
<br>
Signed-off-by: Trevor Woerner <<a href="mailto:twoerner@gmail.com">twoerner@gmail.com</a>><br>
---<br>
updates since v1:<br>
- The behaviour of deploy-target is to start by trying to remove any previous<br>
such deploy-targets with the same deploy-name which have already been<br>
deployed on the target. That meant that, with v1, if someone tried to<br>
deploy two packages from the same recipe, the second deployment would<br>
undeploy the first deployment, then deploy the second. By incorporating the<br>
package name into the on-target deploy-name, multiple such deployments can<br>
exist at the same time from the same recipe.<br>
---<br>
scripts/lib/devtool/deploy.py | 42 ++++++++++++++++++++++++++----<wbr>-----<br>
1 file changed, 31 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/scripts/lib/devtool/deploy.<wbr>py b/scripts/lib/devtool/deploy.<wbr>py<br>
index 52e261d560..0bd2a9f63b 100644<br>
--- a/scripts/lib/devtool/deploy.<wbr>py<br>
+++ b/scripts/lib/devtool/deploy.<wbr>py<br>
@@ -169,11 +169,20 @@ def deploy(args, config, basepath, workspace):<br>
except Exception as e:<br>
raise DevtoolError('Exception parsing recipe %s: %s' %<br>
(args.recipename, e))<br>
- recipe_outdir = rd.getVar('D')<br>
+ if args.package:<br>
+ recipe_outdir = os.path.join(rd.getVar('<wbr>PKGDEST'), args.package)<br>
+ else:<br>
+ recipe_outdir = rd.getVar('D')<br>
if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):<br>
- raise DevtoolError('No files to deploy - have you built the %s '<br>
- 'recipe? If so, the install step has not installed '<br>
- 'any files.' % args.recipename)<br>
+ if args.package:<br>
+ raise DevtoolError('No files to deploy - have you built the %s '<br>
+ 'package of the %s recipe? If so, the install '<br>
+ 'step has not installed any files.'<br>
+ % (args.package, args.recipename))<br>
+ else:<br>
+ raise DevtoolError('No files to deploy - have you built the %s '<br>
+ 'recipe? If so, the install step has not installed '<br>
+ 'any files.' % args.recipename)<br>
<br>
if args.strip and not args.dry_run:<br>
# Fakeroot copy to new destination<br>
@@ -246,7 +255,10 @@ def deploy(args, config, basepath, workspace):<br>
shutil.rmtree(tmpdir)<br>
<br>
# Now run the script<br>
- ret = exec_fakeroot(rd, 'tar cf - . | ssh %s %s %s \'sh %s %s %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True)<br>
+ filename = args.recipename<br>
+ if args.package:<br>
+ filename = filename + '.' + args.package<br>
+ ret = exec_fakeroot(rd, 'tar cf - . | ssh %s %s %s \'sh %s %s %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, filename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True)<br>
if ret != 0:<br>
raise DevtoolError('Deploy failed - rerun with -s to get a complete '<br>
'error message')<br>
@@ -300,13 +312,19 @@ def undeploy(args, config, basepath, workspace):<br>
shutil.rmtree(tmpdir)<br>
<br>
# Now run the script<br>
- ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename), shell=True)<br>
+ filename = args.recipename<br>
+ if args.package:<br>
+ filename = filename + '.' + args.package<br>
+ ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, filename), shell=True)<br>
if ret != 0:<br>
raise DevtoolError('Undeploy failed - rerun with -s to get a complete '<br>
'error message')<br>
<br>
if not args.all and not args.dry_run:<br>
- <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>('Successfully undeployed %s' % args.recipename)<br>
+ if args.package:<br>
+ <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>('Successfully undeployed %s' % args.package)<br>
+ else:<br>
+ <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>('Successfully undeployed %s' % args.recipename)<br>
return 0<br>
<br>
<br>
@@ -314,8 +332,8 @@ def register_commands(subparsers, context):<br>
"""Register devtool subcommands from the deploy plugin"""<br>
<br>
parser_deploy = subparsers.add_parser('deploy-<wbr>target',<br>
- help='Deploy recipe output files to live target machine',<br>
- description='Deploys a recipe\'s build output (i.e. the output of the do_install task) to a live target machine over ssh. By default, any existing files will be preserved instead of being overwritten and will be restored if you run devtool undeploy-target. Note: this only deploys the recipe itself and not any runtime dependencies, so it is assumed that those have been installed on the target beforehand.',<br>
+ help='Deploy build output to a live target machine',<br>
+ description='Deploys either the full recipe\'s build output (i.e. the output of the do_install task) or a package of a recipe to a live target machine over ssh. By default, any existing files will be preserved instead of being overwritten and will be restored if you run devtool undeploy-target. Note: this only deploys the specified item itself and not any runtime dependencies, so it is assumed that those have been installed on the target beforehand.',<br>
group='testbuild')<br>
parser_deploy.add_argument('<wbr>recipename', help='Recipe to deploy')<br>
parser_deploy.add_argument('<wbr>target', help='Live target machine running an ssh server: user@hostname[:destdir]')<br>
@@ -325,6 +343,7 @@ def register_commands(subparsers, context):<br>
parser_deploy.add_argument('-<wbr>p', '--no-preserve', help='Do not preserve existing files', action='store_true')<br>
parser_deploy.add_argument('--<wbr>no-check-space', help='Do not check for available space before deploying', action='store_true')<br>
parser_deploy.add_argument('-<wbr>P', '--port', help='Specify port to use for connection to the target')<br>
+ parser_deploy.add_argument('--<wbr>package', help='Specify a recipe\'s package to deploy', dest='package')<br>
<br>
strip_opts = parser_deploy.add_mutually_<wbr>exclusive_group(required=<wbr>False)<br>
strip_opts.add_argument('-S', '--strip',<br>
@@ -337,8 +356,8 @@ def register_commands(subparsers, context):<br>
parser_deploy.set_defaults(<wbr>func=deploy)<br>
<br>
parser_undeploy = subparsers.add_parser('<wbr>undeploy-target',<br>
- help='Undeploy recipe output files in live target machine',<br>
- description='Un-deploys recipe output files previously deployed to a live target machine by devtool deploy-target.',<br>
+ help='Undeploy output files from a live target machine',<br>
+ description='Un-deploys output files previously deployed to a live target machine by devtool deploy-target.',<br>
group='testbuild')<br>
parser_undeploy.add_argument('<wbr>recipename', help='Recipe to undeploy (if not using -a/--all)', nargs='?')<br>
parser_undeploy.add_argument('<wbr>target', help='Live target machine running an ssh server: user@hostname')<br>
@@ -347,4 +366,5 @@ def register_commands(subparsers, context):<br>
parser_undeploy.add_argument('<wbr>-a', '--all', help='Undeploy all recipes deployed on the target', action='store_true')<br>
parser_undeploy.add_argument('<wbr>-n', '--dry-run', help='List files to be undeployed only', action='store_true')<br>
parser_undeploy.add_argument('<wbr>-P', '--port', help='Specify port to use for connection to the target')<br>
+ parser_undeploy.add_argument('<wbr>--package', help='Specify a recipe\'s package to undeploy', dest='package')<br>
parser_undeploy.set_defaults(<wbr>func=undeploy)<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.0.582.gccdcbd54c<br>
<br>
</font></span></blockquote></div><br></div>