You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:38:16 UTC

[buildstream] 10/14: _loader.py: Fixed variant priority in variant resolution

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch variants-slow-functional-loopy
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 498e24db85bfb9c83fd8b184b8228284a0c1eaf8
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Sat Jul 15 19:21:04 2017 +0900

    _loader.py: Fixed variant priority in variant resolution
    
    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.
---
 buildstream/_loader.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/buildstream/_loader.py b/buildstream/_loader.py
index 17db17f..0592c8a 100644
--- a/buildstream/_loader.py
+++ b/buildstream/_loader.py
@@ -655,6 +655,10 @@ class Loader():
                 # element configurations
                 continue
 
+            # If we've reached here without any disagreement, then we've found the
+            # first valid configuration, which should take priority over any others.
+            break
+
         # If unable to find any valid configuration, raise a VariantDisagreement
         if not accum_pool:
             raise last_error