Changeset efc4f09 in rtems-tools


Ignore:
Timestamp:
12/09/15 09:08:19 (8 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 5, master
Children:
8b49f73
Parents:
c9fa179
Message:

Add release versioning support.

Support a top level VERSION file that defines an RTEMS release.

Fix the install of the python modules including thertems-test.

Update the git python module to the RSB version. Fix the options to
not call clean and to call dirty.

Update the version python module.

Fix the rtld C++ support to the VERSION file and the top level waf
script.

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rc9fa179 refc4f09  
    99.lock-waf*
    1010build
     11VERSION
  • linkers/rtems-ld.cpp

    rc9fa179 refc4f09  
    213213        case 'V':
    214214          std::cout << "rtems-ld (RTEMS Linker) " << rld::version ()
     215                    << ", RTEMS revision " << rld::rtems::version ()
    215216                    << std::endl;
    216217          ::exit (0);
  • linkers/rtems-ra.cpp

    rc9fa179 refc4f09  
    4343#include <rld-process.h>
    4444#include <rld-resolver.h>
     45#include <rld-rtems.h>
    4546
    4647#ifndef HAVE_KILL
     
    184185        case 'V':
    185186          std::cout << "rtems-ra (RTEMS Linker) " << rld::version ()
     187                    << ", RTEMS revision " << rld::rtems::version ()
    186188                    << std::endl;
    187189          ::exit (0);
  • linkers/rtems-rapper.cpp

    rc9fa179 refc4f09  
    4545#include <rld-process.h>
    4646#include <rld-rap.h>
     47#include <rld-rtems.h>
    4748
    4849#include <rtems-utils.h>
     
    11731174        case 'V':
    11741175          std::cout << "rtems-rap (RTEMS RAP Manager) " << rld::version ()
     1176                    << ", RTEMS revision " << rld::rtems::version ()
    11751177                    << std::endl;
    11761178          ::exit (0);
  • linkers/rtems-syms.cpp

    rc9fa179 refc4f09  
    4444#include <rld-process.h>
    4545#include <rld-symbols.h>
     46#include <rld-rtems.h>
    4647
    4748#ifndef HAVE_KILL
     
    330331        case 'V':
    331332          std::cout << "rtems-syms (RTEMS Symbols) " << rld::version ()
     333                    << ", RTEMS revision " << rld::rtems::version ()
    332334                    << std::endl;
    333335          ::exit (0);
  • linkers/rtems-tld.cpp

    rc9fa179 refc4f09  
    17371737        case 'V':
    17381738          std::cout << "rtems-trace-ld (RTEMS Trace Linker) " << rld::version ()
     1739                    << ", RTEMS revision " << rld::rtems::version ()
    17391740                    << std::endl;
    17401741          ::exit (0);
  • linkers/wscript

    rc9fa179 refc4f09  
    3434import sys
    3535
    36 version_major = 1
    37 version_minor = 0
    38 version_revision = 0
    39 
    4036def options(opt):
    4137    opt.load('compiler_c')
     
    4642    conf.load('compiler_cxx')
    4743
    48     conf.env.C_OPTS = conf.options.c_opts.split(',')
    49     conf.env.RTEMS_VERSION = conf.options.rtems_version
    5044    conf.write_config_header('config.h')
    5145
     
    8680
    8781    #
     82    # The list of defines
     83    #
     84    defines = ['HAVE_CONFIG_H=1',
     85               'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
     86               'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)]
     87
     88    #
    8889    # Build the linker.
    8990    #
    9091    bld.program(target = 'rtems-ld',
    9192                source = ['rtems-ld.cpp'],
    92                 defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
     93                defines = defines,
    9394                includes = ['.'] + conf['includes'],
    9495                cflags = conf['cflags'] + conf['warningflags'],
     
    102103    bld.program(target = 'rtems-ra',
    103104                source = ['rtems-ra.cpp'],
    104                 defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
     105                defines = defines,
    105106                includes = ['.'] + conf['includes'],
    106107                cflags = conf['cflags'] + conf['warningflags'],
     
    114115    bld.program(target = 'rtems-tld',
    115116                source = ['rtems-tld.cpp'],
    116                 defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
     117                defines = defines,
    117118                includes = ['.'] + conf['includes'],
    118119                cflags = conf['cflags'] + conf['warningflags'],
     
    140141    bld.program(target = 'rtems-syms',
    141142                source = ['rtems-syms.cpp'],
    142                 defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
     143                defines = defines,
    143144                includes = ['.'] + conf['includes'],
    144145                cflags = conf['cflags'] + conf['warningflags'],
     
    152153    bld.program(target = 'rtems-rap',
    153154                source = ['rtems-rapper.cpp'],
    154                 defines = ['HAVE_CONFIG_H=1', 'RTEMS_VERSION=' + bld.env.RTEMS_VERSION],
     155                defines = defines,
    155156                includes = ['.'] + conf['includes'],
    156157                cflags = conf['cflags'] + conf['warningflags'],
  • rtemstoolkit/git.py

    rc9fa179 refc4f09  
    11#
    22# RTEMS Tools Project (http://www.rtems.org/)
    3 # Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
     3# Copyright 2010-2015 Chris Johns (chrisj@rtems.org)
    44# All rights reserved.
    55#
    66# This file is part of the RTEMS Tools package in 'rtems-tools'.
    7 #
    8 # Redistribution and use in source and binary forms, with or without
    9 # modification, are permitted provided that the following conditions are met:
    107#
    118# 1. Redistributions of source code must retain the above copyright notice,
     
    6259        return exit_code, output
    6360
    64     def __init__(self, _path, opts, macros = None):
     61    def __init__(self, _path, opts = None, macros = None):
    6562        self.path = _path
    6663        self.opts = opts
    67         if macros is None:
     64        if macros is None and opts is not None:
    6865            self.macros = opts.defaults
    6966        else:
    7067            self.macros = macros
    71         self.git = self.macros.expand('%{__git}')
     68        if self.macros is None:
     69            self.git = 'git'
     70        else:
     71            self.git = self.macros.expand('%{__git}')
    7272
    7373    def git_version(self):
     
    8787        ec, output = self._run(['fetch'], check = True)
    8888
     89    def merge(self):
     90        ec, output = self._run(['merge'], check = True)
     91
    8992    def pull(self):
    9093        ec, output = self._run(['pull'], check = True)
     
    105108    def checkout(self, branch = 'master'):
    106109        ec, output = self._run(['checkout', branch], check = True)
     110
     111    def submodule(self, module):
     112        ec, output = self._run(['submodule', 'update', '--init', module], check = True)
     113
     114    def clean(self, args = []):
     115        if type(args) == str:
     116            args = [args]
     117        ec, output = self._run(['clean'] + args, check = True)
    107118
    108119    def status(self):
     
    113124                state = 'none'
    114125                for l in output.split('\n'):
    115                     if l.startswith('# On branch '):
    116                         _status['branch'] = l[len('# On branch '):]
    117                     elif l.startswith('# Changes to be committed:'):
     126                    if l.startswith('# '):
     127                        l = l[2:]
     128                    if l.startswith('On branch '):
     129                        _status['branch'] = l[len('On branch '):]
     130                    elif l.startswith('Changes to be committed:'):
    118131                        state = 'staged'
    119                     elif l.startswith('# Changes not staged for commit:'):
     132                    elif l.startswith('Changes not staged for commit:'):
    120133                        state = 'unstaged'
    121                     elif l.startswith('# Untracked files:'):
     134                    elif l.startswith('Untracked files:'):
    122135                        state = 'untracked'
    123                     elif state != 'none' and l[0] == '#':
    124                         if l.strip() != '#' and not l.startswith('#   ('):
    125                             if state not in _status:
    126                                 _status[state] = []
    127                             l = l[1:]
    128                             if ':' in l:
    129                                 l = l.split(':')[1]
    130                             _status[state] += [l.strip()]
     136                    elif l.startswith('HEAD detached'):
     137                        state = 'detached'
     138                    elif state != 'none' and len(l.strip()) != 0:
     139                        if l[0].isspace():
     140                            l = l.strip()
     141                            if l[0] != '(':
     142                                if state not in _status:
     143                                    _status[state] = []
     144                                l = l[1:]
     145                                if ':' in l:
     146                                    l = l.split(':')[1]
     147                                _status[state] += [l.strip()]
    131148        return _status
    132149
    133     def clean(self):
     150    def dirty(self):
    134151        _status = self.status()
    135         return len(_status) == 1 and 'branch' in _status
     152        return not (len(_status) == 1 and 'branch' in _status)
    136153
    137154    def valid(self):
  • rtemstoolkit/options.py

    rc9fa179 refc4f09  
    354354            repo_valid = '1'
    355355            repo_head = repo.head()
    356             repo_clean = repo.clean()
     356            repo_clean = not repo.dirty()
    357357            repo_id = repo_head
    358358            if not repo_clean:
  • rtemstoolkit/rld-rtems.cpp

    rc9fa179 refc4f09  
    2525  namespace rtems
    2626  {
    27     static std::string _version = "4.12";
     27    static std::string _version = RTEMS_VERSION;
    2828    static std::string _path;
    2929    static std::string _arch_bsp;
  • rtemstoolkit/rld.cpp

    rc9fa179 refc4f09  
    3333#include <rld.h>
    3434
    35 #define RLD_VERSION_MAJOR   (1)
    36 #define RLD_VERSION_MINOR   (0)
    37 #define RLD_VERSION_RELEASE (0)
    38 
    3935namespace rld
    4036{
     
    203199  version ()
    204200  {
    205     std::string v = (rld::to_string (RLD_VERSION_MAJOR) + '.' +
    206                      rld::to_string (RLD_VERSION_MINOR) + '.' +
    207                      rld::to_string (RLD_VERSION_RELEASE));
    208     return v;
     201    return RTEMS_RELEASE;
    209202  }
    210203
     
    212205  rtems_version ()
    213206  {
    214     return rld::to_string (RTEMS_VERSION);
     207    return RTEMS_VERSION;
    215208  }
    216209
  • rtemstoolkit/version.py

    rc9fa179 refc4f09  
    11#
    22# RTEMS Tools Project (http://www.rtems.org/)
    3 # Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
     3# Copyright 2010-2015 Chris Johns (chrisj@rtems.org)
    44# All rights reserved.
    55#
     
    3030
    3131#
    32 # Manage paths locally. The internally the path is in Unix or shell format and
    33 # we convert to the native format when performing operations at the Python
    34 # level. This allows macro expansion to work.
     32# To release RTEMS Tools create a git archive and then add a suitable VERSION
     33# file to the top directory.
    3534#
    3635
    37 major = 0
    38 minor = 0
    39 revision = 0
     36import sys
     37
     38import error
     39import git
     40import path
     41
     42#
     43# Default to an internal string.
     44#
     45_version_str = '4.12.not_release'
     46_released = False
     47_git = False
     48
     49def _at():
     50    return path.dirname(__file__)
     51
     52def _load_released_version():
     53    global _released
     54    global _version_str
     55    at = _at()
     56    for ver in [at, path.join(at, '..')]:
     57        if path.exists(path.join(ver, 'VERSION')):
     58            try:
     59                with open(path.join(ver, 'VERSION')) as v:
     60                    _version_str = v.readline().strip()
     61                v.close()
     62                _released = True
     63            except:
     64                raise error.general('Cannot access the VERSION file')
     65    return _released
     66
     67def _load_git_version():
     68    global _git
     69    global _version_str
     70    repo = git.repo(_at())
     71    if repo.valid():
     72        head = repo.head()
     73        if repo.dirty():
     74            modified = ' modified'
     75        else:
     76            modified = ''
     77        _version_str = '%s (%s%s)' % (_version_str, head[0:12], modified)
     78        _git = True
     79    return _git
     80
     81def released():
     82    return _load_released_version()
     83
     84def version_control():
     85    return _load_git_version()
    4086
    4187def str():
    42     return '%d.%d.%d'% (major, minor, revision)
     88    if not _released and not _git:
     89        if not _load_released_version():
     90            _load_git_version()
     91    return _version_str
    4392
    4493if __name__ == '__main__':
    45     print('major = %d' % (major))
    46     print('minor = %d' % (minor))
    47     print('revision = %d' % (revision))
    48     print('Version: %s' % (str()))
     94    print 'Version: %s' % (str())
  • rtemstoolkit/wscript

    rc9fa179 refc4f09  
    3434import sys
    3535
    36 version_major = 1
    37 version_minor = 0
    38 version_revision = 0
    39 
    4036#
    4137# Waf system setup. Allow more than one build in the same tree.
     
    6056                  features = 'c', mandatory = False)
    6157    conf.write_config_header('config.h')
     58
     59    conf.load('python')
     60    conf.check_python_version((2,6,6))
     61    conf.env['PYO'] = 0
     62    conf.env['PYC'] = 0
    6263
    6364def build(bld):
     
    126127              source = rld_source + rtems_utils + compression,
    127128              defines = ['HAVE_CONFIG_H=1',
    128                          'RTEMS_VERSION=' + bld.env.RTEMS_VERSION,
     129                         'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
     130                         'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE),
    129131                         'FASTLZ_LEVEL=1'],
    130132              includes = ['.'] + conf['includes'],
     
    154156                  'version.py',
    155157                  'windows.py'],
    156         install_path = '${PREFIX}/share/rtems/rtemstoolkit')
     158        install_path = '${PREFIX}/share/rtems')
    157159
    158160def rebuild(ctx):
  • tester/rt/test.py

    rc9fa179 refc4f09  
    4040from rtemstoolkit import path
    4141from rtemstoolkit import stacktraces
     42from rtemstoolkit import version
    4243
    4344import bsps
     
    4647import options
    4748import report
    48 import version
    4949import fnmatch
    5050
     
    202202                            optargs = optargs,
    203203                            command_path = command_path)
    204         log.notice('RTEMS Testing - Tester, v%s' % (version.str()))
     204        log.notice('RTEMS Testing - Tester, %s' % (version.str()))
    205205        if opts.find_arg('--list-bsps'):
    206206            bsps.list(opts)
  • tester/rtems-test

    rc9fa179 refc4f09  
    22#
    33# RTEMS Tools Project (http://www.rtems.org/)
    4 # Copyright 2013 Chris Johns (chrisj@rtems.org)
     4# Copyright 2013, 2015 Chris Johns (chrisj@rtems.org)
    55# All rights reserved.
    66#
     
    3434parent = os.path.dirname(base)
    3535rtems = os.path.join(parent, 'share', 'rtems')
    36 tester = os.path.join(parent, 'share', 'rtems', 'tester')
    37 sys.path = [parent, rtems, tester] + sys.path
     36sys.path = [rtems, os.path.join(rtems, 'tester')] + sys.path
    3837
    3938try:
  • tester/wscript

    rc9fa179 refc4f09  
    4343    conf.load('python')
    4444    conf.check_python_version((2,6,6))
     45    conf.env['PYO'] = 0
     46    conf.env['PYC'] = 0
    4547
    4648def build(bld):
     
    6163                  'rt/test.py',
    6264                  'rt/version.py'],
    63         install_path = '${PREFIX}/share/rtems/tester')
     65        install_path = '${PREFIX}/share/rtems')
    6466    bld(features = 'py',
    6567        source = ['rt/pygdb/__init__.py',
    6668                  'rt/pygdb/mi_parser.py',
    6769                  'rt/pygdb/spark.py'],
    68         install_path = '${PREFIX}/share/rtems/tester')
     70        install_path = '${PREFIX}/share/rtems')
    6971    bld.install_files('${PREFIX}/bin', ['rtems-test'], chmod = 0o755)
    7072
  • wscript

    rc9fa179 refc4f09  
    11#
    22# RTEMS Tools Project (http://www.rtems.org/)
    3 # Copyright 2014, 2015 Chris Johns (chrisj@rtems.org)
     3# Copyright 2014-2015 Chris Johns (chrisj@rtems.org)
    44# All rights reserved.
    55#
     
    2929#
    3030
     31import os.path
     32
    3133subdirs = ['rtemstoolkit',
    3234           'linkers',
    3335           'tester',
    3436           'tools/gdb/python']
     37
     38def get_version(ctx):
     39    release = '4.12.not_released'
     40    if os.path.exists('VERSION'):
     41        try:
     42            with open('VERSION') as v:
     43                release = v.readline().strip()
     44            v.close()
     45        except:
     46            ctx.fatal('cannot access the VERSION file')
     47    last_dot = release.rfind('.')
     48    if last_dot == -1:
     49        ctx.fatal('invalid VERSION file')
     50    revision = release[0:last_dot]
     51    return revision, release
    3552
    3653def recurse(ctx):
     
    3956
    4057def options(ctx):
    41     ctx.add_option('--rtems-version',
    42                    default = '4.11',
    43                    dest='rtems_version',
    44                    help = 'Set the RTEMS version')
    4558    ctx.add_option('--c-opts',
    4659                   default = '-O2',
     
    7083    except:
    7184        pass
     85    ctx.env.RTEMS_VERSION, ctx.env.RTEMS_RELEASE = get_version(ctx)
    7286    ctx.env.C_OPTS = ctx.options.c_opts.split(',')
    73     ctx.env.RTEMS_VERSION = ctx.options.rtems_version
    7487    check_options(ctx, ctx.options.host)
    7588    recurse(ctx)
    7689
    7790def build(ctx):
     91    if os.path.exists('VERSION'):
     92        ctx.install_files('${PREFIX}/share/rtems/rtemstoolkit', ['VERSION'])
    7893    recurse(ctx)
    7994
Note: See TracChangeset for help on using the changeset viewer.