summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/config.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-03-02 16:08:05 +1100
committerChris Johns <chrisj@rtems.org>2013-03-02 16:08:05 +1100
commit45ca8cf134648ee03316a6da7477dd4fe61c19bc (patch)
tree3e7c637d7c5d2146db907a9ae5d48f5c0d4e2bc3 /source-builder/sb/config.py
parentIf %setup -c then always create and change into the directory. (diff)
downloadrtems-source-builder-45ca8cf134648ee03316a6da7477dd4fe61c19bc.tar.bz2
Conditional macros are defined for true else must be 0 for false.
The RPM spec file will return value for %{?macro:value} if the macro is defined. This means you need to: %if %something %define macro 1 %else %undefine macro %endif which means you have to have more complex tests to check for the macro and its value. Therefore we support defined as true and defined and 0 as false.
Diffstat (limited to 'source-builder/sb/config.py')
-rw-r--r--source-builder/sb/config.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 24c00ab..a082522 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -380,9 +380,10 @@ class file:
if m.startswith('%{?'):
istrue = False
if mn in self.defines:
+ # If defined and 0 then it is false.
istrue = _check_bool(self.defines[mn])
if istrue is None:
- istrue = False
+ istrue = True
if colon >= 0 and istrue:
s = s.replace(m, m[start + colon + 1:-1])
expanded = True
@@ -393,7 +394,7 @@ class file:
isfalse = True
if mn in self.defines:
istrue = _check_bool(self.defines[mn])
- if istrue is not None and istrue == True:
+ if istrue is None or istrue == True:
isfalse = False
if colon >= 0 and isfalse:
s = s.replace(m, m[start + colon + 1:-1])