mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Trace relative paths for nesting configs.
This commit is contained in:
parent
6c4aeaec51
commit
62cb64747f
@ -285,8 +285,16 @@ class file:
|
|||||||
s += str(self._packages[_package])
|
s += str(self._packages[_package])
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
def _relative_path(self, p):
|
||||||
|
sbdir = None
|
||||||
|
if '_sbdir' in self.macros:
|
||||||
|
sbdir = path.dirname(self.expand('%{_sbdir}'))
|
||||||
|
if p.startswith(sbdir):
|
||||||
|
p = p[len(sbdir) + 1:]
|
||||||
|
return p
|
||||||
|
|
||||||
def _name_line_msg(self, msg):
|
def _name_line_msg(self, msg):
|
||||||
return '%s:%d: %s' % (path.basename(self.init_name), self.lc, msg)
|
return '%s:%d: %s' % (path.basename(self.name), self.lc, msg)
|
||||||
|
|
||||||
def _output(self, text):
|
def _output(self, text):
|
||||||
if not self.opts.quiet():
|
if not self.opts.quiet():
|
||||||
@ -648,7 +656,7 @@ class file:
|
|||||||
else:
|
else:
|
||||||
if ls[1] == 'select':
|
if ls[1] == 'select':
|
||||||
self.macros.lock_read_map()
|
self.macros.lock_read_map()
|
||||||
log.trace('config: %s: _disable_select: %s' % (self.init_name, ls[1]))
|
log.trace('config: %s: _disable_select: %s' % (self.name, ls[1]))
|
||||||
else:
|
else:
|
||||||
log.warning('invalid disable statement: %s' % (ls[1]))
|
log.warning('invalid disable statement: %s' % (ls[1]))
|
||||||
|
|
||||||
@ -658,7 +666,7 @@ class file:
|
|||||||
else:
|
else:
|
||||||
r = self.macros.set_read_map(ls[1])
|
r = self.macros.set_read_map(ls[1])
|
||||||
log.trace('config: %s: _select: %s %s %r' % \
|
log.trace('config: %s: _select: %s %s %r' % \
|
||||||
(self.init_name, r, ls[1], self.macros.maps()))
|
(self.name, r, ls[1], self.macros.maps()))
|
||||||
|
|
||||||
def _sources(self, ls):
|
def _sources(self, ls):
|
||||||
return sources.process(ls[0][1:], ls[1:], self.macros, self._error)
|
return sources.process(ls[0][1:], ls[1:], self.macros, self._error)
|
||||||
@ -711,7 +719,7 @@ class file:
|
|||||||
self._error(label + ' without %endif')
|
self._error(label + ' without %endif')
|
||||||
raise error.general('terminating build')
|
raise error.general('terminating build')
|
||||||
if r[1] == '%endif':
|
if r[1] == '%endif':
|
||||||
log.trace('config: %s: _ifs: %s %s' % (self.init_name, r[1], this_isvalid))
|
log.trace('config: %s: _ifs: %s %s' % (self.name, r[1], this_isvalid))
|
||||||
return data
|
return data
|
||||||
if r[1] == '%else':
|
if r[1] == '%else':
|
||||||
in_iftrue = False
|
in_iftrue = False
|
||||||
@ -810,7 +818,7 @@ class file:
|
|||||||
self._error('malformed if: ' + reduce(add, ls, ''))
|
self._error('malformed if: ' + reduce(add, ls, ''))
|
||||||
if invert:
|
if invert:
|
||||||
istrue = not istrue
|
istrue = not istrue
|
||||||
log.trace('config: %s: _if: %s %s' % (self.init_name, ifls, str(istrue)))
|
log.trace('config: %s: _if: %s %s' % (self.name, ifls, str(istrue)))
|
||||||
return self._ifs(config, ls, '%if', istrue, isvalid, dir, info)
|
return self._ifs(config, ls, '%if', istrue, isvalid, dir, info)
|
||||||
|
|
||||||
def _ifos(self, config, ls, isvalid, dir, info):
|
def _ifos(self, config, ls, isvalid, dir, info):
|
||||||
@ -857,7 +865,7 @@ class file:
|
|||||||
if len(l) == 0:
|
if len(l) == 0:
|
||||||
continue
|
continue
|
||||||
log.trace('config: %s: %03d: %s %s' % \
|
log.trace('config: %s: %03d: %s %s' % \
|
||||||
(self.init_name, self.lc, str(isvalid), l))
|
(self.name, self.lc, str(isvalid), l))
|
||||||
lo = l
|
lo = l
|
||||||
if isvalid:
|
if isvalid:
|
||||||
l = self._expand(l)
|
l = self._expand(l)
|
||||||
@ -902,12 +910,12 @@ class file:
|
|||||||
elif ls[0] == '%if':
|
elif ls[0] == '%if':
|
||||||
d = self._if(config, ls, isvalid, dir, info)
|
d = self._if(config, ls, isvalid, dir, info)
|
||||||
if len(d):
|
if len(d):
|
||||||
log.trace('config: %s: %%if: %s' % (self.init_name, d))
|
log.trace('config: %s: %%if: %s' % (self.name, d))
|
||||||
return ('data', d)
|
return ('data', d)
|
||||||
elif ls[0] == '%ifn':
|
elif ls[0] == '%ifn':
|
||||||
d = self._if(config, ls, isvalid, dir, info, True)
|
d = self._if(config, ls, isvalid, dir, info, True)
|
||||||
if len(d):
|
if len(d):
|
||||||
log.trace('config: %s: %%ifn: %s' % (self.init_name, d))
|
log.trace('config: %s: %%ifn: %s' % (self.name, d))
|
||||||
return ('data', d)
|
return ('data', d)
|
||||||
elif ls[0] == '%ifos':
|
elif ls[0] == '%ifos':
|
||||||
d = self._ifos(config, ls, isvalid, dir, info)
|
d = self._ifos(config, ls, isvalid, dir, info)
|
||||||
@ -994,7 +1002,7 @@ class file:
|
|||||||
if not directive:
|
if not directive:
|
||||||
l = self._expand(l)
|
l = self._expand(l)
|
||||||
ls = self.tags.split(l, 1)
|
ls = self.tags.split(l, 1)
|
||||||
log.trace('config: %s: _tag: %s %s' % (self.init_name, l, ls))
|
log.trace('config: %s: _tag: %s %s' % (self.name, l, ls))
|
||||||
if len(ls) > 1:
|
if len(ls) > 1:
|
||||||
info = ls[0].lower()
|
info = ls[0].lower()
|
||||||
if info[-1] == ':':
|
if info[-1] == ':':
|
||||||
@ -1007,7 +1015,7 @@ class file:
|
|||||||
else:
|
else:
|
||||||
log.warning("invalid format: '%s'" % (info_data[:-1]))
|
log.warning("invalid format: '%s'" % (info_data[:-1]))
|
||||||
else:
|
else:
|
||||||
log.trace('config: %s: _data: %s %s' % (self.init_name, l, new_data))
|
log.trace('config: %s: _data: %s %s' % (self.name, l, new_data))
|
||||||
new_data.append(l)
|
new_data.append(l)
|
||||||
return (directive, info, data + new_data)
|
return (directive, info, data + new_data)
|
||||||
|
|
||||||
@ -1056,9 +1064,6 @@ class file:
|
|||||||
save_name = self.name
|
save_name = self.name
|
||||||
save_lc = self.lc
|
save_lc = self.lc
|
||||||
|
|
||||||
self.name = name
|
|
||||||
self.lc = 0
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Locate the config file. Expand any macros then add the
|
# Locate the config file. Expand any macros then add the
|
||||||
# extension. Check if the file exists, therefore directly
|
# extension. Check if the file exists, therefore directly
|
||||||
@ -1097,14 +1102,17 @@ class file:
|
|||||||
raise error.general('no config file found: %s' % (cfgname))
|
raise error.general('no config file found: %s' % (cfgname))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log.trace('config: %s: _open: %s' % (self.init_name, path.host(configname)))
|
log.trace('config: %s: _open: %s' % (self.name, path.host(configname)))
|
||||||
config = open(path.host(configname), 'r')
|
config = open(path.host(configname), 'r')
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
raise error.general('error opening config file: %s' % (path.host(configname)))
|
raise error.general('error opening config file: %s' % (path.host(configname)))
|
||||||
self.configpath += [configname]
|
|
||||||
|
|
||||||
|
self.configpath += [configname]
|
||||||
self._includes += [configname]
|
self._includes += [configname]
|
||||||
|
|
||||||
|
self.name = self._relative_path(configname)
|
||||||
|
self.lc = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dir = None
|
dir = None
|
||||||
info = None
|
info = None
|
||||||
@ -1187,7 +1195,7 @@ class file:
|
|||||||
return self._includes
|
return self._includes
|
||||||
|
|
||||||
def file_name(self):
|
def file_name(self):
|
||||||
return self.init_name
|
return self.name
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
import sys
|
import sys
|
||||||
|
Loading…
x
Reference in New Issue
Block a user