aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib
AgeCommit message (Collapse)Author
2017-02-07devtool: improve parse failure handlingpaule/devtool25Paul Eggleton
With the move to tinfoil2, the behaviour when parsing failed has changed a bit - exceptions are now raised, so handle these appropriately. Specifically when if parsing the recipe created when running devtool add fails, rename it to .bb.parsefailed so that the user can run bitbake afterwards without parsing being interrupted. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-02-07recipetool: create: do not treat numbers in SCM URLs as versionsPaul Eggleton
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.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-02-07recipetool: create: properly handle npm optional dependenciesPaul Eggleton
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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2017-02-05wic: fix call of serial_console_form_kargsEd Bartosh
As syslinux module has been recently removed and serial_consloe_form_kargs became local API in rootfs_pcbios_ext plugin it should be called without syslinux. prefix. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-05wic: isoimage-isohybrid: use wic-tools to get syslinux pathEd Bartosh
wic-tools recipe specific sysroot contains syslinux as wic-tools depends on it. Used wic-tools target to get syslinux path should guarantee that syslinux is installed there and can be used. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-05wic: flatten imager class hierarchyEd Bartosh
wic code is hard to follow due to deep and twiggy class inheritance tree. Flatten imager tree: wic -> wic_create -> Creator -> DirectPlugin -> DirectImageCreator to wic -> wic_create -> DirectPlugin by removing Creator class and creator module merging DirectImageCreator into DirectPlugin Changed APIs to use the same parameters names. Passed parsed command line options as an object down the stack. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-02wic: direct: fix creation of work directoryEd Bartosh
It was a typo in current code: mktemp was used instead of mkdtemp to create work directory. This is fixed by using mkdtemp. Create work directory as a subdirectory of output directory to make sure both are on the same partition to make moving of result image faster. This also fixes possible disk space issues as mkdtemp uses TMPDIR, TEMP or TMP environment variables to get default value of its 'dir' parameter. Those variables are usually pointing to /tmp, which is not the best location to create huge images. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-02wic: engine: create output dirEd Bartosh
Make sure output directory exists before creating an image. Create it if it doesn't exist. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-02-02wic: remove syslinux.pyEd Bartosh
This module contains singe function serial_console_form_kargs, which is used only by rootfs_pcbios_ext plugin. Moved it there and removed syslinux module to make it easy to find and mainain plugin code. [YOCTO #10619]
2017-02-02wic: code cleanupEd Bartosh
Fixed indentation, unused imports, trailing lines etc. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: msger.py: remove unused APIsEd Bartosh
Removed unused enable_logstderr and disable_logstderr APIs. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: removed code from __init__.pyEd Bartosh
The code deals with non-existing directory and can be removed. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: move oe/misc.py one level upEd Bartosh
Flattened directory structure: moved wic/utils/oe/misc.py -> wic/utils/misc.py [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: move 2 APIs to wic.engineEd Bartosh
Moved find_canned and get_custom_config APIs to engine module. Removed empty wic.utils.misc module. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wci: misc: removed build_name APIEd Bartosh
This API is not used in wic code. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: partition: simlify calling plugin methodsEd Bartosh
Replaced parse_sourceparams function with list comprehension. Used local variables instead of attributes. Moved global variable to the local scope. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: removed test fileEd Bartosh
This file is not used anywhere in the wic code. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: renamd direct_plugin.py -> direct.pyEd Bartosh
As this files is located in plugins/imager subdirectory it's obvious that it's an imager plugin. Renamed to direct.py to be consistent with plugin naming scheme. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: simplified code of direct_pluginEd Bartosh
Removed unused methods. Got rid of get_default_source_plugin and _full_name methods. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: pylinted direct_pluginEd Bartosh
Fixed wrong continued indentation, unused import and trailing new line pyling warnings. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: improve naming in direct_plugin classesEd Bartosh
Synchronized attribure names in DirectImageCreator and DirectPlugin for better readability. Simplified code, removed unneeded global variable disk_methods. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: get rid of __rootfs_dir_to_dict methodEd Bartosh
Replaced class method __rootfs_dir_to_dict with a list comprehension. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: moved content of direct.py to direct_pluginEd Bartosh
This move simplifies directory structure and makes further refactoring easier. The code from direct.py was used only in direct_plugin, so it's safe to move it there. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: removed conf.py and empty config file.Ed Bartosh
Removed as they're not used anymore in wic code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: direct_plugin: stop using config managerEd Bartosh
This is a preparation to removing conf.py and config/wic.conf from the codebase. Got rid of using configmgr global object in direct_plugin and direct modules. It was used to implicitly parse kickstart file and set couple of variables. Replaced usage of configmgr by passing parameters directly to the DirectImageCreator. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-02-02wic: creator: stop using config managerEd Bartosh
This is a preparation to removing conf.py and config/wic.conf from the codebase. confmgr object is complicated for no reason and almost useless as all configuration info comes from command line and bitbake variables. It's used it creator.py to store information about output directory, logs and some never used functionality like tmpfs for future use, which doesn't actually happen. [YOCTO #10619] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-31isoimage-isohybrid: renamed variable hdd_dirEd Bartosh
Renamed variable hdd_dir to deploy_dir as this variable is assigned to the value of DEPLOY_DIR_IMAGE. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-31isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCHEd Bartosh
isoimage-sihybrid plugin uses MACHINE_ARCH to get the name of initrd image. It doesn't work for all machines, for example for quemux86-64 machine MACHINE_ARCH is quemux86_64 and initrd name is core-image-minimal-initramfs-qemux86-64.cpio.gz Used TRANSLATED_TARGET_ARCH variable to get the initrd image name. Replaced MACHINE_ARCH->TRANSLATED_TARGET_ARCH in WICVARS variable to make it available from <image>.env file. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-31wic: Look for image artifacts in a common locationTom Zanussi
Rather than have each image type look for artifacts in image-specific locations, move towards having them look for artifacts in a common location, in this case DEPLOY_DIR_IMAGE Use the existing deploy.bbclass to have the bootloaders put their binaries in DEPLOY_DIR_IMAGE and then wic will find them and place them in the image Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
2017-01-31wic: isoimage-isohybrid: stop using HDDDIREd Bartosh
Stop using HDDDIR in isoimage-isohybrid wic plugin. This variable is set by hddimg code, which is going to be removed soon. All required artifacts should be available from ISODIR. wic-image.bbclass has been modified to build iso artifacts, so it should be safe to remove usage of HDDDIR. [YOCTO #10835] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-31wic: use INITRD_LIVE in isoimage-isohybridEd Bartosh
INITRD variable is not set if hddimg is disabled. isoimage-isohybrid can't get correct name for initrd if INITRD variable is not set. Added INITRD_LIVE to WICVARS and used it in isoimage-isohybrid code to get initrd artifact name. Used INITRD if INITRD_LIVE is not set. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-31wic: partitionedfs: set partition name for gpt partitionsJukka Laitinen
Set proper gpt partition name for the partitions in case given in the configuration Signed-off-by: Jukka Laitinen <jukka.laitinen@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-31wic: direct.py: get rid of names with two underscoresEd Bartosh
Attributes with two leading underscores are mangled in Python and used mainly for avoiding name clashes with names from subclasses. They're not needed in most of wic classes. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31wic: remove unused API DirectImageCreator.get_disk_namesEd Bartosh
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31wic: make workdir a temporary directoryEd Bartosh
Wic used hardcoded path /var/tmp/wic/ as a work directory, which caused conflicts if two wic instances run in parallel. Made work directory unique and temporary. Moved results from work directory to output directory when they're ready. [YOCTO #10783] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31wic: get rid of baseimager inheritanceEd Bartosh
Simplified DirectImageCreator code by removing inheritance from BaseImageCreator. This inheritance doesn't make much sense as DirectImageCreator is the only class that was inherited from BaseImageCreator. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23wic: bootimg-pcbios: use wic-tools targetEd Bartosh
Used wic-tools target to get location of syslinux. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-23wic: misc.py: add parameter 'cache' to get_bitbake_varsEd Bartosh
This parameter will be used to allow or prevent variable caching. For example, we don't want to cache value of RECIPE_SYSROOT_NATIVE wic-tools variable as we may decide to rebuild wic-tools. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-23wic: fixed test_iso_image test caseEd Bartosh
Fixed isoimage-isohybrid plulgin and correspondent wic tet case: - used wic-tools target when getting varlue of STAGING_LIBDIR variable - ensured that image is built with efi and hddimg enabled Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-23wic: fixed recipe nameEd Bartosh
Renamed grub-efi-native -> grub-efi in NATIVE_RECIPES dictionary as '-native' suffix is added to the recipe name in the code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-23partition.py: use FAKEROOTCMD variable to get path to pseudoEd Bartosh
wic used native sysroot to get path to pseudo utility. This approach doesn't work with recipe specific sysroots. Using FAKEROOTCMD should fix the issue. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
2017-01-19devtool: fix source extraction to work with recipe specific sysrootsPaul Eggleton
When extracting source for a recipe within devtool (for extract, modify or upgrade) We need to redirect WORKDIR, STAMPS_DIR etc. under a temporary directory so that: (a) we pick up all files that get unpacked to the WORKDIR, and (b) we don't disturb the existing build However, with recipe-specific sysroots the sysroots for the recipe will be prepared under WORKDIR, and if we used the system temporary directory i.e. usually /tmp) as used by mkdtemp by default, then our attempts to hardlink files into the recipe-specific sysroots will fail on systems where /tmp is a different filesystem, and we'd have to fall back to copying the files which is a waste of time. Put the temp directory under the WORKDIR to prevent that from being a problem. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> [RP: Add needed mkdirhier call] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-19wic: partitionedfs: account for non-table partitions when checking if ↵Maciej Borzecki
logical parititon is needed Commit 8c1c43b7901a9fcd8b279eb4250b08157ad345b7 `wic: Create a logical partition only when it is really mandatory` did not account for partitions that are not present in partition table. Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16wic: _exec_cmd: produce error if exit code is not 0Ed Bartosh
Current code doesn't always show error output of the external command and even ignores non-zero exit code. Moved checking of exit code value to the lowest level possible: to _exec_cmd. This should make wic to always check exit code of the external command and issue an error if it's not 0. [YOCTO #10816] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16direct.py: fix getting image nameEd Bartosh
part.rootfs_dir was used as an image name in the code. However, when multi-rootfs feature is used this attribute points to the name of the rootfs, e.g. if --rootfs command line is rootfs1=core-image-minimal partf.rootfs_dir is 'rootfs1'. The code also fails when image name is not provided in wic commandline. For example, when wic is called with --rootfs-dir=<path> part.rootfs_dir will contain path and wic will crash trying to call bitbake -e <path> to get value of ROOTFS_SIZE variable. Fixed the code by getting image name properly and checking if it's not a path. [YOCTO #10815] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16canned-wks: remove mpc8315e-rdb.wksEd Bartosh
This file has been moved to meta-yocto-bsp/wic/ Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16wic/isoimage-isohybrid: remove do_stage_partition()Ioan-Adrian Ratiu
The purpouse of this function was to check dependencies for building a hybrid iso and build them using bitbake if not found. Calling bitbake in this context means this wic plugin itself cannot be instrumented inside bitbake recipes which is undesirable, the benefits of this are clear: there is no need to maintain outside scripts to generate an iso using wic and the isohybrid building logic can be further abstracted away into an isohybrid.bbclass in the future which can be easily inherited or something similar. So remove the function and add all dependencies to NATIVE_RECIPES so that wic can print useful errors when they're not built. To automate building the isohybrid image dependencies, add the following somewhere in your image build inheritence hierarcy (or maybe create a bbclass in the future to do these sort of things automatically): DEPENDS += "syslinux syslinux-native cdrtools-native e2fsprogs-native \ parted-native dosfstools-native mtools-native grub-efi-native" Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16wic: fix parsing of 'bitbake -e' outputEd Bartosh
Current parsing code can wrongly interpret arbitrary lines that are of 'key=value' format as legitimate bitbake variables. Implemented more strict parsing of key=value pairs using regular expressions. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16gummiboot: Remove old gummiboot recipe, related class and wks fileAlejandro Hernandez
Since the gummiboot project is no longer being maintained and we are using systemd-boot as a replacement instead, we can now clean up all remaining gummiboot files. [YOCTO #10332] Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-09gummiboot: Remove/change gummiboot references with systemd-bootAlejandro Hernandez
After systemd-boot was introduced, its been tested for a while with no major issues being found until now, this patch completely replaces all gummiboot instances with systemd-boot ones, taking the next step into cleaning up systemd-boot/gummiboot. [YOCTO #10332] Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>