Changeset 6444d58 in rtems-source-builder for source-builder/sb/build.py


Ignore:
Timestamp:
Jul 20, 2015, 3:49:42 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.9, 5, master
Children:
f936478
Parents:
fba2549
Message:

Canandian Cross Compiling and RTEMS 3rd party package building Fixes.

The change fixes installing for RTEMS 3rd Party packages where the
RSB considered them Canadian Cross Compiling (Cxc). Fixing the
Cxc issue broke real Cxc builds. The change corrects the issue of
macros being changed in the Cxc and the prep data not being udpated.
The configuration is loaded again after the updated macros. The
macros are also copied and restored to ensure a clean stable base.

The change also introduces --rtems-tools and --rtems-bsp to align
the command line with the waf configure process or RTEMS application.

File:
1 edited

Legend:

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

    rfba2549 r6444d58  
    2323#
    2424
     25import copy
    2526import getopt
    2627import glob
     
    117118        try:
    118119            self.opts = opts
    119             if macros is None:
    120                 self.macros = opts.defaults
    121             else:
    122                 self.macros = macros
     120            self.init_name = name
     121            self.init_macros = macros
     122            self.config = None
    123123            self.create_tar_files = create_tar_files
    124124            log.notice('config: ' + name)
     125            self.set_macros(macros)
    125126            self.config = config.file(name, opts, self.macros)
    126127            self.script = script()
     
    137138            raise
    138139
     140    def copy_init_macros(self):
     141        return copy.copy(self.init_macros)
     142
     143    def copy_macros(self):
     144        return copy.copy(self.macros)
     145
     146    def set_macros(self, macros):
     147        if macros is None:
     148            self.macros = copy.copy(opts.defaults)
     149        else:
     150            self.macros = copy.copy(macros)
     151        if self.config:
     152            self.config.set_macros(self.macros)
     153
    139154    def rmdir(self, rmpath):
    140155        log.output('removing: %s' % (path.host(rmpath)))
     
    152167        _build = self.config.expand('%{_build}')
    153168        _target = self.config.expand('%{_target}')
    154         return self.config.defined('%{allow_cxc}') and \
    155             len(_host) and len(_build) and (_target) and \
    156             _host != _build and _host != _target
     169        _allowed = self.config.defined('%{allow_cxc}')
     170        if len(_host) and len(_build) and (_target) and \
     171           _allowed and _host != _build and _host != _target:
     172            return True
     173        return False
     174
     175    def installable(self):
     176        _host = self.config.expand('%{_host}')
     177        _build = self.config.expand('%{_build}')
     178        _canadian_cross = self.canadian_cross()
     179        if self.macros.get('_disable_installing') and \
     180           self.config.expand('%{_disable_installing}') == 'yes':
     181            _disable_installing = True
     182        else:
     183            _disable_installing = False
     184        _no_install = self.opts.no_install()
     185        log.trace('_build: installable: host=%s build=%s ' \
     186                  'no-install=%r Cxc=%r disable_installing=%r disabled=%r' % \
     187                  (_host, _build, _no_install, _canadian_cross, _disable_installing, \
     188                   self.disabled()))
     189        return len(_host) and len(_build) and \
     190            not self.disabled() and \
     191            not _disable_installing and \
     192            not _canadian_cross
    157193
    158194    def source(self, name):
     
    314350                    if args[0] == '%setup':
    315351                        if len(args) == 1:
    316                             raise error.general('invalid %%setup directive: %s' % (' '.join(args)))
     352                            raise error.general('invalid %%setup directive: %s' % \
     353                                                (' '.join(args)))
    317354                        if args[1] == 'source':
    318355                            self.source_setup(package, args[1:])
     
    372409    def build_package(self, package):
    373410        if self.canadian_cross():
     411            if not self.config.defined('%{allow_cxc}'):
     412                raise error.general('Canadian Cross is not allowed')
    374413            self.script.append('echo "==> Candian-cross build/target:"')
    375414            self.script.append('SB_CXC="yes"')
     
    403442        return packages['main']
    404443
     444    def reload(self):
     445        self.config.load(self.init_name)
     446
    405447    def make(self):
    406448        package = self.main_package()
     
    411453                name = package.name()
    412454                if self.canadian_cross():
    413                     log.notice('package: (Cxc) %s' % (name))
     455                    cxc_label = '(Cxc) '
    414456                else:
    415                     log.notice('package: %s' % (name))
    416                     log.trace('---- macro maps %s' % ('-' * 55))
    417                     log.trace('%s' % (str(self.config.macros)))
    418                     log.trace('-' * 70)
     457                    cxc_label = ''
     458                log.notice('package: %s%s' % (cxc_label, name))
     459                log.trace('---- macro maps %s' % ('-' * 55))
     460                log.trace('%s' % (str(self.config.macros)))
     461                log.trace('-' * 70)
    419462                self.script.reset()
    420463                self.script.append(self.config.expand('%{___build_template}'))
     
    427470                    log.output('write script: ' + sn)
    428471                    self.script.write(sn)
    429                     if self.canadian_cross():
    430                         log.notice('building: (Cxc) %s' % (name))
    431                     else:
    432                         log.notice('building: %s' % (name))
     472                    log.notice('building: %s%s' % (cxc_label, name))
    433473                    self.run(sn)
    434474            except error.general, gerr:
Note: See TracChangeset for help on using the changeset viewer.