Changeset efc4f09 in rtems-tools for rtemstoolkit


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.

Location:
rtemstoolkit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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):
Note: See TracChangeset for help on using the changeset viewer.