[rtems-source-builder commit] sb: Fix %if logical OP parsing.

Chris Johns chrisj at rtems.org
Fri Mar 18 02:40:00 UTC 2016


Module:    rtems-source-builder
Branch:    master
Commit:    8bde72706504c5df945f2bb08d9805f9e8526e69
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=8bde72706504c5df945f2bb08d9805f9e8526e69

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Mar 18 10:45:28 2016 +1100

sb: Fix %if logical OP parsing.

Updates #2655.

---

 source-builder/sb/config.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 732239f..4c26714 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -781,20 +781,26 @@ class file:
                 elif cls[0] == '&&':
                     join_op = 'and'
                 cls = cls[1:]
+                log.trace('config: %s: _if: joining: %s' % (self.name, join_op))
             ori = 0
             andi = 0
             i = len(cls)
             if '||' in cls:
                 ori = cls.index('||')
+                log.trace('config: %s: _if: OR found at %i' % (self.name, ori))
             if '&&' in cls:
                 andi = cls.index('&&')
+                log.trace('config: %s: _if: AND found at %i' % (self.name, andi))
             if ori > 0 or andi > 0:
-                if ori < andi:
+                if ori == 0:
+                    i = andii
+                elif andi == 0:
                     i = ori
-                else:
+                elif ori < andi:
                     i = andi
-                if ori == 0:
+                else:
                     i = andi
+                log.trace('config: %s: _if: next OP found at %i' % (self.name, i))
             ls = cls[:i]
             if len(ls) == 0:
                 self._error('invalid if expression: ' + reduce(add, sls, ''))



More information about the vc mailing list