aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/deploy.py
AgeCommit message (Collapse)Author
2016-10-05devtool: deploy-target: Avoid unnecessary dependency on awk on the targetPeter Kjellerstedt
Relying on that awk is installed on the target just to extract the fourth column (i.e., the free volume size) from `df -P` is an unnecessary dependency for devtool deploy-target. As it is already using sed to mangle the output from `df -P`, this can easily be modified to only extract the free volume size. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03scripts: ensure tinfoil is shut down correctlyPaul Eggleton
We should always shut down tinfoil when we're finished with it, either by explicitly calling the shutdown() method or by using it as a context manager ("with ..."). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool: deploy-target: preserve existing filesPaul Eggleton
If files would be overwritten by the deployment, preserve them in a separate location on the target so that they can be restored if you later run devtool undeploy-target. At the same time, also check for sufficient space before starting the operation so that we avoid potentially failing part way through. Fixes [YOCTO #8978]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool: undeploy-target: support undeploying all recipesPaul Eggleton
If you want to put the target device back to exactly how it was before devtool deploy-target started poking things into it, then it would make things easier if you didn't have to figure out which recipes were deployed. Now that we have the list stored on the target we can determine this reliably, so add a -a/--all option to undeploy-target to undeploy everything that has been deployed. One of the side-effects of this is that the dry-run functionality for undeploy-target had to be reimplemented to actually run the script on the target, since we have no way of knowing what's been deployed from the host side. We don't need to do the same for deploy-target though since we know exactly which files will be deployed without referring to the target. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool: deploy-target: write deployed files list to targetPaul Eggleton
When running devtool deploy-target, we save a list of deployed files, and this list is used by devtool undeploy-target (or the next time deploy-target is run if the list is present, in case any files have been renamed or deleted since the first time). We were writing this file to the host, but it makes more sense to write the list to the target instead, so that if we for example swap in a different board, or switch hosts, things will work as expected. In order to do this properly we have to construct a shell script and ship it over to the target so we can run it. The manifest is written out to a hidden directory in the root (/.devtool). Fixes [YOCTO #7908]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool: (un)deploy-target: add help descriptionsPaul Eggleton
Add a long description used when running --help on the specific command. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool: categorise and order subcommands in help outputPaul Eggleton
The listing of subcommands in the --help output for devtool was starting to get difficult to follow, with commands appearing in no particular order (due to some being in separate modules and the order of those modules being parsed). Logically grouping the subcommands as well as being able to exercise some control over the order of the subcommands and groups would help, if we do so without losing the dynamic nature of the list (i.e. that it comes from the plugins). Argparse provides no built-in way to handle this and really, really makes it a pain to add, but with some subclassing and hacking it's now possible, and can be extended by any plugin as desired. To put a subcommand into a group, all you need to do is specify a group= parameter in the call to subparsers.add_parser(). you can also specify an order= parameter to make the subcommand sort higher or lower in the list (higher order numbers appear first, so use negative numbers to force items to the end if that's what you want). To add a new group, use subparsers.add_subparser_group(), supplying the name, description and optionally an order number for the group itself (again, higher numbers appear first). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23devtool: second fix for running from a different directoryMarkus Lehtonen
Do not change change current working directory permanently, but, only for the duration of tinfoil initialization instead. The previous fix caused very unintuitive behavior where using relative paths were solved with respect to the builddir instead of the current working directory. E.g. calling "devtool extract zlib ./zlib" would always create create srctree in ${TOPDIR}/zlib, independent of the users cwd. (From OE-Core rev: 4c7f159b0e17a0475a4a4e9dc4dd012e3d2e6a1f) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-22devtool: check that source tree still existsPaul Eggleton
Sometimes, particularly if you extracted the source to /tmp which is on tmpfs, the external source tree that is being pointed to may no longer exist when you come to run "devtool build" or "devtool update-recipe" etc. Make all of the commands that need to check for a recipe being in the workspace call a single function and have that function additionally check the source tree still exists where appropriate. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-12devtool: make plugin_init optionalEd Bartosh
So far all devtool and recipetool plugins were expected to have plugin_init function. This function is empty in most of plugins as they don't require initialisation. Making plugin_init optional would allow not having empty plugin_init in every plugin. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-18devtool: deploy: fix preservation of symlinks and permissions/ownershipPaul Eggleton
It turns out that scp can't be used to copy symlinks because it follows them instead of copying them, and this is by design (since it emulates rcp which also behaved this way); the unfortunate result is that symlinks that point to valid files on the host translate into the host file being copied to the target (yuck). The simplest alternative that does not have this undesirable behaviour is to use tar and pipe it over ssh. At the same time, it would be even better if we properly reflect file permissions and ownership on the target that have been established within the pseudo environment. We can do this by executing the copy process under pseudo, which turns out to be quite easy with access to the pseudo environment set up by the build system. Fixes [YOCTO #7868]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-06-18devtool: use DevtoolError for error handlingMarkus Lehtonen
Use DevtoolError exception more widely for handling error cases. This exception is now caught in the main script and raising it can be used to exit with an error. This hopefully simplifies error handling. The change also makes exit codes more consistent, always returning '1' when an error occurs. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-15devtool: deploy-target: use tinfoil instead of bitbake -ePaul Eggleton
Using tinfoil here is quicker and tidier than shelling out to bitbake -e and interpreting its output. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-05-15devtool: deploy plugin: fix bad indentationMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-15devtool: add missing docstringsMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-15devtool: rename unused variablesMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-15devtool: remove unused imports / re-importsMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-03-20devtool: deploy-target: add dry-run optionPaul Eggleton
Add a dry-run option to the deploy-target and undeploy-target subcommands so you can see the list of files to be deployed or un-deployed before actually carrying out the operation. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: deploy-target: add an option to disable quiet modePaul Eggleton
The -q option to scp does stop the progress being shown, which is mostly superfluous, however it also stops errors from ssh being shown - if there's a problem, you'll just get "lost connection" which really isn't that helpful. As a compromise, add a -s/--show-status option and advertise this when the command fails. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: deploy-target: detect and error if D is emptyPaul Eggleton
If you haven't built the recipe yet or if the output directory (${D}) is empty, then we should tell the user rather than have scp error out. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: deploy-target: allow disabling host key checkingPaul Eggleton
If you're testing with multiple images/devices that have the same IP address / hostname then it can be annoying to deal with host key mismatches all of the time. As a MITM attack is unlikely in the local test environment, provide a command line option to pass the appropriate options to scp/ssh to disable the host key checking. Note: if you wish to apply this permanently, the best way is to do it through your ssh configuration e.g. by adding the following to your ~/.ssh/config: Host 192.168.7.2 UserKnownHostsFile=/dev/null StrictHostKeyChecking no Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: deploy-target: fix deploying to previously deployed machinePaul Eggleton
* Pass correct arguments to undeploy() function * If an error occurs during undeploy(), exit instead of continuing Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2014-12-21scripts/devtool: Support deploy/undeploy functionJunchun Guan
Deploy recipe output files to live target machine using scp Store the files list and target machine info in localhost if deployment is done Undeploy recipe output files in target machine using the previous deployment info [YOCTO #6654] Signed-off-by: Junchun Guan <junchunx.guan@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>