aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
AgeCommit message (Collapse)Author
2015-07-27devtool: also load plugins from BBPATHChristopher Larson
This makes it easier to extend, as a layer can add its own sub-commands. Argument parsing is also separated into two steps, the same way it's done in recipetool, as we need access to the global command-line arguments early, before plugins are loaded, both for debugging arguments and for the bitbake path (we need to load the bitbake module to get tinfoil, which is now needed to load the plugins). Rather than constructing tinfoil once and passing it through into sub-commands for their use, we have to construct it for configuration metadata, use it, and then shut it down, as some sub-commands call out to recipetool, which needs its own tinfoil instance, and therefore needs to acquire the bitbake lock. If we're still holding the lock at that point, that's clearly a problem. [YOCTO #7625] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-06-26lib/devtool/standard: Fix patch cleanupRichard Purdie
If patches fail to apply with git, quilt it used as a fallback. If that happens, the code in this class is meant to handle cleanup of these patch files. In the case where ${S} is a subdir of the git tree, the code doesn't correctly set the patches directory. This change correctly sets the patches directory (which is different to the location of the git repository). [YOCTO #7911] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-06-18devtool: remove some unused return valuesMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: split out 'patch' update mode into a separate functionMarkus Lehtonen
Continue refactoring of update_recipe() by splitting out the 'patch' mode into a separate function. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: split out 'srcrev' update mode into a separate functionMarkus Lehtonen
Refactor update_recipe() (i.e. the implementation of the update-recipe command) by splitting out the 'srcrev' into a distinct function. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: slight simplification of path splitting logicMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: simplify few conditionals a bitMarkus Lehtonen
Just refactor the code. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: simplify the logic of determining patches to be removedMarkus Lehtonen
A slight simplification of the code. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: update-recipe: do rev parsing in a separate functionMarkus Lehtonen
Split out the logic of determining "initial rev" and "update rev" into a separate function. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: refactor bb task execution into a separate classMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-06-18devtool: fix wrong indentationMarkus Lehtonen
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-19devtool: update-recipe: add option to write changes to bbappendPaul Eggleton
Quite often what you want to do having made customisations to a piece of software is to apply those customisations in your own layer rather than in the original recipe. Thus, add a -a/--append option to the update-recipe subcommand which allows you to specify the layer to write a bbappend into. The bbappend will be created at the appropriate path within the specified layer directory (which may or may not be in your bblayers.conf) or if one already exists it will be updated appropriately. (This re-uses code written for recipetool appendfile.) Implements [YOCTO #7587]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-19devtool / recipetool: ensure bb.note() gets printedPaul Eggleton
Most of the time when bb.note() gets called we want to see the output, so ensure the level is set appropriately depending on the command line options instead of being fixed at warning. (We don't want to see the notes for fetch/unpack/patch though as they are too verbose). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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: fix build env command execution error handlingPaul Eggleton
If we execute an external command, we ought to prepare for the possibility that it can fail and handle the failure appropriately. We can especially expect this to happen when running bitbake in this scenario. Ensure we return the appropriate exit code to the calling process. Fixes [YOCTO #7757]. 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-05-15devtool: extract: remove patches when S=WORKDIRMarkus Lehtonen
Before this change, all files from the recipe (SRC_URI), including patches, were added to to srctree repository when S==WORKDIR. The patch files are useless as they are automatically applied on top of the srctree by devtool. This change causes devtool extract to not commit these unnecessary (and possibly confusing) patch file(s) into srctree repository. [YOCTO #7602] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2015-05-07devtool: fix for rename of gcc-sourcePaul Eggleton
After OE-Core commit 67db7182faf6742b0d971d61d8c5ba34f69d2e12, PV is appended to the end of the gcc-source PN, thus we need to handle that in devtool and the corresponding test. Part of the fix for [YOCTO #7729]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-01devtool: add: use the appropriate file naming and versioning for SCM recipesPaul Eggleton
* Recipes that fetch from git, svn or hg by OpenEmbedded convention should normally be named with this as a suffix, since PV is meant to be set appropriately within the recipe, so follow this. In order to make this work we need to be able to have the version independent from the file name, so add a -V option to recipetool create to allow this to be specified. * If -V is specified on the devtool add command line, ensure at PV gets set to include this version. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-05-01devtool: add: add an option to fetch remote sourcePaul Eggleton
Add a -f/--fetch option to fetch a remote URI (into the already specified source tree path) and set this as SRC_URI within the recipe. This simply wraps around the existing functionality in recipetool. Implements [YOCTO #7644]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-05-01recipetool: ensure git clone is standalone when extractingPaul Eggleton
If -x is specified and the specified URI was a git repository, we need to ensure that the resulting clone is a sandalone and not one that has pointers into the temporary fetch location or DL_DIR (since the git fetcher does a local clone with -s). Split out the code from devtool that already does this for "devtool modify -x" and reuse that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2015-04-27devtool: update-recipe: check if source tree is a git repositoryPaul Eggleton
If you've done "devtool add" (or "devtool modify" without -x) then it's possible that the external source tree is not a git repository, so we should handle that case here instead of printing a traceback. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: update-recipe: handle unversioned bbappendsPaul Eggleton
Use the proper bbappend file name, don't just assume it will have a version suffix (because it won't if the original recipe doesn't). Fixes [YOCTO #7651]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: reset: avoid errors in case file no longer existsPaul Eggleton
If you manually delete files in the workspace layer (which you really shouldn't) it was possible to get yourself into the situation where you couldn't reset because we were attempting to check if the file had been modified and erroring out if it couldn't be opened. If the file's not there anymore there's not much point checking if it needs to be preserved, just skip it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: add: use correct bbappend file name with -V optionPaul Eggleton
We weren't adding the version into the bbappend file name when -V was specified which meant that building or resetting failed. Also adjust one of the tests so that we're testing devtool add both with and without this option. Fixes [YOCTO #7647]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: include bbappends in recipe parsingMarkus Lehtonen
In order to get correct metadata, SRCREV for example. Fixes [YOCTO #7648]. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: modify: implement --no-same-dirMarkus Lehtonen
This option can be used to have a separate build directory, in order to keep the srctree directory clean for packages that do not need to be built in the source directory. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-27devtool: modify: use B=S if that is the default for the recipeMarkus Lehtonen
Makes the build succeed for packages which do not support separate build directory, e.g. zlib. The same outcome could be achieved with the --same-dir option, but, it's generally hard to tell if a random package would need that option. The negative side effect of this patch is that dev srctree (of some packages that build fine without this modification) gets dirtied by build artefacts. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Acked-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-24devtool: force use of bash when running build within extensible SDKPaul Eggleton
Ubuntu's default dash shell causes oe-init-build-env to behave a bit differently - (a) it can't pick up the OE root directory and (b) it can't see any build directory specified as a command-line argument (since dash doesn't pass through any arguments specified to sourced scripts). We could work around these but doing so requires some internal knowledge of the script; a much simpler fix is just to force running the command under bash since it's expected to be installed on every distro. Thanks to Chen Qi <Qi.Chen@windriver.com> for this fix. Fixes [YOCTO #7614]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-19devtool: call parse_recipe with correct argumentsMarkus Lehtonen
Give the correct data object ("config data" instead of "recipe data") as an argument to oe.recipeutils.patch_recipe() Fixes [YOCTO #7595] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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: modify/extract: prevent usage with incompatible recipesPaul Eggleton
Consolidate code for checking compatible recipes and consider meta and packagegroup recipes as well as package-index and gcc-source to be incompatible. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: modify: get correct initial revision from previously extracted ↵Paul Eggleton
source tree If you point devtool modify to a source tree previously created by devtool modify or devtool extract, then we need to try to pick up the correct initial revision so that devtool update-recipe knows where to start looking for commits that match up with patches in the recipe. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: reset: add ability to reset entire workspacePaul Eggleton
Add a -a/--all option to allow you to quickly reset all recipes in your workspace. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2015-03-20devtool: name command line parsers appropriatelyPaul Eggleton
No functional changes, just use a unique name for each parser. 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>
2015-02-23devtool: fix broken clones of git recipesPaul Eggleton
Because we move the workdir when extracting source, then move the source and delete the temporary workdir, you lose the indirection symlink pointed to by the alternates file (which is created when the fetcher clones it from DL_DIR with -s) and the resulting repository is broken. In any case, for a source repo that the user may put their own changes into, we can't really rely on a clone made with -s in case the original goes away - because of cleanall, DL_DIR disappearing, etc. So repack the repository so that it is a complete, non-shared clone after unpacking. (While I'm at it, add a test for devtool modify with a git recipe which verifies that this works.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23devtool: support source extraction for recipes that use a shared workdirPaul Eggleton
Enable source extraction used by devtool extract / devtool modify -x for recipes that use a shared workdir (e.g. the kernel and gcc). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23devtool: modify: handle recipes that use a shared workdirPaul Eggleton
If S is outside of WORKDIR then we shouldn't try to get the relative path in order to work out where the source subdirectory is as we do by default. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23devtool: prevent extract/modify use with image recipesPaul Eggleton
There wouldn't be any point to using these with an image recipe, so disallow it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23devtool: update-recipe: add handling for git recipesPaul Eggleton
When updating git-based recipes, in a lot of cases what you want is to push the changes to the repository and update SRCREV rather than to apply patches within the recipe. Updating SRCREV is now the default behaviour for recipes that fetch from git, but this can be overridden in both directions using a new -m/--mode option. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-23devtool: build: run do_populate_sysroot instead of do_installPaul Eggleton
If you want to be able to make use of libraries in conjunction with devtool then we need to install them into the sysroot for other recipes to use. Make it a configuration option in case it needs to be changed at runtime. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>