summaryrefslogtreecommitdiffstats
path: root/bin/bitbake-layers
AgeCommit message (Collapse)Author
2017-07-21tinfoil: add a parse_recipes() functionPaul Eggleton
Python style recommends underscore based naming rather than camelCase, and thus the former has been used for most of tinfoil's functions. Add an underscored version of parseRecipes() for consistency and change the one place we call it to use the new version. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-05bitbake-layers: check layer dependencies before addingChang Rebecca Swee Fun
In the original implementation, "bitbake-layers add-layers <layer>" succeeded without error checking. This will further introduce failures in recipe parsing only when "bitbake" command is executed. Adding a meta layer without its dependency layer(s) should failed and exit the process gracefully. Added extra argument "-F" to force add a layer without checking layer dependency. [YOCTO #10913] Signed-off-by: Phoong Stanley Cheong Kwan <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-12bitbake-layers: add signal hander to avoid exceptionZhixiong Chi
Fixed: bitbake-layers show-recipes | less press "q" to exit There will be a Broken pipe error output as follows: "BrokenPipeError: [Errno 32] Broken pipe" Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-27lib/bb/msg: introduce logger_create() functionPaul Eggleton
We use this code to set up a logger with colour in a number of different places, so create one function that does this and make some of bitbake's utility scripts use it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19bitbake-layers: Handle exception raised bytinfoil.prepare()Aníbal Limón
The tinfoil.prepare method can raise Exceptions when is parsing initial data so add this call inside try, finally to avoid get blocked for don't call tinfoil.shutdown(). The tinfoil_init function was remove because isn't make sense now since tinfoil.prepare() needs to be inside try, finally closures. Example of raised exception and gets blocked: $ bitbake-layers add-layer ~/repos/meta-openembedded/meta-python/ Traceback (most recent call last): File "/home/alimon/repos/poky/bitbake/bin/bitbake-layers", line 83, in main tinfoil.prepare(True) ... File "/home/alimon/repos/poky/bitbake/lib/bb/tinfoil.py", line 268, in run_command raise TinfoilCommandFailed(result[1]) bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last): File "/home/alimon/repos/poky/bitbake/lib/bb/command.py", line 81, in runCommand result = command_method(self, commandline) ... File "/home/alimon/repos/poky/bitbake/lib/bb/cooker.py", line 1314, in handleCollections raise CollectionError("Errors during parsing layer configuration") bb.cooker.CollectionError: Errors during parsing layer configuration Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: 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: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02bitbake-diffsigs/bitbake-layers: 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>
2016-06-01bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-17bitbake-layers: convert to plugin-basedChristopher Larson
This uses bb.utils.load_plugins, based on the plugin handling in recipetool and devtool in oe-core. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-09bitbake: Update logger.warn() -> logger.warning()Richard Purdie
python deprecated logger.warn() in favour of logger.warning(). This is only used in bitbake code so we may as well just translate everything to avoid warnings under python 3. Its safe for python 2.7. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-31bitbake: Don't limit traceback lengths to arbitrary valuesRichard Purdie
There appears to have been a lot of copy and pasting of the code which prints tracebacks upon failure and limits the stack trace to 5 entries. This obscures the real error and is very confusing to the user it look me an age to work out why some tracebacks weren't useful. This patch removes the limit, making tracebacks much more useful for debugging. [YOCTO #9230] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-19bitbake-layers: show-recipes: allow filtering by class inheritancePaul Eggleton
Add a -i/--inherits option to filter the output to include only recipes inheriting the specified class(es). Implements [YOCTO #7475]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-19bitbake-layers: fix mapping files to layersPaul Eggleton
bitbake-layers needs to map recipe and class files to the layer they came from within the show-recipes and show-overlayed commands. However, it turns out that mapping a file to the layer it came from is not as trivial as it might seem. To do it properly we need to match the path to an entry in BBFILES then map that to the collection name using BBFILE_PATTERN, then map that to the actual layer using variable history. If it doesn't match any entry in BBFILES, then we can fall back to BBFILE_PATTERN (to handle classes and conf files). This fixes the layer name not showing up properly in the output of the show-recipes and show-overlayed commands for recipes in layers such as meta-intel that have subdirectories in BBFILE_PATTERN. It also fixes the priority not showing up in show-layers for such layers. As part of this I've added a function to VariableHistory which for a space-separated list variable gives you a dict mapping the items added to the files in which they were added. I've also fixed bb.utils.get_file_layer() and reduced some of the duplication by using this function in bitbake-layers. Also fixes the priority not showing up for layers such as meta-intel Fixes [YOCTO #8160]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-19bitbake-layers: remove-layer: accept just layer directoryPaul Eggleton
If the specified layer isn't a path, then just match on the directory. Fixes [YOCTO #7839]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-19bitbake-layers: ensure we exit if BBLAYERS_LAYERINDEX_URL is not setPaul Eggleton
We were printing an error here, but not exiting. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-18bitbake-layers: use "with open" consistentlyPaul Eggleton
It's best practice to use "with open..." rather than open & close where practical. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-18bitbake-layers: refactor show-appends to stop using cooker bbappends listPaul Eggleton
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-18bitbake-layers: Convert flatten to use collections.bbappendsRichard Purdie
flatten support currently looks broken since it doesn't appear to deal with handling "%" support in bbappend file names. This patch converts it to use collections.get_file_appends() which correctly handles "%" support. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-11bitbake-layers: ensure non-extended recipe name is preferredRichard Purdie
In show-recipes and show-overlayed, we only list one variant of each recipe where multiple exist, therefore we should show the main one (e.g. in OpenEmbedded, we now show openssl and not nativesdk-openssl which would otherwise sort first.) Fixes [YOCTO #7514]. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-16bitbake-layers: use stdout instead of stderr for loggingPaul Eggleton
We use logger.plain() to produce actual output which needs to go to stdout. We could use more advanced filtering (and probably should in future) but for the moment let's just fix the regression. Fixes [YOCTO #7458]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-25bitbake-layers: fix wildcard support in remove-layerPaul Eggleton
The recent refactoring caused use of wildcards to trigger a traceback because the old variable name was being used. Fixes [YOCTO #7367]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-20bitbake-layers: add ability to fetch layers and their dependencies from ↵Chong Lu
layer index Add a command to query layer dependencies from a layer index such as the OpenEmbedded Layer Index at http://layers.openembedded.org. Fetches the layer and its dependencies and adds them into conf/bblayers.conf. [YOCTO #5348] Signed-off-by: Chong Lu <Chong.Lu@windriver.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-20bitbake-layers: fix loggingPaul Eggleton
Logging output was simply not getting printed. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-20bitbake-layers: refactor to use argparse instead of cmdPaul Eggleton
This makes help formatting and option handling a lot more standardised and allows us to drop a bunch of code. We also gain slightly more straightforward error handling. One side-effect however is that the old subcommand syntax using underscores is no longer supported. The dashed form has been supported (and displayed in the help text) for quite a while now so I wouldn't imagine that will be much of an issue. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-30bitbake-layers: fix error handling in add-layer / remove-layerPaul Eggleton
* Fix add-layer error message when a layer is already in BBLAYERS * Ensure we show an error message if we can't find BBLAYERS at all Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-21bitbake-layers: add commands for adding and removing layersPaul Eggleton
Add add-layer and remove-layer commands for easily adding and removing layers to/from bblayers.conf. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-06bitbake: show wildcard appends for bitbake-layersAsh Charles
The 'bitbake-layers show-appends' command can use the built-in get_file_appends() method which correctly identifies bbappends that include a '%' wildcard in their filename. Signed-off-by: Ash Charles <ashcharles@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-28bitbake-layers: show-cross-depends: add support for RRECOMMENDSPaul Eggleton
RRECOMMENDS must be satisfied at build time, and these could cross layer boundaries, so report these if they exist. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-28bitbake-layers: show-cross-depends: ignore self-satisfied RDEPENDSPaul Eggleton
Overlayed recipes caused this to show false positives because the overlaying version appeared to be satisfying the overlayed version's RDEPENDS; but you'd never be building both at the same time. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-28bitbake-layers: show-cross-depends: ignore global inheritsPaul Eggleton
It's not particularly useful to show globally inherited classes here since they do not normally represent a dependency. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-28bitbake-layers: show-cross-depends: add option to ignore a layerPaul Eggleton
By default, show-cross-depends shows dependencies on OE-Core (i.e. "meta") which is not particularly useful. Add an option to allow you to hide those. For example, to hide all dependencies on OE-Core: bitbake-layers show-cross-depends -i meta Multiple layers can be specified by using commas as separators (no spaces). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-22bitbake-layers: avoid loading configuration when not neededPaul Eggleton
In recent versions of bitbake, it is not possible to initialise a BBCooker object without having it load the configuration first. Thus we should avoid creating the Tinfoil object here in bitbake-layers which does that internally until we actually need to, so you can run "bitbake-layers help" and not have to wait several seconds for the output. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-10bitbake-layers: fix for move of data object to cookerPaul Eggleton
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-24bitbake-layers: fix show-appends and flatten for recent cooker changesPaul Eggleton
Fixes the show-appends and flatten subcommands for recent refactoring in cooker. [YOCTO #4536] [YOCTO #4535] Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-22bitbake-layers: fix for move of calc_bbfile_priority within cookerPaul Eggleton
calc_bbfile_priority is now in CookerCollectFiles which can be accessed on the collection attribute of a cooker instance. Fixes [YOCTO #4513]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-13cooker/bitbake-layers/tinfoil: Fix recipecache typoRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-12bitbake-layers/tinfoil: Catch up with status -> recpiecache renameRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-09bitbake-layers: fix duplicated help infoRobert Yang
There are two "help" lines when run bitbake help under python 2.6.6 (perhaps all python 2.6): $ bitbake-layers help [snip] help display general help or help on a specified command [snip] help display general help or help on a specified command This is because the cmd.py in python 2.6.6 also has a do_help() function as our bitbake-layers, and the cmd.Cmd.get_names() doesn't consider the overload, this has been fixed in python 2.7, use set() to remove the duplicated would fix the problem. [YOCTO #3428] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15bitbake-layers: make show-cross-depends avoid long pathRobert Yang
The "bitbake-layers show-cross-depends" print the absolute path in the past, now it will print the relative path (relative to the layer dir) by default, and add the "-f" option to make it print the absolute path. For example: $ bitbake-layers show-cross-depends [snip] meta-intel/meta-jasperforest/conf/machine/jasperforest.conf requires meta/conf/machine/include/ia32-base.inc [snip] $ bitbake-layers show-cross-depends -f [snip] /path/to/poky/meta-intel/meta-jasperforest/conf/machine/jasperforest.conf requires /path/to/poky/meta/conf/machine/include/ia32-base.inc [snip] [YOCTO #3824] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-31bitbake-layers: print the recipe's depends that crosses a layer boundaryRobert Yang
Figure out the dependency between recipes that crosses a layer boundary * Introduction: - For the .bb file, we need check the following depends: > Check the DEPENDS, RDEPENDS and inherits according to the cooker_data. > The cooker_data doesn't have the info about "require/include xxx", so we need check them manually. - For the .bbclass, .inc and .conf file, we can't get their file depends from the cooker_data, we need check them manually. * Usage: $ bitbake-layer show-cross-depends I don't like the name "show-cross-depends", figure-out-cross-depends might be better, but most of the commands are "show-xxx" for bitbake-layers. * Output: (snipped) /work/poky/meta/recipes-support/libusb/libusb-compat_0.1.4.bb inherits /work/poky/meta-yocto/classes/poky-sanity.bbclass /work/poky/meta-intel/meta-cedartrail/recipes-cdv-media/images/core-image-cdv-media.bb requires /work/poky/meta/recipes-sato/images/core-image-sato.bb /work/poky/meta-yocto/recipes-core/tiny-init/tiny-init.bb RDEPENDS /work/poky/meta/recipes-core/busybox/busybox_1.20.2.bb /work/poky/meta-intel/common/recipes-bsp/amt/lms_7.1.20.bb DEPENDS /work/poky/meta/recipes-devtools/autoconf/autoconf_2.69.bb /work/poky/meta/classes/distrodata.bbclass includes /work/poky/meta-yocto/conf/distro/include/package_regex.inc /work/poky/meta-intel/meta-sys940x/conf/machine/sys940x.conf requires /work/poky/meta/conf/machine/include/tune-atom.inc [YOCTO #3387] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-25bitbake-layers: fix get_file_layerRobert Yang
The get_file_layer can't handle the nested layer correctly, e.g.: meta-intel/conf/layer.conf meta-intel/meta-cedartrail/conf/layer.conf They are two layers, the file: meta-intel/common/recipes-bsp/amt/lms_7.1.20.bb belongs to meta-intel's layer, but the get_file_layer() may return meta-cedartrail accordig to BBLAYERS' order, since it uses: for layerdir in self.bblayers: if regex.match(os.path.join(layerdir, 'test')): return self.get_layer_name(layerdir) which doesn't care the filename, re-match the filename would fix the problem. [YOCTO #3387] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-07tinfoil: create simple interface for bitbake-based utilitiesPaul Eggleton
The code to initialise BitBake within bitbake-layers should be useful for other utilities that need to query configuration or recipe information, so refactor it out into its own class, "Tinfoil" (to continue with our cooking metaphor). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-22bitbake-layers: use parsable title for show-appendsPaul Eggleton
Print title text surrounded by === as we do with other subcommands so that you can filter it out in scripts. (You will also want to filter out lines starting with "WARNING:" if you just want the list). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-22bitbake-layers: avoid full parse for show-layers subcommandPaul Eggleton
We don't actually need to parse all recipes just to show the configured layers, so just parse the configuration instead. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02bitbake-layers: fix help for show-overlayed to match behaviourPaul Eggleton
show-overlayed actually lists the same recipe in multiple layers regardless of priority, so change the help description to match. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-04-17bitbake-layers: hide deprecation warningsPaul Eggleton
There are a number of DeprecationWarnings within BitBake code which bitbake itself filters out; bitbake-layers was not doing this, resulting in a stream of warnings printed out when used with Python < 2.7 (these warnings default to disabled on version 2.7 and above.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-20bitbake-layers: fix traceback in show-overlayed with nothing overlayedPaul Eggleton
There is no logger.note, use logger.plain instead (which is what we really want here anyway.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-01bitbake-layers: list overlayed classes in show-overlayedPaul Eggleton
Classes (.bbclass files) can be overlayed in a layer although they are currently located by BitBake in a different way (via BBPATH instead of using layer priority) and thus it is useful to be able to see when this is in effect and which layer's class is actually being used. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-01bitbake-layers: add show-recipes subcommandPaul Eggleton
Add a show-recipes subcommand which lists all available recipes, with the layer they are provided by. You can optionally filter the output by recipe name (PN). (This is a generalised version of the show-overlayed subcommand.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-01bitbake-layers: improve show-overlayed outputPaul Eggleton
Make the following improvements to the show-overlayed subcommand: * Show recipes that are overlayed when the version is higher or lower, not just when it is the same. This gives a much better picture of the influence each layer is having over the metadata used for building. This can be disabled with the -s option if you just want to see recipes with the same version as before. * Default to showing name (PN), layer and version rather than the full path and filename. The old style formatting can be used by specifying the -f option. * Mark skipped recipes as such in the output, and print them in the correct sorted place in the list rather than at the end * Prefix/suffix title line with === so it can be filtered out easily in shell scripts if desired Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>