summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
Commit message (Collapse)AuthorAgeFilesLines
* wic: use next builtin instead of .next methodEd Bartosh2016-05-142-2/+2
| | | | | | | | | | | | | 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] (From OE-Core rev: 9b7ab632e47d786dd979262015dbfb1254103f83) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't encode unicode stringsEd Bartosh2016-05-141-7/+0
| | | | | | | | | | | | | 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] (From OE-Core rev: a56924b4a0102e401b5e37d857a08bab15da974e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: decode output of subprocess.communicateEd Bartosh2016-05-141-2/+2
| | | | | | | | | | | | | | 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. (From OE-Core rev: 5b556f58a171e3d45107bb56a1f780e5c1abba37) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use // operator instead of /Ed Bartosh2016-05-142-10/+10
| | | | | | | | | | | | | | | 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] (From OE-Core rev: 997ff239bd753a7957cc14c6829b2f093d9bcef6) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use find_executable in favor of bb.utils.whichEd Bartosh2016-05-141-8/+2
| | | | | | | | | | | | | | 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. (From OE-Core rev: 9658956bf8a5da779e06f71941de9b3e89415cdc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't use L suffix for integersEd Bartosh2016-05-141-4/+4
| | | | | | | | | | | | 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] (From OE-Core rev: 296db7e33bd71585cac63dc78c2c95bc619b4a86) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: refactor pluginbaseEd Bartosh2016-05-141-28/+14
| | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: e62fe5a41bdcdd72b9b257fecff7ccdc59c76d33) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: remove unused functionsEd Bartosh2016-05-141-68/+1
| | | | | | | | | | | | | 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] (From OE-Core rev: eb87d591ef67f1953b2689430ef6c5a6a27a5b6e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use new syntax of 'except' statementEd Bartosh2016-05-143-3/+3
| | | | | | | | | | | | | | 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] (From OE-Core rev: 15e88714d6b0a93f72e8a19b083fcc1f2006e128) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: remove with_statement importsEd Bartosh2016-05-141-1/+0
| | | | | | | | | | | | | | '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. (From OE-Core rev: 528a1f20939589949831efbb4de6336776efe7d5) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't inherit classes from objectEd Bartosh2016-05-146-6/+6
| | | | | | | | | | | | | | 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] (From OE-Core rev: a146b03ee7d0aa5bc1722da5977a5952782b69bf) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't use dict.keys and dict.has_keyEd Bartosh2016-05-143-5/+5
| | | | | | | | | | | | | 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] (From OE-Core rev: 003df7dfb932c551953fbf1bd769b3c31bd16fb4) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use items instead of iteritemsEd Bartosh2016-05-144-5/+5
| | | | | | | | | | | | | 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] (From OE-Core rev: 5b14eb8d68aaca82de4f8f6bcb28ad6f4a5125d0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: replace print statements with print functionEd Bartosh2016-05-143-15/+15
| | | | | | | | | | | | | 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] (From OE-Core rev: ee6979a19c77931c3cf6368e695e370d46192fef) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use sparse_copy to preserve sparsenessEd Bartosh2016-05-061-4/+3
| | | | | | | | | | | | Used sparse_copy API in favor of dd/cp in rawcopy plugin to preserve sparseness of the copied raw content. [YOCTO #9099] (From OE-Core rev: 04eca59068a79ae6a9969be495c4cdf0c5c3e466) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use sparse_copy to copy partitionsEd Bartosh2016-05-061-4/+2
| | | | | | | | | | | | | | 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] (From OE-Core rev: 7f21427aca5df81d8881027fd98f71b821cf31d7) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add sparse_copy APIEd Bartosh2016-05-061-0/+30
| | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: bfde62bdc03152a4d3d383512479b974fa867f94) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add FIEMAP and SEEK_HOLE / SEEK_DATA APIsEd Bartosh2016-05-061-0/+531
| | | | | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: 182639ddc9cda85c896a54c1c64fd1fb145071a1) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: moved DiskImage to direct.pyEd Bartosh2016-05-062-41/+21
| | | | | | | | | | | | | 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. (From OE-Core rev: b3cc471790784c28f9362fcd6fc6a81c4316754c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: get rid of fs_related.makedirsEd Bartosh2016-05-061-14/+0
| | | | | | | | | | Removed fs_related.makedirs as is not used anywhere. The name is easy to confuse with os.makedirs. (From OE-Core rev: 796b114863ef20fbc89da45dbe6780abe1256f5e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: get rid of inheritance Disk->DiskImageEd Bartosh2016-05-061-34/+9
| | | | | | | | | | There is no need in this inheritance as DiskImage class is used only in one module and no other classes are inherited. (From OE-Core rev: 5af1d9bedc2c961eb91faf80251f24c3df754d76) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use truncate utility to create sparse filesEd Bartosh2016-05-062-24/+8
| | | | | | | | | | | | | | | | | | | 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] (From OE-Core rev: d2d0d18dfd3922411d856b98ab6ba5d64c9c1c9f) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add help for --system-id optionEd Bartosh2016-04-291-0/+4
| | | | | | | | | | | | | Added explanation of --system-id option to the output of wic help kickstart. [YOCTO #9096] (From OE-Core rev: 1a304afea4ad7be12ed5f0fcb397a538345a6b63) 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: set partition system idEd Bartosh2016-04-291-1/+6
| | | | | | | | | | | | | Used sfdisk to set partition system id if --system-id parameter is used for a partition in wks file. [YOCTO #9096] (From OE-Core rev: a1f7f7e61fd20fb6319825648930f7b6aa0e0cee) 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: add system_id argument to Image.add_partitionEd Bartosh2016-04-292-2/+3
| | | | | | | | | | | | | Added new argument to add_partition call to pass partition system id down the stack. [YOCTO #9096] (From OE-Core rev: f2733df697192c0010c17b7bbb02f8679cb8f313) 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: add system_id attribute to PartitionEd Bartosh2016-04-291-0/+1
| | | | | | | | | | | | | | | 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] (From OE-Core rev: 4f195a5b7574ebff8fbdb3045daa71f173f97a30) 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: add sfdisk to the list of utilitiesEd Bartosh2016-04-291-0/+1
| | | | | | | | | | | | | | 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] (From OE-Core rev: 398aafa185acbc7239505f7107735e93a502f6d2) 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: add --system-id wks optionEd Bartosh2016-04-291-0/+19
| | | | | | | | | | | | | Added new option --system-id to wks parser. The option will be used to set partition system id. [YOCTO #9096] (From OE-Core rev: b9c56b1c95cd1d0fd809d257e0cd05a50c481bed) 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: isoimage-isohybrid: fix splash file pathsIoan-Adrian Ratiu2016-04-291-2/+2
| | | | | | | | | | | os.path.join discards the cr_workdir var contents if the path of the second arguments is absolute. (From OE-Core rev: dba099d77dcc66b239523a55f3ed26784f9a662a) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: isoimage-isohybrid: add grubefi configfile supportIoan-Adrian Ratiu2016-04-291-21/+32
| | | | | | | | | | | | | | | 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. (From OE-Core rev: bf673a769514b13558ad9c785ae4da3a5adfd1e0) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix bug in handling fsoptionsEd Bartosh2016-04-141-19/+17
| | | | | | | | | | | | | | | | | Partitions specifying --fsoptions were silently skipped by wic due to the old bug introduced when removing code related to subvolume handling: - if mountpoint == "/" or not fsopts or fsopts.find("subvol=") == -1 + if mountpoint == "/" or not fsopts: [YOCTO #9396] (From OE-Core rev: be7ff1741e8ab5f2724b3f64da1bed8b0d3dcb7c) 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>
* Revert "wic/utils/partitionedfs.py: assemble .wic images as sparse files"Ross Burton2016-04-131-1/+1
| | | | | | | | | | | | | | It turns out that dd's conv=sparse doesn't look at the file extents, but simply checks if a "block" is all zero. If the block of zero was meaningful it gets lost and if the image is subsequently written to media using a sparse-aware writer then the block of zeros won't be written at all. This reverts commit 5fd592fbae2e046bcb8c3a6c3ef4993fe0400676. (From OE-Core rev: 63d15764cc2014dba9fee2186f0c8b97c2ac5682) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/utils/partitionedfs.py: assemble .wic images as sparse filesJoshua Lock2016-04-091-1/+1
| | | | | | | | | | | | | | | | The individual partitions created by wic are sparse but without this change the assembled image is written as one (potentially very) large file. Preserve sparseness in the assembled image by passing the sparse conversion symbol. [YOCTO #9099] (From OE-Core rev: 5fd592fbae2e046bcb8c3a6c3ef4993fe0400676) Signed-off-by: Joshua Lock <joshua.lock@collabora.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/isoimage-isohybrid.py: change cpio generated uid&gid to rootIoan-Adrian Ratiu2016-04-031-2/+2
| | | | | | | | | | | | By default cpio preserves the uid&guid's of the original user which leads to host contamination and boot failures because commands like mount from initramfs expect to be run by root and the original host user might not even exist on the target. (From OE-Core rev: 28910ee2eacc15cf42b5e58bd43b3bd15c34eb97) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic/isoimage-isohybrid.py: use glob to find initramfs locationIoan-Adrian Ratiu2016-04-031-2/+2
| | | | | | | | | | | Some filenames can omit 'initramfs', or use other names. This makes detection more flexible by using only the image name, machine arch and image type in a glob wildcard. (From OE-Core rev: ca516f5907a661606c35e1ca5c2ece9fc79c77ea) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix type of no-table optionEd Bartosh2016-03-281-1/+1
| | | | | | | | | | | | | | Type of --no-table option was incorrectly set in new wks parser. It causes parser to require argument for this option, which makes wic to fail with wks files that use --no-table: Error: argument --no-table: expected one argument Changed action parameter to 'store_true' to fix the issue. (From OE-Core rev: d483724cf3515f76e1b798a2018e2f3fa2bad0ba) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: don't throw away our created swap partitionChristopher Larson2016-02-281-0/+1
| | | | | | | | | | | | | We were creating the partition, mkswap'ing it, and then not dd'ing it into place in the final image, as source_file wasn't being set for swap partitions. This would result in a swap partition that couldn't be enabled on target until mkswap was run. (From OE-Core rev: 7580942a66f84c2120763c2d9665e2cec8e25138) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: fix processing of --use-uuidEd Bartosh2016-02-151-0/+3
| | | | | | | | | | | | | | | Processing of this option was lost during recent change of wks parsting. It was discovered during the work on booting wic images under qemu. Now, when -use-uuid is fixed it's possible to specify root partition by partition uuid. This will be done in the following commit. (From OE-Core rev: b4882e0b84d7fd4c85ee95386e94722485eafc2b) (From OE-Core rev: 73e9e3f150bf2de9b27c2ccc73e3dee334ee73fe) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* isoimage-isohybrid.py: fix cpio working directoryIoan-Adrian Ratiu2016-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Take `pwd` to be <initial-dir>. The %s path is relative to it. The value of %s is "output_folder/build". The current code works as follows: Changing directory to %s and finding the sources (after cd'ing) to cpio with output redirection to %s/initrd.cpio triggers the following error "Error: exec_cmd: cd output_folder/build/INITRD && find . | cpio -o -H newc >output_folder/build/initrd.cpio returned '1' instead of 0" This happens because after the cd, `pwd` is <initial-dir>/%s and by the redirect we write the result to to <initial-dir>/%s/%s/initrd.cpio which obviously does not exist. Fix this by getting the sources with "find %s" instead of "cd && find ." (From OE-Core rev: 07fa4783566d22d46ce719a621eee5404932dbbe) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: isoimage-isohybrid: check for syslinux-nativeMihaly Varga2016-02-041-2/+5
| | | | | | | | | | | | | | .iso image creation fails if during the image creation syslinux is baked and syslinux-native is not. Added new check to verify if both syslinux and syslinux-native are baked and bake them if these are not installed. (From OE-Core rev: fd5749832960ad3b85697c2878490d6f008982a3) Signed-off-by: Mihaly Varga <mihaly.varga@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: default to empty bootloader configMaciej Borzecki2016-02-041-0/+4
| | | | | | | | | | | | | | | | A kickstart file for non-x86 boards may have no 'bootloader' stanza. It is the usual case if bootloader is setup using other mechanism than through wic, and is for instance a part of u-boot configuration. In such case the 'bootloader' field in the KickStart class will be uninitialized. Instead of adding an empty bootloader line in every kickstart file call the bootloader parser with empty argument list to get defaults namespace. (From OE-Core rev: 264c03e854f77c3b62acb710384f66716ccbf469) Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: pylinted ksparser moduleEd Bartosh2016-01-201-4/+11
| | | | | | | | | | Added missing docstrings, fixed wrong indentation and long lines. Final pylint score is 9.89/10 (From OE-Core rev: 6e5dd42727b40c6b5ba6235026a6cfc78f482ac9) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: add help for 'include' commandEd Bartosh2016-01-201-0/+14
| | | | | | | | | | Added description of 'include' parser command to the 'wic help kickstart' output. (From OE-Core rev: 7481f39382e63ecbb5de406559cc28e5689bd974) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move parts of canned .wks into common.wks.incEd Bartosh2016-01-204-9/+6
| | | | | | | | | | | In order to give and example of 'include' feature of ks parser and for testing purposes common parts of 3 canned wks files were moved into common.wks.inc (From OE-Core rev: 629c6381669bd4acdb1613229cd095881d2d9cd2) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: implement search of includesEd Bartosh2016-01-201-2/+14
| | | | | | | | | | | | | Used custom argument type to implement search of include .wks files in canned wks paths. Include files can be specified either by full path or by name. [YOCTO #8848] (From OE-Core rev: 3695962ba4b685f304f1039978cec60d1b1712e3) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: refactor get_boot_configEd Bartosh2016-01-201-9/+7
| | | | | | | | | | | | | | | This function is going to be used by ks parser to find include .wks files. get_boot_config name is a bit confusing as function is quite generic. It looks if file is present in the canned wks directories. Renamed get_boot_config -> get_canned. Renamed parameter file_boot -> file_name. Updated description. (From OE-Core rev: 8ea9a4c0422c9600cd33ec6e815ebcf2d0aad364) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: ksparser: add support for includeEd Bartosh2016-01-201-1/+6
| | | | | | | | | | Extended parser to support inclusion of .ks files: recursively called self._parse to parse included .ks (From OE-Core rev: 33dd323ec6a1a1ed4e1a04e51de182c89c7b6bd9) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: do not remove build dir in source pluginsEd Bartosh2016-01-204-7/+3
| | | | | | | | | | | | | | | | | | Interesting bug was found during implementation of 'include' parser command. Build directory was removed in do_configure_partition method of bootimg- source plugins. This can cause removal of previously prepared partition images if /boot partition is mentioned after other partitions in .ks file. Moved work directory removal to direct.py before processing partitions. (From OE-Core rev: ba98262573cf1600e0d477317f51d488b5f8c4bd) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: use unique partition numberEd Bartosh2016-01-201-1/+3
| | | | | | | | | | | | | | This is a preparation for 'include' support. Used unique counter instead of line number for partitions in .ks file. Line numbers can be equal for different .ks files, which can cause problems if one .ks file is included into another. (From OE-Core rev: cc2233b51f1d22d4e540f4a3e9ceedd7ede9ffa9) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* wic: move wks parsing code to KickStart._parseEd Bartosh2016-01-201-0/+3
| | | | | | | | | | | This is a preparation for implementation of include statement. Parser will be called recursively to parse included .wks files, so it should be available as a method. (From OE-Core rev: 7778b9851758f4f782cb5f5d5fb36e68aed3b275) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>