aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
AgeCommit message (Collapse)Author
2016-09-19recipetool: create: pick up AC_PROG_SWIGPaul Eggleton
AX_PKG_SWIG is not the only commonly-used macro for detecting swig - there's also AC_PROG_SWIG. As per AX_PKG_SWIG, add swig-native to DEPENDS if AC_PROG_SWIG is found in configure.ac. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-19recipetool: create: detect python autoconf macrosPaul Eggleton
If python is required then we need to inherit pythonnative (or python3native) otherwise do_configure will probably fail since it won't be able to find python. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-19recipetool: create: fix error with git tree and no networkPaul Eggleton
When creating a recipe for an existing local git clone, we attempt to use the fetcher to determine if it supports the SRCREV variable. Unfortunately running this code does a network check to get the latest revision as a direct result of us using '${AUTOREV}' as a default value. If you don't have a network connection this will of course fail. Rather than have this block creating the recipe, catch the exception and just guess from the URL. Ultimately this should probably be fixed in the fetcher but for now this will at least resolve the issue on this end. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-19recipetool: create: fix name/version extraction from filenamePaul Eggleton
I ran into an example where recipetool was getting the name/version completely wrong: https://bitbucket.org/sortsmill/libunicodenames/downloads/libunicodenames-1.1.0_beta1.tar.xz >From this it would create a libunicodenames-1.1.0-beta1_1.1.0-beta1.bb file (likely because it couldn't split the file name and therefore took all of it, then got the version from one of the files inside the tarball). When this happens it's just irritating because you then have to delete the recipe / run devtool reset and then run recipetool create / devtool add again and specify the version manually. This patch is the result of systematically running the determine_from_filename() function over the files on the Yocto Project source mirror and my local downloads directory and fixing as many of the generic issues as reasonably practical - it now gets the name and version correct much more often. There are still cases where it won't, but they are now in the minority. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-19recipetool: create: improve python recipe license handlingPaul Eggleton
Try to ensure that for Apache, GPL and LGPL where the values extracted from the "Classifiers" field may not be version-specific, if there is a versioned license in the free-form license field then use that instead. Also insert the free-form license field as a comment in the recipe for the user's reference. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-19recipetool: create: fix picking up name from local python source treePaul Eggleton
Make use of the extravalues dict to send back other variable values from the python handling plugin, and enable passing back PV and PN. This not only places variable values in the final recipe a bit more consistently with other types of source, it also allows the name and version to be picked up fron a local source tree and not just when the recipe is fetched from a remote URL that happens to have those in it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-08recipetool: create: avoid extra blank lines in output recipePaul Eggleton
If we output extra blank lines (because of some automated editing) then it makes the output recipe look a bit untidy. You could argue that we should simply have the editing code not do that, but sometimes we don't have enough context there for that to be practical. It's simple enough to just filter out the extra blank lines when writing the file, so just do it that way. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: support node.js code outside of npmPaul Eggleton
If you have your own node.js application you may not publish it (or at least not immediately) in an npm registry - it might just be in a repository on github or on your local machine. Add support to recipetool create for creating recipes to build such applications - extract their dependencies, fetch them, and add corresponding npm:// URLs to SRC_URI, and ensure that LICENSE / LIC_FILES_CHKSUM are updated to match. For example, you can now run: recipetool create https://github.com/diversario/node-ssdp (I had to borrow some code from bitbake/lib/bb/fetch2/npm.py to implement this functionality; this should be refactored out but now isn't the time to do that refactoring.) Part of the fix for [YOCTO #9537]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: allow license variable handling to be rerunPaul Eggleton
If you make adjustments to the source tree (as create_npm.py will be) then you will need to re-run the license variable handling code at the end so that we get all of the files that should go into LIC_FILES_CHKSUM if nothing else. Split out the license variable handling to a separate function in order to allow this. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: add --keep-temp command line optionPaul Eggleton
For debugging it's useful to be able to tell recipetool to keep the temporary directory. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: support git submodulesPaul Eggleton
Ensure we fetch submodules and set SRC_URI correctly when pointing to a git repository that contains submodules. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: fix mapping python dependencies to python-dbg packagePaul Eggleton
When trying to map python module dependencies to the packages that provide them, if we're looking for .so files that satisfy dependencies then we need to exclude files found under the .debug directory, otherwise the dependency will get mapped to the python-dbg package which isn't correct. For example, this fixes creating a recipe for pyserial and not getting python-fcntl in RDEPENDS_${PN}, leading to errors when trying to use the serial module on the target. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-08recipetool: create: AX_PKG_SWIG should add dependency on swig-nativePaul Eggleton
If AX_PKG_SWIG is found in configure.ac, then what's being looked for is the swig binary, not swig for the target - so fix the dependency accordingly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-08-18devtool/recipetool/meta: Adapt to bitbake API changes for ↵Richard Purdie
multi-configuration builds Unfortunately to implenent multiconfig support in bitbake some APIs had to change. This updates code in OE to match the changes in bitbake. Its mostly periperhal changes around devtool/recipetool [Will need a bitbake version requirement bump which I'll make when merging] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-28recipetool: create: fix greedy regex that broke support for github tarballsPaul Eggleton
The regex here needs to be anchored to the end or it'll match longer URLs, which was exactly what I was trying to avoid. This regression was introduced in OE-Core revision 7998dc3597657229507e5c140fceef1e485ac402. Fixes [YOCTO #10023]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-25recipetool: record unknown license filesPaul Eggleton
Add a comment to the recipe listing license files that were found but not able to be identified, so that the user can find and examine them by hand fairly easily. Fixes [YOCTO #9882]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-12recipetool: create: support specifying a file as the local sourcePaul Eggleton
It is currently possible to specify a file (e.g. a tarball) on the local disk as the source, but you have to know to put file:// in front of it. There's really no need to force users to jump through that hoop if they really want to do this so check if the specified source is a file and prefix it with file:// if that's the case. Also ensure the same works for "devtool add" at the same time. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-12recipetool: create: fix handling of github URLsPaul Eggleton
For a while now, Github hasn't been advertising a specific repository URL since cloning the web URL with git works. Armed with this knowledge and fully expecting people to just paste the github URL, we need to handle this situation specially. If it looks like a github URL to the root of a repository then treat it as a git repository instead of a normal https URL to be fetched by the wget fetcher. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-08recipetool: create: drop unused convert_pkginfo() functionPaul Eggleton
Code cleanup, no functional changes - this code was never used. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-08recipetool: create: avoid decoding errors with Python 3Paul Eggleton
We're opening source files with the default encoding (utf-8) but we can't necessarily be sure that they are UTF-8 clean - for example, recipetool create ftp://mama.indstate.edu/linux/tree/tree-1.7.0.tgz prior to this patch resulted in a UnicodeDecodeError. Use the "surrogateescape" mode to avoid this. Fixes [YOCTO #9822]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-01recipetool: recognize less common makefile namesNathan Lynch
GNU make looks for "makefile" and "GNUmakefile" in addition to "Makefile", so add these other names to the heuristic for detecting a make-based project. Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-06-02scripts: python3: convert iterables to listsEd Bartosh
Converted return value of items() keys() and values() to lists when dictionary is modified in the loop and when the result is added to the list. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02scripts: Fix urlparse imports for python3Ed Bartosh
Used urllib.parse instead of urlparse to make code working in python 3. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2016-06-02scripts: Fix encoding errors for python3Ed Bartosh
Moved call of decode('utf-8') as close as possible to call of subprocess API to avoid calling it in a lot of other places. Decoded binary data to utf-8 where appropriate to fix devtool and recipetool tests in python 3 environment. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2016-06-02scripts: Replace basestring -> str for python3Ed Bartosh
Python 3 doesn't have basestring type as all string are unicode strings. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2016-06-02scripts: Fix deprecated dict methods for python3Ed Bartosh
Replaced iteritems -> items, itervalues -> values, iterkeys -> keys or 'in' Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2016-06-02classes/lib: Update to match python3 iter requirementsRichard Purdie
python3 standardises its use of iteration operations. Update the code to match the for python3 requires. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30recipetool / devtool: set a fixed SRCREV by default when fetching from gitPaul Eggleton
If fetching source from a git repository, typically within OpenEmbedded we encourage setting SRCREV to a fixed revision, so change to do that by default and add a -a/--autorev option to use "${AUTOREV}" instead. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30recipetool: create: use ${BP} for subdir for binary packagesPaul Eggleton
If we use ${BP} for the subdirectory, the default value of S will work rather than having to have an ugly value derived from the package file name in both places. This does mean that we have to assume the default though (we can't just let the normal logic work because the value of BP is the default until later on, so the replacement doesn't work). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30recipetool: create: extract variable values from .deb/.ipk/.rpmPaul Eggleton
Extract the metadata from package files and use it to set variable values in the recipe (including recipe name and version, LICENSE, SUMMARY, DESCRIPTION, SECTION and HOMEPAGE). For LICENSE we take care not to step on any value determined by our license file scan; if there is one we simply add a comment above the LICENSE setting so the user can resolve it. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30recipetool: create: support extracting SUMMARY and HOMEPAGEPaul Eggleton
Allow plugins to set any variable value through the extravalues dict, and use this to support extracting SUMMARY and HOMEPAGE values from spec files included with the source; additionally translate "License:" to a comment next to the LICENSE field (we have our own logic for setting LICENSE, but it will often be useful to see what the spec file says if one is present). Also use the same mechanism for setting the same variables for node.js modules; this was already supported but wasn't inserting the settings in the appropriate place in the file which this will now do. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06recipetool: create: fix falling back to declared license for npm packagesPaul Eggleton
Fix two problems falling back to the "license" field from package.json when no license file is present: 1) The function that was supposed to return the license field value was always explicitly returning None, and this was never noticed (because the test cases never exercised the fallback as they provided license files for each module). 2) Fix the main package not falling back because it had a default of an empty list, which evaluates to '' instead of 'Unknown'. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-29recipetool.newappend: fix syntax error for 'not path_ok' errorChristopher Larson
Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-03-20recipetool: create: don't create extra files directory unconditionallyPaul Eggleton
The extra directory next to the recipe should only be created if there are files to put into it; currently only the npm plugin does this. I didn't notice the issue earlier because the test was actually able to succeed under these circumstances if the recipe file came first in the directory listing, which was a fault in my original oe-selftest test; apparently on some YP autobuilder machines the order came out reversed. With this change we can put the oe-selftest test that highlighted the issue back to the way it was, with an extra check to reinforce that only a single file should be created. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: shrinkwrap and lockdown npm modulesPaul Eggleton
"npm shrinkwrap" creates a file that ensures that the exact same versions get fetched the next time the recipe is built. lockdown is similar but also includes sha1sums of the modules thus validating they haven't changed between builds. These ensure that the build is reproducible. Fixes [YOCTO #9225]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: support creation of additional files by pluginsPaul Eggleton
Allow plugins to create additional files to go alongside the recipe. The plugins don't know what the output filename is going to be, so they need to put the files in a temporary location and add them to an "extrafiles" dict within extravalues where the destination filename is the key and the temporary path is the value. devtool add was also extended to ensure these files get moved in and preserved upon reset if they've been edited by the user. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: check if npm available if npm:// URL specifiedPaul Eggleton
If the user specifies an npm:// URL then the fetcher needs npm to be available to run, so check if it's available early rather than failing later. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: split npm module dependencies into packagesPaul Eggleton
Rather than rolling all of an npm module's dependencies into the same package, split them into one module per package, setting the SUMMARY and PKGV values from the package.json file for each package. Additionally, mark each package with the appropriate license using the license scanning we already do, falling back to the license stated in the package.json file for the module if unknown. All of this is mostly in aid of ensuring all modules and their licenses now show up in the manifests for the image. Additionally we set the main LICENSE value more concretely once we've calculated the per-package licenses, since we have more information at that point. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: add license file crunchingPaul Eggleton
Matching license texts directly to md5sums only goes so far. Some licenses make the copyright statement an intrinsic part of the license statement (e.g. MIT) which of course varies between projects. Also, people often seem to take standard license texts such as GPLv2 and reformat them cosmetically - re-wrapping lines at a different width or changing quoting styles are seemingly popular examples. In order to match license files to their actual licenses more effectively, "crunch" out these elements before comparing to an md5sum. (The existing plain md5sum matching has been left in since it's a shortcut, and our list of crunched md5sums isn't a complete replacement for it.) As always, this code isn't providing any guarantees (legal or otherwise) that it will always get the license correct - as indicated by the accompanying comments the LICENSE values it writes out to the recipe are indicative and you should verify them yourself by looking at the documentation supplied from upstream for the software being built if you have any concerns. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: match *LICENSE* as a license filePaul Eggleton
For example, this picks up a file named MIT-LICENSE.txt. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: improve mapping for autotools program macrosPaul Eggleton
Make the following improvements to mapping items specified in AC_CHECK_PROG, AC_PATH_PROG and AX_WITH_PROG to recipes/classes: * Produce a map of native recipe -> binary for all binaries currently in STAGING_BINDIR_NATIVE and use this when mapping items * Add some more entries to the class map * Ignore autotools binaries since they are covered by the inherit of autotools * Ignore coreutils-native since that would almost always be a bogus dependency Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09recipetool: create: be more tolerant of spacing in configure.acPaul Eggleton
Allow for whitespace in appropriate places, and ensure we match all whitespace chars not just the space character. (This fixes extracting dependencies from tmux's configure.ac, for example.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-06recipetool: create: fix support for AX_CHECK_LIBRARYPaul Eggleton
Clearly I didn't test this part of the code - lists don't have an "add" method. Needless to say I have tested it now. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-02recipetool: create: add basic support for new npm fetcher/classPaul Eggleton
Add detection for npm modules and support for extracting the name and version from package.json as is usually part of an npm module contents. Note: this will likely only produce a buildable recipe if you use an npm:// URL; simply pointing to a node.js source repository isn't going to fetch the module's dependencies. It also doesn't set up the shrinkwrap/lockdown automatically, so there is some room for improvement later. Implements [YOCTO #8690]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-03-02recipetool: create: add basic support for generating linux kernel recipesPaul Eggleton
Add support for detecting a Linux kernel source tree and generating a basic kernel recipe using meta-skeleton's linux-yocto-custom recipe as a base. Implements [YOCTO #8981]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-03-02recipetool: create: add support for out-of-tree kernel modulesPaul Eggleton
Detect kernel modules by looking for #include <linux/module.h>, and handle the various styles of Makefile that appear to be used. I was able to use this code to successfully build a number of external kernel modules I found. Implements [YOCTO #8982]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-02-21recipetool: create: improve CMake package mappingPaul Eggleton
* Package names are actually case sensitive near as I can tell, so we shouldn't be lowercasing them everywhere. * Look for CMake packages in pkgdata and map those back to recipes, so we aren't dependent on the hardcoded mappings (though those are still preserved). * Avoid duplicates in the unmapped package list Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21recipetool: create: add additional extension mechanismsPaul Eggleton
Add a means of extending the dependency extraction for autotools and cmake. Note: in order to have this work, you need to have an __init__.py in the lib/recipetool directory within your layer along with the module implementing the handlers, and the __init__.py needs to contain: # Enable other layers to have modules in the same named directory from pkgutil import extend_path __path__ = extend_path(__path__, __name__) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-21devtool / recipetool: use common code for launching editorPaul Eggleton
Looking at Chris Larson's code for starting the user's editor for "recipetool newappend" it was slightly better than what I wrote for "devtool edit-recipe" in that it checks VISUAL as well as EDITOR and defaults to vi if neither are set, so break this out to its own function and call it from both places. The broken out version passes shell=True however in case it's a more complicated command rather than just a name of an executable. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-11recipetool: create: set S when we set SRC_URI from local git repoPaul Eggleton
If you specify a local directory which happens to be a git repository with an origin remote (and it is in fact remote), we can use that for SRC_URI as implemented by OE-Core revision b143d414846854dc8b3e0a47358daf5646eded38, however we also need to set S if the recipe is going to be of any use fetching from that SRC_URI later. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>