aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
AgeCommit message (Collapse)Author
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-19scripts/oe-selftest: Improve listing by reducing unneeded spacingHumberto Ibarra
The --list-tests option assumes a terminal of 150 characters wide, which is clearly wrong. The output for this command is messy and hard to understand for lower widths. Every command should look good in a 80 characters terminal. Unfortunately, this can't be done at the moment. The bad naming of testcases have made the test names incredibly long. This patch reduces spacing between columns and shows the tests names in a concise and understandable way. The format is even the same one required for running a testcase. Once the testcase naming improves, this output will look even better. [Yocto #9534] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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-19mkefidisk.sh: mount images as read-onlyRaymond Tan
Mount the hddimg and rootfs.img as read-only when creating the bootable image on the medium. Otherwise, the md5 checksum values of the hddimg will be altered. As this changed checksum value might cause issue for users whom would reuse the hddimg. Signed-off-by: Raymond Tan <raymond.tan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-17oe-buildenv-internal: add BBPATH_EXTRA to BB_ENV_EXTRAWHITE_OERobert Yang
So that user can easily make their own conf files such as conf/site.conf work. For example, poky's default BBPATH in bblayers.conf is: BBPATH = "${TOPDIR}" Will change it to: BBPATH_EXTRA ??= "" BBPATH = "${BBPATH_EXTRA}${TOPDIR}" When user sets BBPATH_EXTRA in env to their own dir which contains conf/site.conf, it will work. Note, BBPATH_EXTRA must end with ":", we can't set BBPATH as "${BBPATH_EXTRA}:${TOPDIR}" since the sanity would fail when BBPATH_EXTRA is null. [YOCTO #7837] Signed-off-by: Robert Yang <liezhi.yang@windriver.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>
2016-05-14wic: don't use L suffix for integersEd Bartosh
This suffix is not supported by Python 3. Wic code works without it on Python 2 too, so it's safe to remove it. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: refactor pluginbaseEd Bartosh
Wic plugin machinery implemented using metaclasses. Reimplemented plugin machinery using this advice from https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef Syntax for creating instances with different metaclasses is very different between Python 2 and 3. Use the ability to call type instances as a way to portably create such instances. Now it should work under 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: remove unused functionsEd Bartosh
Removed 'raw', 'ask', 'choice' and 'pause' functions from msger.py as they're not used in wic code and some of them use raw_input, which is not present in 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: use new syntax of 'except' statementEd Bartosh
New syntax 'except Exception as err' is supported by Python >= 2.7. Old syntax 'except Exception, err' is not supported by Python 3. Used new syntax to be able to run wic on 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: remove with_statement importsEd Bartosh
'with' statement is not used in baseimager.py It's supported by Python 2.7, which is included into all target distros. Other wic modules use this statement. Removed useless 'from __future__ import with_statement' from wic code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: don't inherit classes from objectEd Bartosh
All classes in Python3 are new style classes and don't need to be inherited from object. Wic code works fine without this inheritance even with Python2, so it's harmless to remove it. [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 use dict.keys and dict.has_keyEd Bartosh
Replaced calls of dict.keys and dict.has_key methods with the 'key in dict' statement. 'key in dict' is more pythonic, faster and readable. dict.has_key doesn't exist in 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: use items instead of iteritemsEd Bartosh
Dictionary method 'iteritems' doesn't exist in Python 3. Replaced 'iteritems' with 'items' to be able to run the code under both Python 3 and Python 2. [YOCTO #9412] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14wic: replace print statements with print functionEd Bartosh
Print statements have been replaced with print function in Python 3. Replaced them in wic code to be able to run it under 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-14combo-layer: avoid too long command lines in update with historyPatrick Ohly
As suspected, invoking "git archive" with all intended files as parameters can run into command line length limitations. Splitting up the parameters into multiple invocations (xargs-style) works and was tested after encountering the situation in practice. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-14combo-layer: fix default "update" modePatrick Ohly
When the "history" option is not set in the combo-layer.conf, the intended default was to use the traditional method. Passing "True" as default when querying the config was unintentional. Also remove some left-over debugging code. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-11devtool: Fix build-sdk when pn doesn't match filenameRandy Witt
If an image with the filename foo.bb could be built using the name "bar" instead, then build-sdk would fail to create the derivative sdk. This was because the code assumed that the file name matched the target, which is not necessarily the case. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-09combo-layer: implement "update with history"Patrick Ohly
The core idea is that all commits get imported, including merge commits, and joined into one big merge commit that imports the changes from the individual components into the main branch of the combined repository. This is done by copying the files in each commit and removing deleted ones, instead of trying to patch the combined repository. The advantages of doing updates in this mode are: - works for arbitrary upstream repos, not just those which support conversion into a linear set of patches - listing history shows that commits where developed independently in the different components, instead of artificially showing them as if they had been developed one after the after (component "aaaa" before "bbbb", then "ccc", ...) - bisecting becomes easier: when upstream repos only ensure consistency when merging into their "master" branches, then those merge commits are good candidates for test builds also in the combined repo - more data mining can be done, for example showing who merged a commit and when Selecting a subset of the files is supported, albeit with a slight different semantic for wild card matching compared to other code paths (/ is matched by * and ?). Empty commits get skipped because typically they are a result of filtering (but that is not checked, so intentionally empty commits also get skipped). Other code paths are intentionally left unchanged, to avoid regressions. However, the downside is that some opportunities for refactoring (in particular regarding file filtering) were ignored. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-09combo-layer: runcmd() enhancementsPatrick Ohly
Allow setting the environment. Due to a subprocess quirk, it must always be set explicitly (reuses the one from the previous call if not set, instead of falling back to os.environ). Embedding nul characters will be useful for parsing git output more reliably; support dumping such output a bit better. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-09combo-layer: dummy "update with history"Patrick Ohly
When setting "history = True" in combo-layer.conf consistently for the components involved in an update or using "update" together with the "--history" command line flag, a new mode for updating will be used that does not rely on exporting/importing patches. A config setting is used because it should be used consistently by everyone using the same config, without having to remember to use an additional command line parameter. There are no real global settings, so the setting is checked separately for each component although the setting has to be set consistently. This restriction could be removed later. In practice, putting "history" into the "[DEFAULT]" section is the easiest approach for configuring it. The actual code changes split up action_update and the combo-layer.conf handling in preparation for this new mode, without implementing the mode itself. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-05-06ddimage: if 'pv' is installed, use itChristopher Larson
This gives us a progress bar for the image write, which is quite helpful. See https://www.ivarch.com/programs/pv.shtml. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
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-05-06scripts/lib/argparse_oe: also change 'positional arguments' to 'arguments'Christopher Larson
This aligns with our existing 'optional arguments' to 'options' change, and seems more intuitive for users. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06scripts/lib/argparse_oe: simplify options title changeChristopher Larson
There's no need to iterate over the action groups here, as self._optionals and self._positionals are available. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06scripts/lib/argparse_oe: show subparser help for unrecognized argsChristopher Larson
As an example, `recipetool create foo bar baz` shows `recipetool: error: unrecognized arguments: bar baz` and then displays the main help, not the help for the create command. Fix by saving the subparser name and using it in parse_args() to look up the subparser. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06scripts/lib/argparse_oe: show self.prog in the error messageChristopher Larson
This aligns our subclassed error() with that in the original class, using _print_message and self.prog. Also add a docstring based on the original. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: use sparse_copy to preserve sparsenessEd Bartosh
Used sparse_copy API in favor of dd/cp in rawcopy plugin to preserve sparseness of the copied raw content. [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: use sparse_copy to copy partitionsEd Bartosh
Copied partition images into final partitioned image using sparse_copy API. This method preserves sparseness of the final image. It also makes wic much faster, as unmapped blocks of the partition images are not copied. [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: add sparse_copy APIEd Bartosh
In order to make wic images sparse sparse_copy function has been copied from meta-ostro: https://github.com/kad/meta-ostro/blob/master/meta-ostro/lib/image-dsk.py This function uses filemap APIs to copy source sparse file into destination file preserving sparseness. The function has been modified to satisfy wic requirements: parameter 'skip' has been added. [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: add FIEMAP and SEEK_HOLE / SEEK_DATA APIsEd Bartosh
In order to make wic images sparse set of APIs has been copied from bmap-tools project. filemap.py module is taken from bmap-tools project: https://github.com/01org/bmap-tools/blob/master/bmaptools/Filemap.py It implements two ways of get information about file block: FIEMAP ioctl and the 'SEEK_HOLE / SEEK_DATA' features of the file seek syscall. Note that this module will be removed as soon as bmaptool utility supports copying sparse source file into destination file (this is already agreed with the maintainer of bmap-tools project). [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: moved DiskImage to direct.pyEd Bartosh
Moved DiskImage class from utils/fs_related.py to imager/direct.py as it's only used there. Removed fs_related module as it doesn't contain anything except of DiskImage. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: get rid of fs_related.makedirsEd Bartosh
Removed fs_related.makedirs as is not used anywhere. The name is easy to confuse with os.makedirs. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: get rid of inheritance Disk->DiskImageEd Bartosh
There is no need in this inheritance as DiskImage class is used only in one module and no other classes are inherited. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-06wic: use truncate utility to create sparse filesEd Bartosh
Used truncate instead of dd to create wic images for the following reasons: - dd doesn't preserve sparseness - truncate syntax is much more clear - dd requires additional calculations of the image size in blocks - the way dd was used in the code is not always correct. In some cases it was writing one block to the file which makes it not 100% sparse. [YOCTO #9099] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-29wic: add help for --system-id optionEd Bartosh
Added explanation of --system-id option to the output of wic help kickstart. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: set partition system idEd Bartosh
Used sfdisk to set partition system id if --system-id parameter is used for a partition in wks file. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: add system_id argument to Image.add_partitionEd Bartosh
Added new argument to add_partition call to pass partition system id down the stack. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: add system_id attribute to PartitionEd Bartosh
Added Partition.system_id attribute and initialized it from parse result of wks option --system-id. It will be used by the wic code below the call stack to set partition system id. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: add sfdisk to the list of utilitiesEd Bartosh
Added sfdisk -> util-linux pair to the dictionary executable -> recipe as sfdisk is going to be used by wic to set partition system id. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: add --system-id wks optionEd Bartosh
Added new option --system-id to wks parser. The option will be used to set partition system id. [YOCTO #9096] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: isoimage-isohybrid: fix splash file pathsIoan-Adrian Ratiu
os.path.join discards the cr_workdir var contents if the path of the second arguments is absolute. Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-04-29wic: isoimage-isohybrid: add grubefi configfile supportIoan-Adrian Ratiu
The latest wic kickstart refactoring introduced a bootloader option "--configfile" which lets wks' specify a custom grub.cfg for use while booting. This is very useful for creating stuff like boot menus. This change lets isoimage-isohybrid use --configfile; if this option is not specified in a wks, it generates a default cfg as before. Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
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>