summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/deploy.py
AgeCommit message (Collapse)Author
2020-09-02devtool: deploy-target: Fix size calculation for hard linksMichael Tretter
If a package contains hard links to a file, the file size is added for each hard link instead of once for the file. Therefore, the calculated size may be much larger than the actual package size. For example, the mesa-megadriver package contains several hard links to the same library. Keep track of the inode numbers when listing the files that are installed and use the actual size only for the first occurrence of an inode. All further hard links to the same inode are added to the file list, but accounted with size 0. All file names need to be added to the file list, because the list is used for preserving the files/hard links on the target. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-22devtool: fix typoPaul Eggleton
specifiy -> specify Signed-off-by: Paul Eggleton <paul.eggleton@linux.microsoft.com>
2019-10-23devtool: add ssh key option to deploy-target paramEduardo Abinader
Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25devtool: deploy-target: allow use of alternate sshOlaf Mandel
Allow the use of an alternate SSH executable for deploy-target and undeploy-target. The command can be specified with -e / --ssh-exec. Signed-off-by: Olaf Mandel <o.mandel@menlosystems.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-27devtool: fix target-deploy --stripAdrian Freihofer
This is a fixup for: e1ba46109ea4be3d3b310abaf7f2da3c84a83930 devtool deploy-target --strip foo root@192.168.7.2 ended up with: Traceback (most recent call last): File "/home/user/bar_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/ devtool", line 344, in <module> ret = main() File "/home/user/bar_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/ devtool", line 331, in main ret = args.func(args, config, basepath, workspace) File "/home/user/bar_sdk/layers/poky/scripts/lib/devtool/ deploy.py", line 187, in deploy rd.getVar('base_libdir')) TypeError: strip_exbar() missing 1 required positional argument: 'd' Signed-off-by: Adrian Freihofer <adrian.freihofer@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01devtool: deploy-target: don't specify ssh/scp port unless user doesPaul Eggleton
If the user doesn't specify a port then we should avoid specifying one on the ssh/scp command line in case the user has configured one for the host they are connecting to, which was being overridden unnecessarily. Fixes [YOCTO #12381]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-25scripts: drop True option to getVar callsMing Liu
Search made with the following regex: getVar ?\((.*), True\). Signed-off-by: Ming Liu <liu.ming50@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27devtool: deploy-target: Support stripped libs and execsTobias Hagelborn
New devtool deploy-target option --strip which enables deploying stripped binaries, saving some space on target. * Copies the files of ${D} into a new directory and strips them in place * Used oe.package.strip_execs for stripping directory * Added devtool.conf option "strip" for changing default behavior Config example: [Deploy] strip = true [YOCTO #11227] Signed-off-by: Tobias Hagelborn <tobiasha@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-03devtool: deploy-target: Let script continue even if rm failsDaniel Lublin
The remote script is run with `set -e`, so doing rm without -f on a $file that is already gone will exit the whole script, failing any redeployment. Assume a use case where packages sometimes produces certain test binaries stored on volatile media (tmpfs), and where the system is occasionally rebooted. Signed-off-by: Daniel Lublin <daniel@lublin.se> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-06-03devtool: deploy-target: Don't use find -execDaniel Lublin
find may be provided by busybox, which might be compiled without support for -exec. Signed-off-by: Daniel Lublin <daniel@lublin.se> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-03-01scripts/lib/devtool/deploy.py: add --port/-P argument for target connectionTim Orling
Enable using, e.g. host port 2222 for connection to qemu target. Defaults to 22 for standard ssh/scp port. [YOCTO #11079] Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16scripts: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-14devtool / recipetool: use tinfoil parsing APIPaul Eggleton
Use Tinfoil.parse_recipe_file() and Tinfoil.parse_recipe() instead of the recipeutils equivalents, and replace any local duplicate implementations. This not only tidies up the code but also allows these calls to work in memres mode. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
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>