summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
Commit message (Collapse)AuthorAgeFilesLines
* recipetool: create: fix npm license code regressionPaul Eggleton2017-08-231-0/+3
| | | | | | | | | | | | | | OE-Core commit 1df60b09f7a60427795ec828c9c7180e4e52f98c caused a regression in npm handling since it still expected to be able to get the results of the license handling, but this no longer happens until after the npm plugin is called. Thus, call the license handling function ourselves here (which will record this as having been handled so it doesn't get done again later). (From OE-Core rev: 3e408aadaea85b6f192b34d37d508cbaf3cd7164) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix broken import in npm modulePaul Eggleton2017-08-231-1/+1
| | | | | | | | | | | With "import oe" in create_npm.py you get "AttributeError: module 'oe' has no attribute 'package'" when it tries to call oe.package.npm_split_package_dirs(). (From OE-Core rev: 1261900aeac725e5712e0180600753a9d4c67e60) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: allow plugins to set LICENSE and LIC_FILES_CHKSUMPaul Eggleton2017-08-232-80/+79
| | | | | | | | | | | | | | | | | | | | | We were being a bit prescriptive in setting LICENSE and LIC_FILES_CHKSUM. We can't always trust what's in the metadata accompanying some source which plugins will almost always be pulling from, however we do want to allow plugins to set the LICENSE and LIC_FILES_CHKSUM values. Merge what we find in our license file scan with what the plugin sends back. Additionally, plugins can now add a "license" item to the handled list in order to inhibit the normal LICENSE / LIC_FILES_CHKSUM handling if they have already taken care of it completely. Thanks to Mark Horn <mark.d.horn@intel.com> for prompting, testing and fixing this patch. (From OE-Core rev: 1df60b09f7a60427795ec828c9c7180e4e52f98c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: allow plugins to set PN / PV more easilyPaul Eggleton2017-08-231-7/+9
| | | | | | | | | | | | | Previously if we were able to auto-determine the name from the URL, that took precedence over any name that might be set in extravalues by a plugin. Some plugins might be able to get a better idea of the name and thus we should move defaulting of the name further down after the plugins have had a chance to set it. (From OE-Core rev: 3bb979c13463705c4db6c59034661c4cd8100756) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: replacing PV in SRCURIStanley Phoong2017-08-231-1/+3
| | | | | | | | | | | | | During recipe creation, it seems that the automation for replacing ${PV} at the SRCURI for tag, (e.g mbed-tls-${PV}) is causing some issue due to PV assuming it's a git source. A fix is implemented in this patch to resolve this issue. (From OE-Core rev: 9d3ec76c1b7dd75d904f5ff47297de0fb65b21c2) Signed-off-by: Stanley Phoong <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: handle git URLs specifying only a tagStanley Phoong2017-08-231-1/+22
| | | | | | | | | | | | | If a git URL is passed to recipetool create with a tag=, recipetool should handle it assuming that the tag is valid. [YOCTO #11393] (From OE-Core rev: 3afdcbdc9a3e65bc925ec61717784ffec67d529d) Signed-off-by: Stanley Phoong <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: being able to set branch when revision is providedChang Rebecca Swee Fun2017-08-231-0/+48
| | | | | | | | | | | | | | | | | | | | | This change is to improve the buildability of the recipe created by recipetool and devtool. When recipetool create is run on a git URL and a revision specified that is not on master, and "branch=" isn't already in the URL, then we should get the correct branch and append the branch to the URL. If the revision was found on multiple branches and 'master' is not in the list, we will display error to inform user to provide a correct branch and exit. [YOCTO #11389] (From OE-Core rev: ecca596b75cfda2f798a0bdde75f4f774e23a95b) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: disable PREMIRRORS and MIRRORS by defaultChang Rebecca Swee Fun2017-08-231-0/+1
| | | | | | | | | | | | | | | When creating new recipes, we are almost certainly fetching a new source rather that something that has already been fetched. I have disable PREMIRRORS and MIRRORS settings in the recipe that created by devtool while leaving an option for users to enable them manually if needed. Since devtool already has this options, we need to ensure that recipetool is able to handle the options passed from devtool. (From OE-Core rev: 091cee2bdc2378a3425a4ef8558d03e6f9c021ff) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix incorrect URL variable usagePaul Eggleton2017-08-171-1/+1
| | | | | | | | | | | | | | | | | We have two variables here, srcuri and fetchuri. srcuri is what eventually ends up in the recipe, whereas fetchuri is what we actually pass to the fetcher when we fetch the source within recipetool - sometimes these need to be different particularly for an upcoming patch to handle automatically setting the branch parameter. In OE-Core revision 9a47a6690052ef943c0d4760630ee630fb012153 I erroneously changed the call to scriptutils.fetch_url() to pass srcuri instead of fetchuri - this likely didn't have any ill effect, but change it back to passing fetchuri to match the original intent. (From OE-Core rev: b66b73bcf5ee7e4488970576fdc31dfa25b35f5e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scriptutils: pass in logger as parameterChang Rebecca Swee Fun2017-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | logger was not defined in scriptutils.py based on the observation in python traceback. Traceback (most recent call last): File "/workdir/poky/scripts/devtool", line 351, in <module> ret = main() File "/workdir/poky/scripts/devtool", line 338, in main ret = args.func(args, config, basepath, workspace) File "/workdir/poky/scripts/lib/devtool/utilcmds.py", line 55, in edit_recipe return scriptutils.run_editor(find_recipe(args, config, basepath, workspace)) File "/workdir/poky/scripts/lib/scriptutils.py", line 141, in run_editor logger.error("Execution of '%s' failed: %s" % (editor, exc)) NameError: name 'logger' is not defined We pass in logger as parameter to run_editor() from where it has been called (devtool/utilcmds.py and recipetool/newappend.py), which both modules already has logger setup. (From OE-Core rev: 21f04b61973dd9029f0e6bff5445e31cd762bf32) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: refactor code for ensuring npm is availablePaul Eggleton2017-07-212-22/+26
| | | | | | | | | | | | | | | | | | | Across devtool and recipetool we had an ugly set of code for ensuring that we can call an npm binary, and much of that ugliness was a result of not being able to run build tasks when tinfoil was active - if recipetool found that npm was required and we didn't know beforehand (e.g. we're fetching from a plain git repository as opposed to an npm:// URL where it's obvious) then it had to exit and return a special result code, so that devtool knew it needed to build nodejs-native and then call recipetool again. Now that we are using real build tasks to fetch and unpack, we can drop most of this and move the code to the one place where it's still needed (i.e. create_npm where we potentially have to deal with node.js code in a plain source repository). (From OE-Core rev: 8450de16ddb02d863204b411a94c6d84e0f88817) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: reimplement fetching with normal fetch/unpack tasksPaul Eggleton2017-07-212-25/+25
| | | | | | | | | | | | | | | | | | | | Now that we have the ability to run the tasks in a more standard context through tinfoil, change recipetool's fetching code to use that to fetch files using it. This has the major advantage that any dependencies of do_fetch and do_unpack (e.g. for subversion or npm) will be handled automatically. This also has the beneficial side-effect of fixing a recent regression that prevented this fetch operation from working with memory resident bitbake. Also fix devtool's usage of fetch_uri() at the same time so that we can completely replace it. Fixes [YOCTO #11710]. (From OE-Core rev: 9a47a6690052ef943c0d4760630ee630fb012153) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: eliminate second fetch for packagesPaul Eggleton2017-07-211-15/+6
| | | | | | | | | | | | | When dealing with package files (.rpm, .ipk etc.) we need to unpack them ourselves to get the metadata, which is thrown away when the fetcher unpacks them. However, since we've already fetched the file once, I'm not sure as to why I thought I needed to fetch it again - we can just get the local path and then unpack it directly. (From OE-Core rev: be45e9b17e9dbc8c2594d3a939be377ab0720a7c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: ensure meaningful error for malformed tarballsPaul Eggleton2017-07-211-4/+18
| | | | | | | | | | | | | | | | | | | If you pointed recipetool at a URL that should be a tarball e.g. https://tls.mbed.org/download/start/mbedtls-2.4.2-apache.tgz but instead it returns an HTML page, we try to unpack it, gzip complains but the operation doesn't seem to fail - instead we just get back an empty source tree. Change the checks to account for this - if the source tree is empty, check if the downloaded file in DL_DIR looks like an HTML file and error accordingly if it is. If it's not, error out anyway because no source was unpacked and it should have been (otherwise we just blindly set up EXTERNALSRC for this which is pointless). Fixes an aspect of [YOCTO #11407]. (From OE-Core rev: 8496113b63d5a5d1f99056610c0fdb972a6200d4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: git reformat URI mangling & parameter strippedStanley Cheong Kwan, Phoong2017-07-171-9/+26
| | | | | | | | | | | | | | | | recipetool seems to be mangling and stripping out the parameters for git URI. This will fix this issue as well as resolve the conflict of protocol parameter added by user. If a user adds their own protocol as an argument, it'll be honored. [YOCTO #11390] [YOCTO #11391] (From OE-Core rev: 0cd2fc8ca278ebaa76de95545eef26a07b350c8e) Signed-off-by: Stanley Cheong Kwan, Phoong <stanley.cheong.kwan.phoong@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: extract name of package from a repositoryPaul Eggleton2017-05-231-3/+8
| | | | | | | | | | | | | For git repositories in the absence of any other indicator, it's not an unreasonable assumption that the name of the repository is the name of the software package it contains, so use that as PN if we don't have anything else. (From OE-Core rev: ef73fa70f0955912b0da140922465a3c817424e9) 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>
* recipetool: create: skip values extracted from spec files containing macrosPaul Eggleton2017-05-231-0/+4
| | | | | | | | | | | | | | | | | | If a value we extract from a spec file contains an unexpanded macro (e.g. %{macroname}) then we should discard it since we're not seeing the actual value and we don't have an easy way of expanding it at the moment. This fixes for example getting %{name} as the recipe name when running the following: recipetool create https://github.com/gavincarr/mod_auth_tkt.git (From OE-Core rev: eee56a19cda051da6267f808cd3a04a4c644acb3) 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>
* recipetool: create: hide missing npm error when called from devtoolPaul Eggleton2017-04-132-1/+5
| | | | | | | | | | | | | | | | | If devtool is called with a URL to a source repository containing a node.js module, we don't know that until recipetool has fetched it, and due to the structure of the code we have to exit with a special code in order to let devtool know it needs to build nodejs-native. We also want to suppress the error message that recipetool would normally print under these circumstances; there is already a mechanism for this but it wasn't operative in the case where we're pointed to a source repository rather than an npm:// URL, so create some plumbing so that we know to hide the message. (From OE-Core rev: 0c2d0fbb1c6c5b82183799eb7ef80074f86bcfc4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool: add: fix node.js/npm handling with recipe specific sysrootsPaul Eggleton2017-04-132-15/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change over to recipe specific sysroots means that we can no longer get a known location simply from configuration for the npm binary - we need to get the recipe sysroot for nodejs-native, look there for npm if we need to check it's present, and add that to PATH when calling out to npm. Unfortunately this means anywhere we need to get that path we have to have parsed all recipes, otherwise we have no reliable way of resolving nodejs-native. Thus we have to change recipetool create to always parse all recipes (the structure of the code does not allow us to do this conditionally). In the worst case, if npm hasn't already been added to its own sysroot and we are fetching from a source repository rather than an npm registry, this gets a bit ugly because we end up parsing recipes three times: 1) recipetool startup, which then fetches the code and determines it's a node.js module, finds that npm isn't available and then exits with a specific error to tell devtool it needs to build npm 2) when we invoke bitbake -c addto_recipe_sysroot nodejs-native 3) when we re-invoke recipetool This code is badly in need of refactoring, but now is unfortunately not the time to do that, so we're going to have to live with this ugliness for now. Fixes [YOCTO #10992]. (From OE-Core rev: acfdbd796c99882b8586023c8c6b848716105c8d) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix for regression in npm license handlingPaul Eggleton2017-04-131-1/+2
| | | | | | | | | | | | OE-Core commit c0cfd9b1d54b05ad048f444d6fe248aa0500159e added handling for AND / OR in license strings coming from npm, but made the assumption that an & would always be present in the license value. Check if it's there first so we don't fail if it isn't. (From OE-Core rev: abe2955df2dc558de6068d9373dfcb47d690704b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool/recipetill: npm install of devDependenciesAnders Darander2017-03-222-5/+24
| | | | | | | | | | | | | | Web applications built using e.g. angular2, usually requires that the packages in devDependencies are available. Thus, add an option '--fetch-dev' to both devtool add and recipetool, to add npm packages in devDependencies to DEPENDS. (From OE-Core rev: f246f820d53b459596fde6758a09f7a0d7db7c4c) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/lib/create_npm: handle Public Domain licensesAnders Darander2017-03-041-0/+1
| | | | | | | | | | | Rewrite Public Domain as PD, as that's what the place holder in meta/files/common_licenses is called. (From OE-Core rev: d7f0af5aa90a9ef7714c842fb4cb762017820768) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/lib/create_npm: handle AND and OR in licensesAnders Darander2017-03-041-1/+15
| | | | | | | | | | | | Handle npm packages with multiple licenses (AND and OR). Prior to this, AND and OR were treated as licensed in their own. (From OE-Core rev: c0cfd9b1d54b05ad048f444d6fe248aa0500159e) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/lib/create_npm: rewrite see license in eulaAnders Darander2017-03-041-2/+4
| | | | | | | | | | | | | | Rewrite the 'SEE LICENSE IN EULA' to a single string (without spaces), to avoid splitting the string later on. (Otherwise, each word gets split, and assumed to be a license on it's own. (From OE-Core rev: 39127702cee80c972ee9a447ef4006751f47475e) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* create_npm.py: convert MIT/X11 to MITAnders Darander2017-03-041-0/+2
| | | | | | | | | | | Quite a few npm packages declare MIT/X11 as their license. This is equal to a pure MIT license. (From OE-Core rev: 8df5e731a10cc9ade1266e9daaa26ec7c855c062) Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Drop now unneeded update_data callsRichard Purdie2017-02-151-1/+0
| | | | | | | | | | Now that the datastore works dynamically we don't need the update_data calls so we can just remove them. They're not actually done anything at all for a while. (From OE-Core rev: 8de0c5d3bd01919e2bf0394f9c485936d6098cec) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: do not treat numbers in SCM URLs as versionsPaul Eggleton2017-02-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Numbers within SCM (e.g. git) URLs are extremely unlikely to be valid version numbers - more likely they are just part of the name, thus don't try to extract them and use them as the version - doing so causes pretty bad behaviour within devtool: --------- snip --------- $ devtool add https://github.com/inhedron/libtr50 NOTE: Fetching git://github.com/inhedron/libtr50;protocol=https... ... NOTE: Using default source tree path .../build/workspace/sources/libtr ... RecursionError: maximum recursion depth exceeded while calling a Python object --------- snip --------- (This was because ${PV} was being substituted into the URL, but PV's value was being set to include ${SRCPV}, so there was a circular reference.) (From OE-Core rev: 3427508b6ce865654f8bf01a6fc04b83c70315d3) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: properly handle npm optional dependenciesPaul Eggleton2017-02-071-7/+49
| | | | | | | | | | | | | npm's package.json supports two types of dependencies - optionalDependencies and dependencies; in the code for creating a recipe from a non-npm source (e.g. a git repository) we were not handling optionalDependencies and thus when pointed at a node.js application outside of npm we weren't taking care of all dependencies. (From OE-Core rev: 2b66cb9982d10ce1744d430858eaef3e5a72c8c0) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts: remove True option to getVarFlag callsJoshua Lock2016-12-161-3/+3
| | | | | | | | | | | | | | | getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) (From OE-Core rev: 3e4806063fe11092b2307f113a6c0b0f04104091) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts: remove True option to getVar callsJoshua Lock2016-12-166-31/+31
| | | | | | | | | | | | | 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\) (From OE-Core rev: 0a36bd96e6b29fd99a296efc358ca3e9fb5af735) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* devtool / recipetool: use tinfoil parsing APIPaul Eggleton2016-12-143-31/+6
| | | | | | | | | | | | | 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. (From OE-Core rev: f13b56266ee96dfab65a3a7db50e8051aa9f071a) 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>
* recipetool: fix encoding-related errors creating python recipesPaul Eggleton2016-12-081-2/+2
| | | | | | | | | | | | Yet another instance of us expecting a string back from subprocess when in Python 3 what you get back is bytes. Just decode the output within run_command() so we avoid this everywhere. (From OE-Core rev: 103faae78cdff5280c7b7cdb7ca01e0868d02ec9) 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>
* recipetool: add postinst to .deb importStephano Cetola2016-11-231-3/+32
| | | | | | | | | | | | | | The .deb import feature did not import postinst, postrm, preinst, or prerm functions. This change checks to see if those files exist, and if so, adds the appropriate functions. [ YOCTO #10421 ] (From OE-Core rev: ebb73aa6ad920bfd6a23f8c20105d6bcf07dd3d5) Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: separate LICENSE items with & by defaultPaul Eggleton2016-11-071-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | recipetool sets the LICENSE value based on licenses detected from the source tree. If there are multiple licenses then they were being separated by spaces, but this isn't actually legal formatting and if you're using "devtool add" you get a warning printed when devtool parses the recipe internally. Earlier I had made a conscious decision to do it this way since it's up to the user to figure out whether the multiple licenses should all apply (in which case they'd be separated with &) or if there is a choice of license (in which case | is the correct separator). However, I've come to the conclusion that we can just default to & and then the ugly warning goes away, and it's the safest alternative of the two (and most likely to be correct, since it's more common to have a codebase which is made up of code with different licenses, i.e. all of them apply to the combined work). I've tweaked the comment that we add to the recipe to explicitly state that we've used & and that the user needs to change that if that's not accurate. Fixes [YOCTO #10413]. (From OE-Core rev: ecac6aee8cf3313350b58c21012bcd67cfb915e4) 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: add: show recipetool create outputPaul Eggleton2016-11-071-6/+19
| | | | | | | | | | | | | | | When running devtool add, instead of hiding the recipetool create output, change it so that it's appropriate to show in the devtool context and show it in real-time. This means that you get status output such as when a URL is being fetched (though currently no progress information.) recipetool create now has a hidden --devtool option to enable this display mode. (From OE-Core rev: 219aec8803de4ef04c514c87ecfb15359c9424a6) 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: add: build nodejs-native if npm is needed and not availablePaul Eggleton2016-10-052-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user runs devtool add on an npm:// URL (or source tree that uses node.js), and npm is not available, just build nodejs-native instead of telling the user they need to do it; if that fails because there isn't any such recipe (which would be the default, since it's not in OE-Core) then produce a slightly more readable error message hinting at what the user needs to do. Note that this forces the use of nodejs-native rather than npm on the host - this makes sense for two reasons: (1) we need it to be compatible with nodejs for the target, and (2) we have to have a recipe for that anyway, so allowing you to avoid having a recipe for the native version isn't really beneficial. There's a bit of a hack in here in order to allow this - for node.js sources that aren't fetched via npm we don't know that they are that until we've fetched and unpacked them, by which time we're inside recipetool and have an active tinfoil instance that will prevent bitbake being run. To avoid this being an issue, we allow recipetool to get to the point where we know we need npm and then exit with a specific exit code, at which point devtool can try to build it and then if that succeeds, it will re-execute recipetool. This is definitely not ideal, but it can't really be refactored and done properly until we do the tinfoil2 refactoring; in the mean time though we still want to be helpful to the user. Fixes [YOCTO #10337]. (From OE-Core rev: f40662bde5aab158c4e4c3c3ff5e68665a4194a5) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: newappend: drop _provide_to_pnChristopher Larson2016-09-281-12/+1
| | | | | | | | | | | This function was broken by the multi-config changes, and isn't needed anymore now that recipeutils.pn_to_recipe can handle provides. Without this, the newappend sub-command fails. (From OE-Core rev: 4a5028dc3d1ab2f97465e63db5b05de73daebdfa) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: support git short form URLsPaul Eggleton2016-09-201-3/+6
| | | | | | | | | | | | | | | In keeping with making recipetool create / devtool add as easy to use as possible, users shouldn't have to know how to reformat git short form ssh URLs for consumption by BitBake's fetcher (for example user@git.example.com:repo.git should be expressed as git://user@git.example.com/repo.git;protocol=ssh ) - instead we should just take care of that automatically. Add some logic in the appropriate places to do that. (From OE-Core rev: 78c672a72f49c4b6cfd8c247efcc676b0ba1681a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: tweak license crunchingPaul Eggleton2016-09-201-1/+1
| | | | | | | | | | Filter out a plain "Licensed under the XXXX license" statement, as seen in the capnproto project (and no doubt others). (From OE-Core rev: ba4aa319fd49ee02ce2e30c2db0f3988c0e8833c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: pick up AC_PROG_SWIGPaul Eggleton2016-09-201-1/+2
| | | | | | | | | | | 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. (From OE-Core rev: 847a1aa7153fc8a7b820353283a6f1e51d64f8de) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: detect python autoconf macrosPaul Eggleton2016-09-201-0/+16
| | | | | | | | | | | 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. (From OE-Core rev: 63234cc45aee91b031657971f36997e1443f80ee) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix error with git tree and no networkPaul Eggleton2016-09-201-4/+10
| | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: f7e43f931d7d6019a3b2509b2b2635978fbbae36) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix name/version extraction from filenamePaul Eggleton2016-09-201-14/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. (From OE-Core rev: 7b018b1d493a8d10fd02b8cc220990b191c87fe5) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: improve python recipe license handlingPaul Eggleton2016-09-201-2/+28
| | | | | | | | | | | | | 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. (From OE-Core rev: 237f66042eedd906f654827b53bf9269738267ab) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: fix picking up name from local python source treePaul Eggleton2016-09-201-34/+2
| | | | | | | | | | | | | | 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. (From OE-Core rev: 3e7029f28c6ea9bb1d283bcdc3fdfee11455af8e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: avoid extra blank lines in output recipePaul Eggleton2016-09-081-1/+7
| | | | | | | | | | | | | | 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. (From OE-Core rev: cbebc9a2edf7d7a422ee5c71219e79e3b349de3b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: support node.js code outside of npmPaul Eggleton2016-09-081-1/+110
| | | | | | | | | | | | | | | | | | | | | | | 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]. (From OE-Core rev: 4fb8b399c05a1b66986fc76e13525f6c5e0d9b58) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: allow license variable handling to be rerunPaul Eggleton2016-09-081-50/+53
| | | | | | | | | | | | | 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. (From OE-Core rev: f0d6f4b7e87ea781ac0dffcc8d0310570975811b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: add --keep-temp command line optionPaul Eggleton2016-09-081-1/+5
| | | | | | | | | | For debugging it's useful to be able to tell recipetool to keep the temporary directory. (From OE-Core rev: 480a6b745a85b2881e5cc1a0bbb572e3235ca008) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* recipetool: create: support git submodulesPaul Eggleton2016-09-081-2/+9
| | | | | | | | | | Ensure we fetch submodules and set SRC_URI correctly when pointing to a git repository that contains submodules. (From OE-Core rev: 65d5cc62d4ecfc78ce4b37b3886a7fe5aa05a75e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>