summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/recipeutils.py
Commit message (Collapse)AuthorAgeFilesLines
* lib/oe/recipeutils: fix patch_recipe*() with empty inputPaul Eggleton2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | | If you supplied an empty file to patch_recipe() (or an empty list to patch_recipe_lines()) then the result was IndexError because the code checking to see if it needed to add an extra line of padding didn't check to see if there were in fact any lines before trying to access the last line. Fixes [YOCTO #9972]. (From OE-Core rev: 92a73e870478ddb2a2d137e3fff28828809bec2e) (From OE-Core rev: 5ce14441f02894e68881807138e8f45074900ba2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool: update-recipe: handle where SRC_URI is appended to with +=Paul Eggleton2016-04-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | If a recipe sets SRC_URI and then appends more items to it with += (such as the current rpm recipe in OE-Core), the code in patch_recipe_file() was failing with a traceback. Work around the problem for now by dropping the existing lines if we understand the operation, else just set the value outright at the end. This leaves something to be desired as it either doesn't respect the existing structure or leaves a mess but it's better than the current breakage. We'll need to come up with a better solution later. Part of the problem is the existing code structure doesn't allow for patch_recipe_file() to know what's being added or removed - it only knows the final value that the caller wants set. Fixes [YOCTO #9458]. (From OE-Core rev: da5cd84794e1ab5c4efcd6250d3b93a46f610744) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: refactor patch_recipe_file() to use edit_metadata()Paul Eggleton2015-12-011-67/+93
| | | | | | | | | | | | | | | | | Use bb.utils.edit_metadata() to replace some of the logic in this function; this avoids us effectively having two implementations of the same thing. In the process fix the following issues: * Insert values before any leading comments for the next variable instead of after them * Insert overridden variables (e.g. RDEPENDS_${PN}) in the correct place * Properly handle replacing varflag settings (e.g. SRC_URI[md5sum]) (From OE-Core rev: 0f81b83fc5fd908efa7f6b837137830ca65f6ed6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: check in validate_pn() for names instead of filenamesPaul Eggleton2015-12-011-0/+2
| | | | | | | | | | | | Ensure that the user specifies just the name portion instead of a file name with extension. (We can't just look for . since there are recipe names such as "glib-2.0" that legitimately contain .). (From OE-Core rev: a4c6af737811adb2bca87e3896f8710738dd255e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool: handle virtual providersPaul Eggleton2015-10-211-1/+5
| | | | | | | | | | | | | | For modify / extract / upgrade, if the specified "recipe" is not actually a recipe but a virtual target such as virtual/kernel, map it correctly to the actual recipe and make sure we use that name within the workspace. Thanks to Chris Larson for reminding me this was still broken and for a hint on how to fix it. (From OE-Core rev: 1f7752282ffb47d2621030ddb2fa42a5e491d6d2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils: implement get_recipe_local_files()Markus Lehtonen2015-10-011-0/+16
| | | | | | | (From OE-Core rev: c94cf6e6e8a0645c822a708a432901dcb5ce5bf4) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils.py: don't hardcode the upstream version as 1.0 when SRC_URI is ↵Alexander Kanavin2015-09-281-4/+5
| | | | | | | | | | | | | empty or absent Instead, simply return the version of the recipe, so that the upstream version checker will declare that they match. (From OE-Core rev: 10c948a67546dd4ed2ac00b5210ef4b3eeca9401) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool / lib/oe/recipeutils: ensure we can parse without bbappendsPaul Eggleton2015-09-231-0/+2
| | | | | | | | | | | These functions ostensibly allowed parsing a recipe without bbappends but this clearly hadn't been tested because a variable was unassigned in both of them in that case. (From OE-Core rev: d2bb9f08303bb120e811c03af2f5339e8f262cfa) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: properly split unexpanded variable valuesPaul Eggleton2015-09-231-2/+59
| | | | | | | | | | | | | | | | | | | | Variables such as SRC_URI which are space-separated may also contain Python expressions (${@...}) which themselves contain spaces that shouldn't be split when splitting the value into items. In order to ensure this we need to use a custom splitting function instead of just string.split(). This issue could be seen when doing "devtool modify sudo", adding a commit to the resulting source repository then "devtool update-recipe" - the Python expression in SRC_URI was being unnecessarily broken onto multiple lines. Fixes [YOCTO #8046]. (From OE-Core rev: bbec2ee98a08270c681189a6ba26beb1034d3e2f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: avoid parsing in get_var_files()Paul Eggleton2015-08-191-2/+1
| | | | | | | | | | | | | Let's have the caller do this and then the function is a bit more flexible (e.g. we can choose to parse with bbappends or not); fix up calls to this function appropriately (of which there are only two, both within devtool). (From OE-Core rev: 6ba969f1ac5a1a0e277a21287fc5ae1622a6b14e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils.py: allow all characters in regexes used to parse version stringsAlexander Kanavin2015-08-101-2/+2
| | | | | | | | | | Previously only numeric characters were matches and anything else was discarded, so 4.0-rc3, 2005e, 1.0.2a and similar versions got truncated. (From OE-Core rev: ab609c471d85be3248b789c8ab2813957cd97e29) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils.py: get_recipe_pv_without_srcpv remove prefixes from pvAníbal Limón2015-07-231-0/+6
| | | | | | | | | | Some recipes uses v or r prefixes in versions that makes wrong comparisions over recipes like lz4 r123 > 128. (From OE-Core rev: f7d250c97f40a737df9020180852d2ee87ca06b3) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oe/recipeutils.py: get_recipe_upstream_info update to get revisionAníbal Limón2015-07-231-13/+15
| | | | | | | | | | | | Bitbake fetcher latest_versionstring now returns a tuple with (version, revision) that helps SCM's like git to build current upstream version. [YOCTO #7605] (From OE-Core rev: 7ede979950fd265026c74526d8448627fd0a8c08) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oe/recipeutils.py: get_recipe_upstream_info only use sfx and pfx when exitsAníbal Limón2015-07-231-3/+10
| | | | | | | | | | Don't use pfx and sfx when not exist because cause formatting errors like 2.9HASH instead of 2.9+gitAUTOINC+HASH. (From OE-Core rev: 382833cc7e7603241838e18e429f69da0c2ee4ac) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: fix replace_dir_vars to return the correct variablesPaul Eggleton2015-07-161-1/+2
| | | | | | | | | | | | | | | If we sort by length of name here we get the variables we are interested in first. I've tested this with all of the variables we care about (the ones at the top of bitbake.conf) and it returns the right results. This fixes the failures we've been seeing in the oe-selftest test_recipetool_appendfile_* tests. (From OE-Core rev: 95c54512c9fcdbaa419891e46fd99102722ba3d8) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oe/recipeutils.py: get_recipe_upstream_version returns 1.0 when not SRC_URIAníbal Limón2015-07-121-1/+10
| | | | | | | | | | Recipes that don't have SRC_URI means that don't use upstream sources so returns 1.0. (From OE-Core rev: 92f2481cf88e7b626cfe604134c9d020d06bd32c) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: Ensure order of data store doesn't influence the resultRichard Purdie2015-07-121-1/+1
| | | | | | | | | | | The order of the keys from the data store is not prescribed. If target_datadir comes before datadir the selftests fail since the 'wrong' variable is used for substitutions. This highlights an issue with the replace_dir_vars() function. Fix this. (From OE-Core rev: d47c496aa058f5b18d03a68bcd79e5c8607de34f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oe.recipeutils: fix line.split error in bbappend_recipeChristopher Larson2015-06-271-1/+1
| | | | | | | | Cc: Paul Eggleton <paul.eggleton@linux.intel.com> (From OE-Core rev: 8d18c2e71b0fcb047831a67d93f4b489aff1b77d) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils: Improve get_recipe_pv_without_srcpv functionAníbal Limón2015-06-081-10/+2
| | | | | | | | | | Use pv instead of rd this make the function more generic and avoid copy recipe data. (From OE-Core rev: c1c3c9a4fbaf01a905f79b0970f98ccb221a3935) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipeutils: Add get_recipe_upstream_version and get_recipe_pv_without_srcpv ↵Aníbal Limón2015-06-031-0/+96
| | | | | | | | | | | | | | | | | functions The get_recipe_upstream_version functions tries to get the current version of recipe in upstream it uses bb.fetch2 latest_versionstring method also latest_revision when is SCM. The get_recipe_pv_without_srcpv discards the SRCPV in SCM's recipe like git it returns a tuple with the version, prefix and suffix of a PV. (From OE-Core rev: d1683b5bb584e2b09bda76bf8523b12636d91d73) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: add appendfile subcommandPaul Eggleton2015-05-201-1/+327
| | | | | | | | | | | | | | | | | | | | | | Locating which recipe provides a file in an image that you want to modify and then figuring out how to bbappend the recipe in order to replace it can be a tedious process. Thus, add a new appendfile subcommand to recipetool, providing the ability to create a bbappend file to add/replace any file in the target system. Without the -r option, it will search for the recipe packaging the specified file (using pkgdata from previously built recipes). 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. Fairly extensive oe-selftest tests are also provided. Implements [YOCTO #6447]. (From OE-Core rev: dd2aa93b3c13d2c6464ef0fda59620c7dba450bb) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: add a parse_recipe_simple() functionPaul Eggleton2015-05-161-3/+26
| | | | | | | | | | | | Add a function that simply parses a recipe by name and optionally the bbappends that apply to it. (Note that if you're using tinfoil you need to have initialised it with config_only=False so that it can map the recipe name to a recipe file.) (From OE-Core rev: a8f221f6c6c0562a5ed06438231c2906e542fb7b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool: handle . in recipe namePaul Eggleton2015-04-271-2/+2
| | | | | | | | | | | | Names such as glib-2.0 are valid (and used) recipe names, so we need to support them. Fixes [YOCTO #7643]. (From OE-Core rev: b9fd8d4d4dfae72de2e81e9b14de072e12cecdcf) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool: include bbappends in recipe parsingMarkus Lehtonen2015-04-271-3/+3
| | | | | | | | | | | In order to get correct metadata, SRCREV for example. Fixes [YOCTO #7648]. (From OE-Core rev: 8b1794559dd7fd956716179d628e61cffdce1686) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe/recipeutils: minor improvements to patch_recipe()Paul Eggleton2015-02-231-2/+2
| | | | | | | | | | * Ensure it knows where to put SRCREV and S * Handle prepend/append and functions in general (From OE-Core rev: a770c3764efa857a8b1f0ce4b398277cd483a6af) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* lib/oe: add recipeutils modulePaul Eggleton2014-12-211-0/+279
Add a module to help provide utility functions for dealing with recipes. This would typically be used by external tools. Substantial portions of this module were borrowed from the OE Layer index code; other functions originally contributed by Markus Lehtonen <markus.lehtonen@intel.com>. (From OE-Core rev: fd970c3b42b39601f379300d83354d42d5a536ba) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>