summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils/oe/misc.py
Commit message (Collapse)AuthorAgeFilesLines
* wic: exec_native_cmd: implement support for pseudoEd Bartosh2015-12-011-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Wic runs some tools through pseudo, which makes exec_native_cmd to fail and throw cryptic error message when tool is not baked: For example: Error: exec_cmd: 'export PSEUDO_PREFIX=/media/ssd/poky-build/tmp/sysroots/x86_64-linux/usr;export PSEUDO_LOCALSTATEDIR=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/ ... PSEUDO_PASSWD=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/ ... PSEUDO_NOSYMLINKEXP=1;/media/ssd/poky-build/tmp/sysroots/ ... mkfs.ext4 -F -i 8192 /var/tmp/wic/build/rootfs_platform.7.ext4 -L platform -d /media/ssd/poky-build/tmp/work/qemux86-poky-linux/core-image-minimal/... returned '1' instead of 0 Made exec_native_cmd aware of pseudo and properly report errors when command is not found. (From OE-Core rev: 04bab58809c63c9114feb0aadc9b6115be10fcc4) 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>
* wic/utils/oe/misc.py: Preserve PATH when running native toolsRandy Witt2015-10-271-4/+16
| | | | | | | | | | | | | | | Previously exec_native_cmd() would remove all items from PATH except for the native sysroot. This can cause issues for the tools that are created using create_wrapper(). Now instead of wiping out the PATH, run a sanity check to check if the command is in the native sysroot. (From OE-Core rev: ba127370e621b5b683d6f454596c3d0c60c13df7) Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix typoEd Bartosh2015-09-031-1/+1
| | | | | | | | | Fixed typo in tool name: mkswqp -> mkswap. (From OE-Core rev: e21d4b442437fac450070922ec74029ee1d10208) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: implement getting variables from .env filesEd Bartosh2015-08-301-22/+37
| | | | | | | | | | | | Added functionality of getting variables from <image>.env files to BitbakeVars class. env files will be parsed if the directory with env files is known, i.e. when vars_dir attribute is set. Otherwise 'bitbake -e' output will be parsed. (From OE-Core rev: d21e4c1e56cab750ed4f6031d7f3dc5775a2c2cc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add default_image attribute to BitbakeVarsEd Bartosh2015-08-301-0/+6
| | | | | | | | | | | New attribute is used when bitbake variable is requested without specifying image name. The attribute should be set from outside, for example when wic is called with '-e <image>' option. (From OE-Core rev: 38d0b3744b5829333148ac4fc97dc45a8d0ba3a5) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: create new method _parse_lineEd Bartosh2015-08-301-10/+17
| | | | | | | | | | | | Moved code that parses one line of 'bitbake -e' output to separate method _parse_line. This method will be also used later to parse lines of .env files. (From OE-Core rev: 49ef04d3c9eeb76cbbc89b27b4dd1570b7a2552b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add BitbakeVars classEd Bartosh2015-08-301-38/+53
| | | | | | | | | | | | | Moved code of getting bitbake variables into separate class. Created singleton object of this class in the module namespace. Preserved existing API get_bitbake_var. (From OE-Core rev: 3229d37993e315c9ca1902849746b9f50f35845c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: remove undescore from function nameEd Bartosh2015-08-301-6/+6
| | | | | | | | | | | | | | Renamed __exec_cmd -> _exec_cmd as double underscores cause strange behaviour when function is called in class method. Python complains that __exec_cmd method(!!!) of the same class doesn't exist. (From OE-Core rev: 3b400a06d755e3d437967f60842b1d9bd94f0814) 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>
* wic: code cleanup: pylint misc.pyEd Bartosh2015-08-091-19/+21
| | | | | | | | | | Fixed pylint warnings. Increased pylint score from 8.02 to 9.40. (From OE-Core rev: 26d8c70fb8a7cc8f6473ad1779b20b00616740c0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: code cleanup: remove unused codeEd Bartosh2015-08-091-11/+0
| | | | | | | | | | Removed unused global variable wks_vars and 2 unused functions get_wks_var and add_wks_var. (From OE-Core rev: 7d87c821da6a5020e8dde3f1907fb8d6a023b110) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Report recipe name for native commandsEd Bartosh2015-08-091-3/+26
| | | | | | | | | | | | | | | exec_native_cmd was modified to report recipe to build native programs. Pairs executable->recipe are hardcoded as it's not possible to obtain this information automatically. [YOCTO #7631] (From OE-Core rev: 1274379c91ee8e2fb9fbb34a6445cd5767eb4a35) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Set default set of bitbake variablesEd Bartosh2015-07-101-0/+5
| | | | | | | | | | | | | | Set default set of bitbake variables to the set of variables for the first parsed image. This allows wic to find proper bitbake varibale values if it's called with '-e <image>' even without specifying image in the call of get_bitbake_var. (From OE-Core rev: 18cc6d2ec4dc289bb0333dddc96df5a645ea53d0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Turn off debug output for 'bitbake -e'Ed Bartosh2015-07-021-0/+5
| | | | | | | | | | | Switched debug level to 'normal' to prevent huge 'bitbake -e' output to go into wic debug output. This should help to make wic debug info much more clean and easier to read. (From OE-Core rev: 71510c32d78ba24bf1172548f8eb4adfe621d2de) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Refactor getting bitbake variablesEd Bartosh2015-07-021-52/+30
| | | | | | | | | | | | | | | | | | Wic gets bitbake variables by parsing output of 'bitbake -e' command. This implementation improves this procedure as it runs 'bitbake -e' only when API is called and does it only once, i.e. in a "lazy" way. As parsing results are cached 'bitbake -e' is run only once and results are parsed only once per requested set of variables. get_bitbake_var became the only API call. It replaces find_artifacts, find_artifact, find_bitbake_env_lines, get_bitbake_env_lines, set_bitbake_env_lines and get_line_val calls making API much more clear. (From OE-Core rev: 3abe23bd217315246ec2d98dc9c390b85cfe6a92) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: code cleanup: superfluous-parensEd Bartosh2015-06-231-3/+3
| | | | | | | | | | Removed unncecessary parents after 'if' 'del' and 'print' keywords. Fixed pyling warning: Unnecessary parens after 'xxx' keyword (From OE-Core rev: a64604d11f75973b4c2347fa2669da9889e44013) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move checks to exec_native_cmdEd Bartosh2015-06-111-0/+6
| | | | | | | | | | | | | | Checked for return code and output of native commands inside exec_native_cmd. Removed similar code from a lot of places where exec_native_cmd is called. (From OE-Core rev: 9e3e933321d58c04619a585326fb291dbf2748f5) 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>
* wic: removed exec_cmd_quiet and exec_native_cmd_quietEd Bartosh2015-06-111-21/+0
| | | | | | | | | | These functions are not used anywhere. (From OE-Core rev: 7467fd446d08704881325577b7035b6128db6151) 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>
* wic: Print bitbake error outputEd Bartosh2015-04-141-0/+1
| | | | | | | | | | | | Added bitbake error output to wic error message to make it more descriptive. [YOCTO #6911] (From OE-Core rev: f68576d4c9cecbe7122325d7fc78c9b27ff07a8e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic:code cleanup: No space allowedEd Bartosh2015-04-131-4/+4
| | | | | | | | | | Fixed pylint warning 'No space allowed around keyword argument assignment' (From OE-Core rev: e07dd9b9c71960fbeded162ed52fbce06de620e9) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: make error message more informativeEd Bartosh2015-04-101-2/+2
| | | | | | | | | | | | | Included name of the missing program into the error message produced by exec_native_cmd when program is not found. Removed mentioning of the host programs as this API is not running them anymore. (From OE-Core rev: 7d1599cf6a55d3624d2b90c1f55e14c4df73e570) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't use host paths when looking for native toolsEd Bartosh2015-04-101-1/+1
| | | | | | | | | | | | exec_native_cmd should not use host paths in $PATH to avoid finding and using host tools. [YOCTO: #6204] (From OE-Core rev: fa263f238bbddb00c9953994fb69cc358170e2ec) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: allow to configure overhead factor per partitionAlexandre Belloni2015-02-141-1/+0
| | | | | | | | | | | Introduce a new option --overhead-factor to replace IMAGE_OVERHEAD_FACTOR. (From OE-Core rev: 20fe0c7202724187dbe80eb2101d8ef69e86b94e) Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: allow to configure extra space per partitionAlexandre Belloni2015-02-141-1/+0
| | | | | | | | | | | | Introduce a new option --extra-space instead of using IMAGE_EXTRA_SPACE. This is useful for boot partitions where the extra space is often useless or for huge partition where 10MiB may not be enough. (From OE-Core rev: 9f7fe71a10bcdd1864d2f838f3510e96810ef42e) Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Use overhead factor when creating partitions from rootfs directoriesTom Zanussi2014-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When creating partitions sized to given rootfs directories, filesystem creation could fail in cases where the calculated target partition size was too small to contain the filesystem created using mkfs. This occurred in particular when creating partitions to contain very large filesystems such as those containing sdk image artifacts. This same limition is present in the oe-core image creation classes, which can be readily see by changing IMAGE_OVERHEAD_FACTOR from the default 1.3 to 1.0 and building a sato-sdk image. It should be possible to calculate required sizes exactly given the source rootfs and target filesystem types, but for now, to address the specific problem users are hitting in such situations, we'll just do exactly what oe-core does and define and use an IMAGE_OVERHEAD_FACTOR or 1.3 in those cases. Fixes [YOCTO #6863]. (From OE-Core rev: bbaef3ff5833fc1d97b7b028d7770834f62789da) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Add utility function for parsing sourceparamsTom Zanussi2014-08-151-0/+23
| | | | | | | | | | Parses strings of the form key1=val1[,key2=val2,...] and returns a dict. Also accepts valueless keys i.e. without =. (From OE-Core rev: 36f258ee6e60c26fd44b9bc71c318363cec71f42) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: Rename /mic to /wicTom Zanussi2014-08-111-0/+181
As well as any other stray instances of mic in the codebase that can be removed. We don't really need to carry around legacy naming, and the history is in git. (From OE-Core rev: 598b120406dc1d2b7e377bd1ab6f0acbef034b22) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>