Changeset 45ca8cf in rtems-source-builder


Ignore:
Timestamp:
Mar 2, 2013, 5:08:05 AM (7 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
d7e4900
Parents:
a18e76b
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/config.py

    ra18e76b r45ca8cf  
    381381                            istrue = False
    382382                            if mn in self.defines:
     383                                # If defined and 0 then it is false.
    383384                                istrue = _check_bool(self.defines[mn])
    384385                                if istrue is None:
    385                                     istrue = False
     386                                    istrue = True
    386387                            if colon >= 0 and istrue:
    387388                                s = s.replace(m, m[start + colon + 1:-1])
     
    394395                            if mn in self.defines:
    395396                                istrue = _check_bool(self.defines[mn])
    396                                 if istrue is not None and istrue == True:
     397                                if istrue is None or istrue == True:
    397398                                    isfalse = False
    398399                            if colon >= 0 and isfalse:
Note: See TracChangeset for help on using the changeset viewer.