mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
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.
This commit is contained in:
parent
a18e76bd85
commit
45ca8cf134
@ -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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user