mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
More info helpers, allow info to append and fix %{?} expansion.
Add URL and summary to the info helpers. Fix the package get_info and allow infos to be appended to. This lets a summary be on more than one line. Fix the %{?} expansion logic so %{?macro} expands to the macro if it exists.
This commit is contained in:
parent
54d76bb037
commit
3b0ce4e0fa
@ -92,12 +92,9 @@ class package:
|
|||||||
self.infos[info].append(data)
|
self.infos[info].append(data)
|
||||||
|
|
||||||
def get_info(self, info):
|
def get_info(self, info):
|
||||||
if not info in self.infos:
|
if info in self.infos:
|
||||||
raise error.general('no %s in package "%s"' % (info, self.name))
|
return self.infos[info]
|
||||||
return self.info
|
return None
|
||||||
|
|
||||||
def version(self):
|
|
||||||
return self.get_info('Version')
|
|
||||||
|
|
||||||
def extract_info(self, label):
|
def extract_info(self, label):
|
||||||
infos = {}
|
infos = {}
|
||||||
@ -129,6 +126,18 @@ class package:
|
|||||||
return info[0]
|
return info[0]
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
def summary(self):
|
||||||
|
info = self.find_info('summary')
|
||||||
|
if info:
|
||||||
|
return info[0]
|
||||||
|
return ''
|
||||||
|
|
||||||
|
def url(self):
|
||||||
|
info = self.find_info('url')
|
||||||
|
if info:
|
||||||
|
return info[0]
|
||||||
|
return ''
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
info = self.find_info('version')
|
info = self.find_info('version')
|
||||||
if not info:
|
if not info:
|
||||||
@ -395,7 +404,7 @@ class file:
|
|||||||
s = s.replace(m, m[start + colon + 1:-1])
|
s = s.replace(m, m[start + colon + 1:-1])
|
||||||
expanded = True
|
expanded = True
|
||||||
mn = None
|
mn = None
|
||||||
else:
|
elif not istrue:
|
||||||
mn = '%{nil}'
|
mn = '%{nil}'
|
||||||
else:
|
else:
|
||||||
isfalse = True
|
isfalse = True
|
||||||
@ -589,7 +598,6 @@ class file:
|
|||||||
# they match. This closes an opening '{' that is on another
|
# they match. This closes an opening '{' that is on another
|
||||||
# line.
|
# line.
|
||||||
#
|
#
|
||||||
|
|
||||||
for l in config:
|
for l in config:
|
||||||
self.lc += 1
|
self.lc += 1
|
||||||
l = _clean(l)
|
l = _clean(l)
|
||||||
@ -772,6 +780,7 @@ class file:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
dir = None
|
dir = None
|
||||||
|
info = None
|
||||||
data = []
|
data = []
|
||||||
while True:
|
while True:
|
||||||
r = self._parse(config)
|
r = self._parse(config)
|
||||||
@ -816,16 +825,19 @@ class file:
|
|||||||
if self.opts.trace():
|
if self.opts.trace():
|
||||||
print '_tag: ', l, ls
|
print '_tag: ', l, ls
|
||||||
if len(ls) > 1:
|
if len(ls) > 1:
|
||||||
i = ls[0]
|
info = ls[0].lower()
|
||||||
self._info_append(i, ls[1].strip())
|
if info[-1] == ':':
|
||||||
|
info = info[:-1]
|
||||||
|
info_data = ls[1].strip()
|
||||||
|
else:
|
||||||
|
info_data = ls[0].strip()
|
||||||
|
if info is not None:
|
||||||
|
self._info_append(info, info_data)
|
||||||
# It seems like the info's also appear as
|
# It seems like the info's also appear as
|
||||||
# defines or can be accessed via macros.
|
# defines or can be accessed via macros.
|
||||||
if ls[0][len(ls[0]) - 1] == ':':
|
self._define(None, ('', info, info_data))
|
||||||
ls[0] = ls[0][:-1]
|
|
||||||
ls[0] = ls[0].lower()
|
|
||||||
self._define(None, ('', ls[0], ls[1]))
|
|
||||||
else:
|
else:
|
||||||
self._warning("invalid format: '" + l[:-1] + "'")
|
self._warning("invalid format: '" + info_data[:-1] + "'")
|
||||||
else:
|
else:
|
||||||
data.append(l)
|
data.append(l)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user