Changeset cb12e48 in rtems-source-builder for source-builder/sb/

Apr 9, 2013, 3:51:43 AM (8 years ago)
Chris Johns <chrisj@…>
4.10, 4.11, 4.9, 5, master

Refactor defaults, macros and options.

To support building snapshots and pre-release source the defaults
has been refactored. The defaults have been moved to a stand alone
file and a module added. This modile abstracts the
old default dictionary turning it into a class. The macros
class can load macros from a file therefore the defaults have
been moved to a stand alone file.

The use of defaults has been removed from the project. The only
case where it is used in the options where the defaults are read
from a file. Macros are used everywhere now.

The has been moved to the and the separate
options and defaults values has been moved to a new pattern. When
constructing an object that needs macros and options if the macros
passed in is None the defaults from the options are used. This makes
it clear when the defaults are being used or when a modified set of
macros is being used.

The macros class support maps. The default is 'global' and where all
the defaults reside and where configuratiion file changes end up.
Maps allow macros to be read from a file and override the values
being maintained in the 'global' map. Reading a macro first checks
the map and if not present checks the 'global' map.

The addition of maps to the macros provides the base to support
snapshots and pre-release testing with standard configurations.
This functionality needs to be added. It works by letting to
specify a snapshot with:

source0: none, override, 'my-dist.tar.bz2'

and it will be used rather the value from the standard configuration.
With a build set you need to also specify the package these macros
are for. The maps provide this.

1 edited


  • source-builder/sb/

    r530a938 rcb12e48  
    2424import os
    26 import defaults
    2726import error
    2827import execute
     28import options
    2929import path
    4343        return exit_code, output
    45     def __init__(self, _path, _opts, _defaults):
     45    def __init__(self, _path, opts, macros = None):
    4646        self.path = _path
    47         self.opts = _opts
    48         self.default = _defaults
    49         self.git = _opts.expand('%{__git}', _defaults)
     47        self.opts = opts
     48        if macros is None:
     49            self.macros = opts.defaults
     50        else:
     51            self.macros = macros
     52        self.git = self.macros.expand('%{__git}')
    5154    def git_version(self):
    121124if __name__ == '__main__':
    122125    import sys
    123     _opts, _defaults = defaults.load(sys.argv)
    124     g = repo('.', _opts, _defaults)
     126    opts = options.load(sys.argv)
     127    g = repo('.', opts)
    125128    print g.git_version()
    126129    print g.valid()
Note: See TracChangeset for help on using the changeset viewer.