<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">&lt;<a href="mailto:twoerner@gmail.com" target="_blank">twoerner@gmail.com</a>&gt;</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&#39;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}/&lt;package&gt;).<br>
<br>
NOTE: mixing &quot;deploy-target&quot; commands that have this new --package option and<br>
&quot;deploy-target&quot; commands without --package against the same recipe is not<br>
ideal.<br>
<br>
Signed-off-by: Trevor Woerner &lt;<a href="mailto:twoerner@gmail.com">twoerner@gmail.com</a>&gt;<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(&#39;Exception parsing recipe %s: %s&#39; %<br>
                             (args.recipename, e))<br>
-        recipe_outdir = rd.getVar(&#39;D&#39;)<br>
+        if args.package:<br>
+            recipe_outdir = os.path.join(rd.getVar(&#39;<wbr>PKGDEST&#39;), args.package)<br>
+        else:<br>
+            recipe_outdir = rd.getVar(&#39;D&#39;)<br>
         if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):<br>
-            raise DevtoolError(&#39;No files to deploy - have you built the %s &#39;<br>
-                            &#39;recipe? If so, the install step has not installed &#39;<br>
-                            &#39;any files.&#39; % args.recipename)<br>
+            if args.package:<br>
+                raise DevtoolError(&#39;No files to deploy - have you built the %s &#39;<br>
+                                &#39;package of the %s recipe? If so, the install &#39;<br>
+                                &#39;step has not installed any files.&#39;<br>
+                                % (args.package, args.recipename))<br>
+            else:<br>
+                raise DevtoolError(&#39;No files to deploy - have you built the %s &#39;<br>
+                                &#39;recipe? If so, the install step has not installed &#39;<br>
+                                &#39;any files.&#39; % 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, &#39;tar cf - . | ssh  %s %s %s \&#39;sh %s %s %s %s\&#39;&#39; % (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 + &#39;.&#39; + args.package<br>
+        ret = exec_fakeroot(rd, &#39;tar cf - . | ssh  %s %s %s \&#39;sh %s %s %s %s\&#39;&#39; % (ssh_port, extraoptions, args.target, tmpscript, filename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True)<br>
         if ret != 0:<br>
             raise DevtoolError(&#39;Deploy failed - rerun with -s to get a complete &#39;<br>
                             &#39;error message&#39;)<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(&#39;ssh %s %s %s \&#39;sh %s %s\&#39;&#39; % (ssh_port, extraoptions, args.target, tmpscript, args.recipename), shell=True)<br>
+    filename = args.recipename<br>
+    if args.package:<br>
+        filename = filename + &#39;.&#39; + args.package<br>
+    ret = subprocess.call(&#39;ssh %s %s %s \&#39;sh %s %s\&#39;&#39; % (ssh_port, extraoptions, args.target, tmpscript, filename), shell=True)<br>
     if ret != 0:<br>
         raise DevtoolError(&#39;Undeploy failed - rerun with -s to get a complete &#39;<br>
                            &#39;error message&#39;)<br>
<br>
     if not args.all and not args.dry_run:<br>
-        <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(&#39;Successfully undeployed %s&#39; % args.recipename)<br>
+        if args.package:<br>
+            <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(&#39;Successfully undeployed %s&#39; % args.package)<br>
+        else:<br>
+            <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(&#39;Successfully undeployed %s&#39; % args.recipename)<br>
     return 0<br>
<br>
<br>
@@ -314,8 +332,8 @@ def register_commands(subparsers, context):<br>
     &quot;&quot;&quot;Register devtool subcommands from the deploy plugin&quot;&quot;&quot;<br>
<br>
     parser_deploy = subparsers.add_parser(&#39;deploy-<wbr>target&#39;,<br>
-                                          help=&#39;Deploy recipe output files to live target machine&#39;,<br>
-                                          description=&#39;Deploys a recipe\&#39;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.&#39;,<br>
+                                          help=&#39;Deploy build output to a live target machine&#39;,<br>
+                                          description=&#39;Deploys either the full recipe\&#39;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.&#39;,<br>
                                           group=&#39;testbuild&#39;)<br>
     parser_deploy.add_argument(&#39;<wbr>recipename&#39;, help=&#39;Recipe to deploy&#39;)<br>
     parser_deploy.add_argument(&#39;<wbr>target&#39;, help=&#39;Live target machine running an ssh server: user@hostname[:destdir]&#39;)<br>
@@ -325,6 +343,7 @@ def register_commands(subparsers, context):<br>
     parser_deploy.add_argument(&#39;-<wbr>p&#39;, &#39;--no-preserve&#39;, help=&#39;Do not preserve existing files&#39;, action=&#39;store_true&#39;)<br>
     parser_deploy.add_argument(&#39;--<wbr>no-check-space&#39;, help=&#39;Do not check for available space before deploying&#39;, action=&#39;store_true&#39;)<br>
     parser_deploy.add_argument(&#39;-<wbr>P&#39;, &#39;--port&#39;, help=&#39;Specify port to use for connection to the target&#39;)<br>
+    parser_deploy.add_argument(&#39;--<wbr>package&#39;, help=&#39;Specify a recipe\&#39;s package to deploy&#39;, dest=&#39;package&#39;)<br>
<br>
     strip_opts = parser_deploy.add_mutually_<wbr>exclusive_group(required=<wbr>False)<br>
     strip_opts.add_argument(&#39;-S&#39;, &#39;--strip&#39;,<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(&#39;<wbr>undeploy-target&#39;,<br>
-                                            help=&#39;Undeploy recipe output files in live target machine&#39;,<br>
-                                            description=&#39;Un-deploys recipe output files previously deployed to a live target machine by devtool deploy-target.&#39;,<br>
+                                            help=&#39;Undeploy output files from a live target machine&#39;,<br>
+                                            description=&#39;Un-deploys output files previously deployed to a live target machine by devtool deploy-target.&#39;,<br>
                                             group=&#39;testbuild&#39;)<br>
     parser_undeploy.add_argument(&#39;<wbr>recipename&#39;, help=&#39;Recipe to undeploy (if not using -a/--all)&#39;, nargs=&#39;?&#39;)<br>
     parser_undeploy.add_argument(&#39;<wbr>target&#39;, help=&#39;Live target machine running an ssh server: user@hostname&#39;)<br>
@@ -347,4 +366,5 @@ def register_commands(subparsers, context):<br>
     parser_undeploy.add_argument(&#39;<wbr>-a&#39;, &#39;--all&#39;, help=&#39;Undeploy all recipes deployed on the target&#39;, action=&#39;store_true&#39;)<br>
     parser_undeploy.add_argument(&#39;<wbr>-n&#39;, &#39;--dry-run&#39;, help=&#39;List files to be undeployed only&#39;, action=&#39;store_true&#39;)<br>
     parser_undeploy.add_argument(&#39;<wbr>-P&#39;, &#39;--port&#39;, help=&#39;Specify port to use for connection to the target&#39;)<br>
+    parser_undeploy.add_argument(&#39;<wbr>--package&#39;, help=&#39;Specify a recipe\&#39;s package to undeploy&#39;, dest=&#39;package&#39;)<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>