ping? On Wed, Jun 6, 2018 at 2:11 PM, Trevor Woerner <twoer...@gmail.com> wrote:
> Instead of installing an entire recipe's build output (i.e. ${D}), allow > the > user to optionally specify the name of one package at a time from said > recipe > to be installed (i.e. ${PKGDEST}/<package>). > > NOTE: mixing "deploy-target" commands that have this new --package option > and > "deploy-target" commands without --package against the same recipe is not > ideal. > > Signed-off-by: Trevor Woerner <twoer...@gmail.com> > --- > updates since v1: > - The behaviour of deploy-target is to start by trying to remove any > previous > such deploy-targets with the same deploy-name which have already been > deployed on the target. That meant that, with v1, if someone tried to > deploy two packages from the same recipe, the second deployment would > undeploy the first deployment, then deploy the second. By incorporating > the > package name into the on-target deploy-name, multiple such deployments > can > exist at the same time from the same recipe. > --- > scripts/lib/devtool/deploy.py | 42 ++++++++++++++++++++++++++--------- > 1 file changed, 31 insertions(+), 11 deletions(-) > > diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py > index 52e261d560..0bd2a9f63b 100644 > --- a/scripts/lib/devtool/deploy.py > +++ b/scripts/lib/devtool/deploy.py > @@ -169,11 +169,20 @@ def deploy(args, config, basepath, workspace): > except Exception as e: > raise DevtoolError('Exception parsing recipe %s: %s' % > (args.recipename, e)) > - recipe_outdir = rd.getVar('D') > + if args.package: > + recipe_outdir = os.path.join(rd.getVar('PKGDEST'), > args.package) > + else: > + recipe_outdir = rd.getVar('D') > if not os.path.exists(recipe_outdir) or not > os.listdir(recipe_outdir): > - raise DevtoolError('No files to deploy - have you built the > %s ' > - 'recipe? If so, the install step has not > installed ' > - 'any files.' % args.recipename) > + if args.package: > + raise DevtoolError('No files to deploy - have you built > the %s ' > + 'package of the %s recipe? If so, the > install ' > + 'step has not installed any files.' > + % (args.package, args.recipename)) > + else: > + raise DevtoolError('No files to deploy - have you built > the %s ' > + 'recipe? If so, the install step has not > installed ' > + 'any files.' % args.recipename) > > if args.strip and not args.dry_run: > # Fakeroot copy to new destination > @@ -246,7 +255,10 @@ def deploy(args, config, basepath, workspace): > shutil.rmtree(tmpdir) > > # Now run the script > - 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) > + filename = args.recipename > + if args.package: > + filename = filename + '.' + args.package > + 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) > if ret != 0: > raise DevtoolError('Deploy failed - rerun with -s to get a > complete ' > 'error message') > @@ -300,13 +312,19 @@ def undeploy(args, config, basepath, workspace): > shutil.rmtree(tmpdir) > > # Now run the script > - ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, > extraoptions, args.target, tmpscript, args.recipename), shell=True) > + filename = args.recipename > + if args.package: > + filename = filename + '.' + args.package > + ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, > extraoptions, args.target, tmpscript, filename), shell=True) > if ret != 0: > raise DevtoolError('Undeploy failed - rerun with -s to get a > complete ' > 'error message') > > if not args.all and not args.dry_run: > - logger.info('Successfully undeployed %s' % args.recipename) > + if args.package: > + logger.info('Successfully undeployed %s' % args.package) > + else: > + logger.info('Successfully undeployed %s' % args.recipename) > return 0 > > > @@ -314,8 +332,8 @@ def register_commands(subparsers, context): > """Register devtool subcommands from the deploy plugin""" > > parser_deploy = subparsers.add_parser('deploy-target', > - help='Deploy recipe output > files to live target machine', > - 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.', > + help='Deploy build output to a > live target machine', > + 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.', > group='testbuild') > parser_deploy.add_argument('recipename', help='Recipe to deploy') > parser_deploy.add_argument('target', help='Live target machine > running an ssh server: user@hostname[:destdir]') > @@ -325,6 +343,7 @@ def register_commands(subparsers, context): > parser_deploy.add_argument('-p', '--no-preserve', help='Do not > preserve existing files', action='store_true') > parser_deploy.add_argument('--no-check-space', help='Do not check > for available space before deploying', action='store_true') > parser_deploy.add_argument('-P', '--port', help='Specify port to use > for connection to the target') > + parser_deploy.add_argument('--package', help='Specify a recipe\'s > package to deploy', dest='package') > > strip_opts = parser_deploy.add_mutually_exclusive_group(required= > False) > strip_opts.add_argument('-S', '--strip', > @@ -337,8 +356,8 @@ def register_commands(subparsers, context): > parser_deploy.set_defaults(func=deploy) > > parser_undeploy = subparsers.add_parser('undeploy-target', > - help='Undeploy recipe output > files in live target machine', > - description='Un-deploys > recipe output files previously deployed to a live target machine by devtool > deploy-target.', > + help='Undeploy output files > from a live target machine', > + description='Un-deploys > output files previously deployed to a live target machine by devtool > deploy-target.', > group='testbuild') > parser_undeploy.add_argument('recipename', help='Recipe to undeploy > (if not using -a/--all)', nargs='?') > parser_undeploy.add_argument('target', help='Live target machine > running an ssh server: user@hostname') > @@ -347,4 +366,5 @@ def register_commands(subparsers, context): > parser_undeploy.add_argument('-a', '--all', help='Undeploy all > recipes deployed on the target', action='store_true') > parser_undeploy.add_argument('-n', '--dry-run', help='List files to > be undeployed only', action='store_true') > parser_undeploy.add_argument('-P', '--port', help='Specify port to > use for connection to the target') > + parser_undeploy.add_argument('--package', help='Specify a recipe\'s > package to undeploy', dest='package') > parser_undeploy.set_defaults(func=undeploy) > -- > 2.17.0.582.gccdcbd54c > >
-- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core