summaryrefslogtreecommitdiffstats
path: root/meta/classes/toaster.bbclass
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2017-06-09 21:34:28 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-12 15:17:50 +0100
commit49a321d03e527ad15c3a7fcb9d94980577535ca3 (patch)
tree7cdeff351a6a39cfff35a0593652d7b87e8466d1 /meta/classes/toaster.bbclass
parent37ea2c8b299483f0e12fad66efa789c6445571e0 (diff)
downloadopenembedded-core-49a321d03e527ad15c3a7fcb9d94980577535ca3.tar.gz
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. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/toaster.bbclass')
-rw-r--r--meta/classes/toaster.bbclass28
1 files changed, 13 insertions, 15 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 296e4764f0..fbf463bbb7 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -270,22 +270,20 @@ python toaster_buildhistory_dump() {
images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []}
with open("%s/depends.dot" % installed_img_path, "r") as fin:
- p = re.compile(r' -> ')
- dot = re.compile(r'.*style=dotted')
+ p = re.compile(r'\s*"(?P<name>[^"]+)"\s*->\s*"(?P<dep>[^"]+)"(?P<rec>.*?\[style=dotted\])?')
for line in fin:
- line = line.rstrip(';')
- linesplit = p.split(line)
- if len(linesplit) == 2:
- pname = linesplit[0].rstrip('"').strip('"')
- dependsname = linesplit[1].split(" ")[0].strip().strip(";").strip('"').rstrip('"')
- deptype = "depends"
- if dot.match(line):
- deptype = "recommends"
- if not pname in images[target]:
- images[target][pname] = {'size': 0, 'depends' : []}
- if not dependsname in images[target]:
- images[target][dependsname] = {'size': 0, 'depends' : []}
- images[target][pname]['depends'].append((dependsname, deptype))
+ m = p.match(line)
+ if not m:
+ continue
+ pname = m.group('name')
+ dependsname = m.group('dep')
+ deptype = 'recommends' if m.group('rec') else 'depends'
+
+ if not pname in images[target]:
+ images[target][pname] = {'size': 0, 'depends' : []}
+ if not dependsname in images[target]:
+ images[target][dependsname] = {'size': 0, 'depends' : []}
+ images[target][pname]['depends'].append((dependsname, deptype))
# files-in-image.txt is only generated if an image file is created,
# so the file entries ('syms', 'dirs', 'files') for a target will be