Changeset 5c7b1ef in rtems-source-builder


Ignore:
Timestamp:
Apr 13, 2013, 12:34:47 AM (6 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
376aabf
Parents:
014bfa9
Message:

Package data into macro, sources from macro and a bug fix.

Package descritions and info and now always added to macros.

Hack to get the source in macros into the source this. This needs
to move to the package class and will soon.

Fix a bug where the old defines was still referenced.

File:
1 edited

Legend:

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

    r014bfa9 r5c7b1ef  
    8282        return s
    8383
     84    def _macro_override(self, info, macro):
     85        '''See if a macro overrides this setting.'''
     86        overridden = self.config.macros.overridden(macro)
     87        if overridden:
     88            return self.config.macros.expand(macro)
     89        return info
     90
    8491    def directive_extend(self, dir, data):
    8592        if dir not in self.directives:
     
    8895            data[i] = data[i].strip()
    8996        self.directives[dir].extend(data)
     97        self.config.macros[dir] = '\n'.join(self.directives[dir])
    9098
    9199    def info_append(self, info, data):
     
    93101            self.infos[info] = []
    94102        self.infos[info].append(data)
     103        self.config.macros[info] = '\n'.join(self.infos[info])
    95104
    96105    def get_info(self, info, expand = True):
     
    135144        info = self.find_info('name')
    136145        if info:
    137             return info[0]
    138         return self._name
     146            n = info[0]
     147        else:
     148            n = self._name
     149        return self._macro_override(n, 'name')
    139150
    140151    def summary(self):
     
    169180
    170181    def sources(self):
    171         return self.extract_info('source');
     182        return self.extract_info('source')
    172183
    173184    def patches(self):
     
    206217                re.compile('%configure'),
    207218                re.compile('%source[0-9]*'),
    208                 re.compile('%patch[0-9]*') ]
     219                re.compile('%patch[0-9]*'),
     220                re.compile('%select') ]
    209221
    210222    def __init__(self, name, opts, macros = None):
     
    459471        return self._shell(s)
    460472
     473    def _select(self, config, ls):
     474        if len(ls) != 2:
     475            self._warning('invalid select statement')
     476        else:
     477            r = self.macros.set_read_map(ls[1])
     478            if self.opts.trace():
     479                print '_select: ', r, ls[1], self.macros.maps()
     480
    461481    def _define(self, config, ls):
    462482        if len(ls) <= 1:
     
    659679                            name = self.name + '-' + ls[1]
    660680                        return ('package', name)
     681                elif ls[0] == '%select':
     682                    if isvalid:
     683                        self._select(config, ls)
    661684                elif ls[0] == '%error':
    662685                    if isvalid:
     
    734757        if _package not in self._packages:
    735758            self._packages[_package] = package(_package,
    736                                                self.define('%{_arch}'))
     759                                               self.define('%{_arch}'),
     760                                               self)
    737761        self.package = _package
    738762
     
    878902                            if info is not None:
    879903                                self._info_append(info, info_data)
    880                                 # It seems like the info's also appear as
    881                                 # defines or can be accessed via macros.
    882                                 self._define(None, ('', info, info_data))
    883904                            else:
    884905                                self._warning("invalid format: '%s'" % (info_data[:-1]))
     
    926947
    927948    def macro(self, name):
    928         if name.lower() in self.defines:
    929             return self.defines[name.lower()]
     949        if name in self.macros:
     950            return self.macros[name]
    930951        raise error.general('macro "%s" not found' % (name))
    931952
Note: See TracChangeset for help on using the changeset viewer.