mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-19 10:42:13 +08:00
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.
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
#
|
||||
# RTEMS Tools Project (http://www.rtems.org/)
|
||||
# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
|
||||
# Copyright 2010-2015 Chris Johns (chrisj@rtems.org)
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
@@ -61,14 +58,17 @@ class repo:
|
||||
self._git_exit_code(exit_code)
|
||||
return exit_code, output
|
||||
|
||||
def __init__(self, _path, opts, macros = None):
|
||||
def __init__(self, _path, opts = None, macros = None):
|
||||
self.path = _path
|
||||
self.opts = opts
|
||||
if macros is None:
|
||||
if macros is None and opts is not None:
|
||||
self.macros = opts.defaults
|
||||
else:
|
||||
self.macros = macros
|
||||
self.git = self.macros.expand('%{__git}')
|
||||
if self.macros is None:
|
||||
self.git = 'git'
|
||||
else:
|
||||
self.git = self.macros.expand('%{__git}')
|
||||
|
||||
def git_version(self):
|
||||
ec, output = self._run(['--version'], True)
|
||||
@@ -86,6 +86,9 @@ class repo:
|
||||
def fetch(self):
|
||||
ec, output = self._run(['fetch'], check = True)
|
||||
|
||||
def merge(self):
|
||||
ec, output = self._run(['merge'], check = True)
|
||||
|
||||
def pull(self):
|
||||
ec, output = self._run(['pull'], check = True)
|
||||
|
||||
@@ -105,6 +108,14 @@ class repo:
|
||||
def checkout(self, branch = 'master'):
|
||||
ec, output = self._run(['checkout', branch], check = True)
|
||||
|
||||
def submodule(self, module):
|
||||
ec, output = self._run(['submodule', 'update', '--init', module], check = True)
|
||||
|
||||
def clean(self, args = []):
|
||||
if type(args) == str:
|
||||
args = [args]
|
||||
ec, output = self._run(['clean'] + args, check = True)
|
||||
|
||||
def status(self):
|
||||
_status = {}
|
||||
if path.exists(self.path):
|
||||
@@ -112,27 +123,33 @@ class repo:
|
||||
if ec == 0:
|
||||
state = 'none'
|
||||
for l in output.split('\n'):
|
||||
if l.startswith('# On branch '):
|
||||
_status['branch'] = l[len('# On branch '):]
|
||||
elif l.startswith('# Changes to be committed:'):
|
||||
if l.startswith('# '):
|
||||
l = l[2:]
|
||||
if l.startswith('On branch '):
|
||||
_status['branch'] = l[len('On branch '):]
|
||||
elif l.startswith('Changes to be committed:'):
|
||||
state = 'staged'
|
||||
elif l.startswith('# Changes not staged for commit:'):
|
||||
elif l.startswith('Changes not staged for commit:'):
|
||||
state = 'unstaged'
|
||||
elif l.startswith('# Untracked files:'):
|
||||
elif l.startswith('Untracked files:'):
|
||||
state = 'untracked'
|
||||
elif state != 'none' and l[0] == '#':
|
||||
if l.strip() != '#' and not l.startswith('# ('):
|
||||
if state not in _status:
|
||||
_status[state] = []
|
||||
l = l[1:]
|
||||
if ':' in l:
|
||||
l = l.split(':')[1]
|
||||
_status[state] += [l.strip()]
|
||||
elif l.startswith('HEAD detached'):
|
||||
state = 'detached'
|
||||
elif state != 'none' and len(l.strip()) != 0:
|
||||
if l[0].isspace():
|
||||
l = l.strip()
|
||||
if l[0] != '(':
|
||||
if state not in _status:
|
||||
_status[state] = []
|
||||
l = l[1:]
|
||||
if ':' in l:
|
||||
l = l.split(':')[1]
|
||||
_status[state] += [l.strip()]
|
||||
return _status
|
||||
|
||||
def clean(self):
|
||||
def dirty(self):
|
||||
_status = self.status()
|
||||
return len(_status) == 1 and 'branch' in _status
|
||||
return not (len(_status) == 1 and 'branch' in _status)
|
||||
|
||||
def valid(self):
|
||||
if path.exists(self.path):
|
||||
|
Reference in New Issue
Block a user