toaster.bbclass: Simplify parsing of depends.dot
By using a single regular expression, the parsing of the depends.dot file can be simplified a lot. This should also make it less susceptible to formatting changes in that file. (From OE-Core rev: 20684149bb659b34d3bcac8f202cb95d607567c1) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
e56ff20931
commit
986de4b7f0
|
@ -270,17 +270,15 @@ python toaster_buildhistory_dump() {
|
||||||
images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []}
|
images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []}
|
||||||
|
|
||||||
with open("%s/depends.dot" % installed_img_path, "r") as fin:
|
with open("%s/depends.dot" % installed_img_path, "r") as fin:
|
||||||
p = re.compile(r' -> ')
|
p = re.compile(r'\s*"(?P<name>[^"]+)"\s*->\s*"(?P<dep>[^"]+)"(?P<rec>.*?\[style=dotted\])?')
|
||||||
dot = re.compile(r'.*style=dotted')
|
|
||||||
for line in fin:
|
for line in fin:
|
||||||
line = line.rstrip(';')
|
m = p.match(line)
|
||||||
linesplit = p.split(line)
|
if not m:
|
||||||
if len(linesplit) == 2:
|
continue
|
||||||
pname = linesplit[0].rstrip('"').strip('"')
|
pname = m.group('name')
|
||||||
dependsname = linesplit[1].split(" ")[0].strip().strip(";").strip('"').rstrip('"')
|
dependsname = m.group('dep')
|
||||||
deptype = "depends"
|
deptype = 'recommends' if m.group('rec') else 'depends'
|
||||||
if dot.match(line):
|
|
||||||
deptype = "recommends"
|
|
||||||
if not pname in images[target]:
|
if not pname in images[target]:
|
||||||
images[target][pname] = {'size': 0, 'depends' : []}
|
images[target][pname] = {'size': 0, 'depends' : []}
|
||||||
if not dependsname in images[target]:
|
if not dependsname in images[target]:
|
||||||
|
|
Loading…
Reference in New Issue