Changeset efc4f09 in rtems-tools for rtemstoolkit
- Timestamp:
- 12/09/15 09:08:19 (8 years ago)
- Branches:
- 4.10, 5, master
- Children:
- 8b49f73
- Parents:
- c9fa179
- Location:
- rtemstoolkit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
rtemstoolkit/git.py
rc9fa179 refc4f09 1 1 # 2 2 # RTEMS Tools Project (http://www.rtems.org/) 3 # Copyright 2010-201 4Chris Johns (chrisj@rtems.org)3 # Copyright 2010-2015 Chris Johns (chrisj@rtems.org) 4 4 # All rights reserved. 5 5 # 6 6 # This file is part of the RTEMS Tools package in 'rtems-tools'. 7 #8 # Redistribution and use in source and binary forms, with or without9 # modification, are permitted provided that the following conditions are met:10 7 # 11 8 # 1. Redistributions of source code must retain the above copyright notice, … … 62 59 return exit_code, output 63 60 64 def __init__(self, _path, opts , macros = None):61 def __init__(self, _path, opts = None, macros = None): 65 62 self.path = _path 66 63 self.opts = opts 67 if macros is None :64 if macros is None and opts is not None: 68 65 self.macros = opts.defaults 69 66 else: 70 67 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}') 72 72 73 73 def git_version(self): … … 87 87 ec, output = self._run(['fetch'], check = True) 88 88 89 def merge(self): 90 ec, output = self._run(['merge'], check = True) 91 89 92 def pull(self): 90 93 ec, output = self._run(['pull'], check = True) … … 105 108 def checkout(self, branch = 'master'): 106 109 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) 107 118 108 119 def status(self): … … 113 124 state = 'none' 114 125 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:'): 118 131 state = 'staged' 119 elif l.startswith(' #Changes not staged for commit:'):132 elif l.startswith('Changes not staged for commit:'): 120 133 state = 'unstaged' 121 elif l.startswith(' #Untracked files:'):134 elif l.startswith('Untracked files:'): 122 135 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()] 131 148 return _status 132 149 133 def clean(self):150 def dirty(self): 134 151 _status = self.status() 135 return len(_status) == 1 and 'branch' in _status152 return not (len(_status) == 1 and 'branch' in _status) 136 153 137 154 def valid(self): -
rtemstoolkit/options.py
rc9fa179 refc4f09 354 354 repo_valid = '1' 355 355 repo_head = repo.head() 356 repo_clean = repo.clean()356 repo_clean = not repo.dirty() 357 357 repo_id = repo_head 358 358 if not repo_clean: -
rtemstoolkit/rld-rtems.cpp
rc9fa179 refc4f09 25 25 namespace rtems 26 26 { 27 static std::string _version = "4.12";27 static std::string _version = RTEMS_VERSION; 28 28 static std::string _path; 29 29 static std::string _arch_bsp; -
rtemstoolkit/rld.cpp
rc9fa179 refc4f09 33 33 #include <rld.h> 34 34 35 #define RLD_VERSION_MAJOR (1)36 #define RLD_VERSION_MINOR (0)37 #define RLD_VERSION_RELEASE (0)38 39 35 namespace rld 40 36 { … … 203 199 version () 204 200 { 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; 209 202 } 210 203 … … 212 205 rtems_version () 213 206 { 214 return rld::to_string (RTEMS_VERSION);207 return RTEMS_VERSION; 215 208 } 216 209 -
rtemstoolkit/version.py
rc9fa179 refc4f09 1 1 # 2 2 # RTEMS Tools Project (http://www.rtems.org/) 3 # Copyright 2010-201 4Chris Johns (chrisj@rtems.org)3 # Copyright 2010-2015 Chris Johns (chrisj@rtems.org) 4 4 # All rights reserved. 5 5 # … … 30 30 31 31 # 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. 35 34 # 36 35 37 major = 0 38 minor = 0 39 revision = 0 36 import sys 37 38 import error 39 import git 40 import path 41 42 # 43 # Default to an internal string. 44 # 45 _version_str = '4.12.not_release' 46 _released = False 47 _git = False 48 49 def _at(): 50 return path.dirname(__file__) 51 52 def _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 67 def _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 81 def released(): 82 return _load_released_version() 83 84 def version_control(): 85 return _load_git_version() 40 86 41 87 def 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 43 92 44 93 if __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 34 34 import sys 35 35 36 version_major = 137 version_minor = 038 version_revision = 039 40 36 # 41 37 # Waf system setup. Allow more than one build in the same tree. … … 60 56 features = 'c', mandatory = False) 61 57 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 62 63 63 64 def build(bld): … … 126 127 source = rld_source + rtems_utils + compression, 127 128 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), 129 131 'FASTLZ_LEVEL=1'], 130 132 includes = ['.'] + conf['includes'], … … 154 156 'version.py', 155 157 'windows.py'], 156 install_path = '${PREFIX}/share/rtems /rtemstoolkit')158 install_path = '${PREFIX}/share/rtems') 157 159 158 160 def rebuild(ctx):
Note: See TracChangeset
for help on using the changeset viewer.