aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib
AgeCommit message (Collapse)Author
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-21wic: rawcopy: make source filenames uniqueEd Bartosh
Rawcopy plugin copies source files to build folder before using them to assemble result image. After assembling the image wic renames source files to <image>.p<partition number>. If the same source file is used in multiple partitions wic breaks trying to rename file that doesn't exist. Added <line number> suffix to the files when copying them to the build dir. This should make filename unique even if the same source file is used for multiple partitions. [YOCTO #9826] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-20devtool: add finish subcommandPaul Eggleton
Add a subcommand which will "finish" the work on a recipe. This is effectively the same as update-recipe followed by reset, except that the destination layer is required and it will do the right thing depending on the situation - if the recipe file itself is in the workspace (e.g. as a result of devtool add), the recipe file and any associated files will be moved to the destination layer; or if the destination layer is the one containing the original recipe, the recipe will be overwritten; otherwise a bbappend will be created to apply the changes. In all cases the layer path can be loosely specified - it could be a layer name, or a partial path into a recipe. In the case of upgrades, devtool finish will also take care of deleting the old recipe. This avoids the user having to figure out the correct actions when they're done - they just do "devtool finish recipename layername" and it saves their work and then removes the recipe from the workspace. Addresses [YOCTO #8594]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20devtool: upgrade: record original recipe filesPaul Eggleton
This provides us with the information we need to remove the original version recipe and associated files when running "devtool finish" after "devtool upgrade". Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20devtool: update-recipe: refactor to allow calling separatelyPaul Eggleton
This will be called by "devtool finish" to allow it to update the recipe or create the bbappend depending on the destination. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20devtool: reset: refactor to allow calling separatelyPaul Eggleton
This will be called by "devtool finish" to allow it to reset the recipe at the end. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20devtool: update-recipe: don't copy local files that haven't changedPaul Eggleton
If there are files in the oe-local-files directory which are identical to the original version, then we shouldn't be copying them to the destination layer. This is particularly important when using the -a option to create a bbappend. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20devtool: update-recipe: find and use existing files directoriesPaul Eggleton
devtool update-recipe was defaulting to the ${BPN} named directory when adding patches next to a recipe, but that meant if you already had files in a ${BP} named directory (i.e. name and version) or "files" then you'd end up with two directories next to the recipe, which is usually not what you want. To avoid this, look through FILESPATH and take the first one that's the same level or one level down from the recipe and already exists, if any. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20wic: mountpoint is an optional argumentMaciej Borzecki
According to wic documentation partition mount point is an optional argument. Skipping mount point also makes sense in certain configurations when one needs to specify a partition that is not mounted by the running system, such as a recovery or a mirror partition (in dual rootfs setups). Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20wic: clone gummiboot wks for systemd-bootJianxun Zhang
This wks is just a copy of gummiboot wks with bootloader changed to systemd-boot. A very basic boot test on a X86 target is done with a direct-boot image generated by: wic create mksystemd-bootdisk -e core-image-minimal Because we plan to replace gummiboot with systemd-boot at any time in the future, we summarize history (as much as I can) of the current gummiboot wks before it's gone: ----------------------------------------------------------------- commit 7d4bb40905fab38fb3db1d0e17afbc803622f00c Author: Ed Bartosh <ed.bartosh@linux.intel.com> Date: Wed Sep 2 13:58:02 2015 +0300 wic: get rid of scripts/lib/image Moved content of scripts/lib/image/ to scripts/lib/wic as one directory with the same name as a tool is self-explanatory and less confusing than two. (From OE-Core rev: 5dc02d572794298b3362378cea3d7da654456c44) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> commit 77561e719181d58289687373eebadce764f838a7 Author: Ed Bartosh <ed.bartosh@linux.intel.com> Date: Wed Sep 2 13:58:01 2015 +0300 wic: use ext4 in canned .wks files Latest kernel doesn't have ext3 compiled in. Wic images produced from canned .wks can't boot because of that. Switching to ext4 fixes this issue. (From OE-Core rev: d281a65a81f369fc8d75023b8f911ce4106969c1) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> commit 072657ce98414afdd6f68941847e21fc5ce496c7 Author: Tom Zanussi <tom.zanussi@linux.intel.com> Date: Mon Aug 11 20:35:41 2014 -0500 wic: Add mkgummidisk kickstart file This is the same as mkefidisk but uses gummiboot instead of grub-efi. (From OE-Core rev: 5979409ebfab0bb07b3c2b2fcf14a722c441f07b) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> ----------------------------------------------------------------- Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-20wic: add systemd-boot option in EFI boot image pluginJianxun Zhang
The new systemd-boot enabled in OE is the old gummiboot merged into systemd project. Our intention is to replace gummiboot with systemd-boot in OE once every feature based on gummiboot is supported with systemd-boot. Before we can purge gummiboot, we temporarily keep both of the two bootloaders supported. Patch doesn't do replacement for every "gummi" occurrence. We think cleaning can be done in background after we disable people to use gummiboot, so we just keep change small and safe this time. Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
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-12devtool: return specific exit code for incompatible recipesPaul Eggleton
Certain recipes cannot be used with devtool extract / modify / upgrade - usually because they don't provide any source. Return a specific exit code (4) so that scripts such as scripts/contrib/devtool-stress.py know the difference between this and a genuine failure. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-12devtool: reset: allow reset to work if the recipe file has been deletedPaul Eggleton
We were attempting to open the recipe file unconditionally here - we need to account for the possibility that the recipe file has been deleted or moved away by the user. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-07-12devtool: update-recipe: fix --initial-rev optionPaul Eggleton
In OE-Core revision 7baf57ad896112cf2258b3e2c2a1f8b756fb39bc I changed the default update-recipe behaviour to only update patches for commits that were changed; unfortunately I failed to handle the --initial-rev option which was broken after that point. Rework how the initial revision is passed in so that it now operates correctly. 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-14devtool: reset: allow specifying multiple recipesPaul Eggleton
Allow specifying more than one recipe on the devtool reset command line. Also tweak the help text slightly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-03image-live, image-vm, wic: Remove fs size workaroundJussi Kukkonen
Since mtools has been patched to live with filesystems with sizes not divisible by sectors-per-track, we no longer need to try to set the size based on our guess of the sectors-per-track dosfstools is going to use. Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02scripts: python3: change python to python3 in shebangEd Bartosh
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-02wic: encode help textEd Bartosh
Encoded help text before sending it to pager.communicate as it expects binary. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02classes/lib: Update xrange -> range for python3Richard Purdie
xrange() no longer exists in python 3, use range() Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02classes/lib: Update to explictly create lists where neededRichard Purdie
Iterators now return views, not lists in python3. Where we need lists, handle this explicitly. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-30wic: bootimg-efi: include startup.nsh if it's availableChristopher Larson
We want the system to boot on its own, rather than the user having to manually input the correct file at the EFI prompt. [YOCTO #9556] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-25devtool: upgrade: clarify help text for --srcrev optionPaul Eggleton
The -S / --srcrev option must be specified if fetching from a git repository, so spell that out in the help text. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-25devtool: upgrade: tweak conflict handlingPaul Eggleton
Make a couple of changes to the rebase operation: 1) Only wrap the actual rebase command in try...except since a failure in any of the other commands should be an error, not a warning 2) If it's a conflict (which unfortunately we can only tell by checking for the keyword "conflict" since git doesn't return error codes based on the type of error) then print a message clarifying that the user needs to resolve the issue themselves to finish the upgrade. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-25devtool: upgrade: handle upgrading recipes with a versioned inc filePaul Eggleton
The gdb recipe in OE-Core has an inc file with the version in it; since the inc file is pulled in with a "require ${PV}.inc", when upgrading the recipe we need to also rename the inc file it will fail to parse and the upgrade itself will fail. Fixes [YOCTO #9574]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-21devtool: sdk-update: drop support for local updatesPaul Eggleton
Having two code paths here makes maintenance difficult, and it doesn't seem likely that you would use the local case in real usage anyway, so drop the local support entirely. This should allow us to resolve [YOCTO #9301]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-20wic: fix path parsing, use last occurrenceGeorge McCollister
If the path contains 'scripts' more than once the first occurrence will be incorrectly used. Use rfind instead of find to find the last occurrence. Signed-off-by: George McCollister <george.mccollister@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-19wic: add help for --bmap commandline optionEd Bartosh
Included description of -m/--bmap option to the help page produced by 'wic help create'. [YOCTO #9413] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-19wic: implement --bmap optionEd Bartosh
This option enables generation of <image>.bmap file for the result image using native bmaptool. [YOCTO #9413] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-19wic: add bmaptool to the list of utilitiesEd Bartosh
Added bmaptool -> bmap-tools pair to the dictionary executable -> recipe as bmaptool is going to be used by wic to generate .bmap file. [YOCTO #9413] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: use next builtin instead of .next methodEd Bartosh
Generators in Python 3 don't have .next method. It's recommended to use 'next' builtin instead. As it also present in Python >= 2.6 it should make wic code compatible with both Python 2 and Python 3. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: don't encode unicode stringsEd Bartosh
Removed check for unicode type as it doesn't work in Python 3. This check is not needed for wic as all its output seem to be strings. This allows to run code under both pythons. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: decode output of subprocess.communicateEd Bartosh
stdeout and stderr content returned by communicate API has different types in Python 3(bytes) and Python 2(string). Decoding it to 'utf-8' makes it unicode on both pythons. Decoded stdout and stderr output to utf-8 to make the code working under both Python 2 and Python 3. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: use // operator instead of /Ed Bartosh
Division operator works differently in Python 3. It results in float unlike in Python 2, where it results in int. Explicitly used "floor division" operator instead of 'division' operator. This should make the code to result in integer under both pythons. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: use find_executable in favor of bb.utils.whichEd Bartosh
As bitbake is not ported to Python 3 yet it's better to avoid using its APIs as much as possible to be able to test wic under Python 3 at least partially. Used distutils.spawn.find_executable API in favor of bb.utils.which to get path of the command to run. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>