summaryrefslogtreecommitdiff
path: root/buildstream/_loader.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused importsGökçen Nurlu2017-12-071-2/+0
|
* _loader.py: Remove historic distinction between element name and filenameJürg Billeter2017-11-301-8/+6
| | | | They have been the same for a long time.
* _loader.py: Remove unused basedir attribute from LoadElementJürg Billeter2017-11-301-5/+2
|
* _loader.py: Remove unused owner attribute from DependencyJürg Billeter2017-11-301-7/+6
|
* _loader.py: Create Dependency objects for dummy targetJürg Billeter2017-11-301-1/+1
| | | | Match the structure of real targets.
* Removing unneeded str() statements in "{}".format() statementsTristan Van Berkom2017-11-211-2/+2
| | | | | Since these changes were effected in 3b17762a4cab23c238762ca32baa348788347473, these stringifications are now implied and no longer needed.
* Switch old-style string formattings to new '.format()'Gökçen Nurlu2017-11-171-9/+9
|
* Refactoring: Move exceptions module to be privateTristan Van Berkom2017-11-061-1/+1
| | | | Hide all of buildstream's internal exceptions from the API surface.
* _loader.py: Removing arch conditionalsTristan Van Berkom2017-11-051-52/+3
|
* _loader.py: Adjust the loader to support multiple targetsTristan Maat2017-11-041-20/+31
|
* _loader.py: Updated for _yaml.composite() API changeTristan Van Berkom2017-10-171-4/+2
|
* _loader.py: Now takes an OptionPool and processes each loaded fileTristan Van Berkom2017-10-101-16/+14
|
* _loader.py: Removing all traces of loading variants.Tristan Van Berkom2017-10-081-452/+16
|
* _yaml.py: Fixing inconsistently named API _yaml.validate_node()Tristan Van Berkom2017-10-011-2/+2
| | | | | | | | | | All of the _yaml APIs which deal with a node (dictionary loaded from YAML) are named _yaml.node_foo(), _yaml.node_bar(), _yaml.node_baz() etc, except for this one glaring exception. Also added a missing internal API documenting comment for _yaml.node_validate() Also updated all callers to _yaml.validate_node() to now call _yaml.node_validate().
* _loader.py: Allow environment-nocache on elements.93-creating-a-child-task-can-fail-and-raise-a-stack-traceTristan Van Berkom2017-09-221-1/+1
| | | | Fixes another regression from validating all the loaded node attributes.
* Add element node validationsTristan Maat2017-09-141-0/+10
|
* _loader.py: Support dependency type 'all'Jürg Billeter2017-08-101-2/+3
| | | | | | This is equivalent to not specifying a dependency type at all. Fixes #61
* buildstream/_loader.py: Don't repeat elements in resolve_project_variantPedro Alvarez Piedehierro2017-07-251-2/+10
| | | | | Add an extra argument to the function to know which elements were already resolved.
* _loader.py: Added project variant resolutionTristan Van Berkom2017-07-171-36/+96
| | | | | | | | | After resolving variants and checking for circular dependencies, perform one pass and resolve the chosen project variant. This is used later by the caller to complete the project initialization before resolving the final Element() and Source() objects.
* _loader.py: Patching up failing variant resolutionsTristan Van Berkom2017-07-171-43/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains some good refactors to the variant resolution code and provides a bit better context on variant resolution failures. However the patch is still imperfect, variant resolution code needs a more solid algorithm. Currently this is fixed by adding an additional hash table of the expected variants imposed by the parent when recursing, however it will still likely fail when variant disagreements occur deep in nested branches, since we still only ever return the first valid variant for a recursion. I have another branch which resolves variants perfectly, but it does so by always returning every valid configuration through the recursion algorithm and then choosing the first valid configuration once recursion completes (thus satisfying the rule which prioritizes the first variant of any ambivalent dependencies). The problem with the perfect algorithm is that complexity is exponential and takes minutes to resolve small pipelines of only 50 elements with around 15 elements with two variants each. NOTE: I suspect the current approach can be made to produce the expected result 100% of the time with decent complexity, if we can change the current algorithm to recurse through the graph in a bredth first manner, instead of depth first.
* _loader.py: Fixed variant priority in variant resolutionTristan Van Berkom2017-07-171-0/+4
| | | | | | | | | Previously, the loader was incorrectly settling on the *last* valid variant instead of the *first* valid configuration. This is incorrect and violates the rule that the first variant of an element is chosen when depended on ambivalently, and that the first variant without disagreement will always be chosen.
* _loader.py: Raise LoadError() for invalid variant requests.Tristan Van Berkom2017-07-171-35/+60
| | | | | | | | | | | | | | | | | | | | o When the toplevel variant does not exist in the loaded target, raise the LoadError o When any element requests a nonexistent variant on any of it's dependencies, raise the LoadError o Internal Dependency objects now track the provenance from whence they were declare, to allow more accurate error reporting for invalid variants via dependencies. Beyond this, we also remove the Loader's self.loaded_files attribute and a bogus assertion that two elements can claim the same name, instead just rely on a single map of loaded elements to protect against reentrancy. This was a legacy leftover from an initial implementation which allowed elements to be named, and as such we were treating loaded files and loaded elements separately.
* _loader.py / _metaelement.py: Pass along the selected variantTristan Van Berkom2017-07-171-1/+3
| | | | Dont lose the selected variant of elements, pass them along to the metaelement at load time.
* Add --host-arch and --target-arch, and 'host-arches' conditionalSam Thursfield2017-07-061-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command adds initial cross-compilation support to BuildStream. It has been tested against a converted version of the Baserock compiler bootstrap and used to cross build sysroots for armv8l64 and ppc64l from an x86_64 host. For example, to build a sysroot for ARM v8 64-bit you can do this: bst build --target-arch=armv8b64 gnu-toolchain/stage2.bst This would cause the adapted Baserock definitions to produce a stage1 simple cross compiler that runs on the native architecture and produces armv8b64 binaries, and then cross build a stage2 sysroot that executes on armv8b64. Currently the --host-arch option does nothing of use. It will one day enable host-incompatible builds using a QEMU-powered cross sandbox. The `--arch=` option is now shorthand for `--host-arch= --target-arch=`. Elements have 2 new variables available, %{bst-host-arch} and %{bst-target-arch}. The 'arches' conditional now follows %{bst-target-arch}, while the new 'host-arches' conditional follows %{bst-host-arch}. All of --arch, --host-arch and --target-arch default to the output of `uname -a`. There's no magic here that would make all BuildStream elements suddenly able to cross compile. It is up to an individual element to support this by honouring %{bst-target-arch} in whatever way makes sense.
* _loader.py: Fixed Source parsing to report errors betterTristan Van Berkom2017-06-191-1/+5
|
* Refactor: Untangling element/source namesTristan Van Berkom2017-03-181-17/+12
| | | | | | | | | | | | | | | | | | | | | | | o The metaelements and metasources now carry the name, the loader resolves source names now. o Element/Source factories dont require a name anymore as they are already in the meta objects o Pipeline no longer composes names o Element.name is now the original project relative filename, this allows plugins to identify that name in their dependencies, allowing one to express configuration which identifies elements by the same name that the user used in the dependencies. o Removed plugin._get_display_name() in favor of the plugin.name o Added Element.normal_name, for the cases where we need to have a normalized name for creating directories and log files o Updated frontend and test cases and all callers to use the new naming
* Fixing permissions, some random python files became executableTristan Van Berkom2017-03-061-0/+0
|
* _metaelement.py / _loader.py: Meta elements now hold provenanceTristan Van Berkom2017-02-271-1/+2
| | | | | | It was incorrect to use the meta.config for provenance, since it may be incorrect when the element itself uses only default configuration.
* _loader.py: Added ticker functionTristan Van Berkom2017-02-271-5/+10
| | | | So the user has some feedback while we load files.
* _loader.py: Use Mapping in _yaml.node_get()Tristan Van Berkom2017-02-261-8/+9
| | | | | This is more accurate than 'dict', it can be a ChainMap sometimes which will not be a 'dict'
* _loader.py: There is no need to deepcopy the LoadElement dataTristan Van Berkom2017-02-261-2/+1
| | | | Seems I had this here from pure paranoia, no need to copy this data at all.
* _loader.py: Added writable parameter to Loader.load()Tristan Van Berkom2017-02-261-6/+10
| | | | | Avoids the deep copy in _yaml.load() unless writable is True, use writable=True if you need to later serialize loaded sources.
* _loader.py: Fix / optimize dependency sorting.Tristan Van Berkom2017-02-251-18/+16
| | | | | | | This was working but very expensive, now we cache a flat dictionary of each element's dependencies once in order to query deep dependencies for the sort, this memory will anyway be let go after the load process completes.
* _loader.py: Use the profiler for profiling parts of the load sequenceTristan Van Berkom2017-02-231-0/+9
|
* _loader.py: Use full paths for identifying elementsTristan Van Berkom2017-02-221-2/+2
| | | | Dont enforce unique basenames.
* _loader.py: Sort direct element dependencies by dependency.Tristan Van Berkom2017-02-221-8/+91
| | | | | | | This ensures that whenever Element.dependencies() is used, the correct staging / building order is always reported by the generator, without requiring multiple topological sorts to occur throughout the build process.
* _loader.py: Fixed expensive circular dependency checksTristan Van Berkom2017-02-191-12/+30
| | | | | | | | | | | The last circular dependency checker was insanely convoluted and also insanely expensive. The dependency check is still performed at the correct place: after resolving the variants and knowing what the dependencies will be for the pipeline, and just before returning LoadElements. Dependency check is now also performed in linear time.
* Remove apostrophes from grammatically incorrect instances of "it's"Paul Sherwood2017-02-111-2/+2
|
* _loader.py: Expose resolve_arch() function to share with project.pyTristan Van Berkom2017-02-021-28/+32
|
* _loader.py: Load new environment-nocache listTristan Van Berkom2017-01-271-0/+2
| | | | | | This flags certain environment variables as being irrelevant in cache key resolution, allowing one to set verbosity or max jobs and such without effecting cache keys.
* _loader.py: Load the public domain data and feed it to the MetaElement ↵Tristan Van Berkom2017-01-251-1/+3
| | | | constructor
* _loader.py: Use _yaml.node_get() when constructing meta elementTristan Van Berkom2017-01-071-3/+3
|
* _metaelement.py: Now carries variables and environmentsTristan Van Berkom2017-01-061-1/+6
| | | | | The user may specify overrides for the environment or for variables in the element configurations.
* _loader.py: Sort dependencies alphabetically when returning MetaElementsTristan Van Berkom2016-12-311-1/+3
|
* _loader.py: Some fixes in recursion hereTristan Van Berkom2016-12-311-58/+50
| | | | | | | | | | | | | | o Fixed false positives of circular dependency errors, moved circular dependency detection outside of variant resolution o Simplified code for variant resolution, dont ever allow more than one of the same element/variant configuration exist in the same pool, silently continue in the case of a match or raise VariantError otherwise, the algorithm will eventually try a matching variant itself. o Removed another redundant loop hunting for variant errors prematurely: no need to check if dependencies of all configurations have variant mismatches, if something depends on the element, it will be traversed.
* Removed code and tests related to stacks and includes.Tristan Van Berkom2016-12-191-240/+35
| | | | | Stacks should still exist but they are purely an element implementation detail.
* Loader: Handle/strip the Source 'directory' option from source configurationTristan Van Berkom2016-12-151-1/+12
| | | | | The directory is available on all sources and handled by the core, lets construct the MetaSource with the directory already resolved.
* MetaElement: Add separate list for build dependenciesJürg Billeter2016-12-121-1/+4
|
* Loader: Parse dependency types 'build' and 'runtime'Jürg Billeter2016-12-121-3/+18
|
* _loader.py: Pass relative filename to _yaml.load()Tristan Van Berkom2016-12-111-4/+3
|