diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2017-06-09 21:34:28 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-12 23:01:22 +0100 |
commit | 2dcd72fd873dfcd0e4dcf789d9b194b73b91049c (patch) | |
tree | e82281b230edd10fb12afa661e50969b0f620b27 /meta/classes/toaster.bbclass | |
parent | a19d31da4b5e1965cde6d04448e89b0d0e4b35ea (diff) | |
download | poky-2dcd72fd873dfcd0e4dcf789d9b194b73b91049c.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.
(From OE-Core rev: 49a321d03e527ad15c3a7fcb9d94980577535ca3)
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.bbclass | 28 |
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() { | |||
270 | images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []} | 270 | images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []} |
271 | 271 | ||
272 | with open("%s/depends.dot" % installed_img_path, "r") as fin: | 272 | with open("%s/depends.dot" % installed_img_path, "r") as fin: |
273 | p = re.compile(r' -> ') | 273 | p = re.compile(r'\s*"(?P<name>[^"]+)"\s*->\s*"(?P<dep>[^"]+)"(?P<rec>.*?\[style=dotted\])?') |
274 | dot = re.compile(r'.*style=dotted') | ||
275 | for line in fin: | 274 | for line in fin: |
276 | line = line.rstrip(';') | 275 | m = p.match(line) |
277 | linesplit = p.split(line) | 276 | if not m: |
278 | if len(linesplit) == 2: | 277 | continue |
279 | pname = linesplit[0].rstrip('"').strip('"') | 278 | pname = m.group('name') |
280 | dependsname = linesplit[1].split(" ")[0].strip().strip(";").strip('"').rstrip('"') | 279 | dependsname = m.group('dep') |
281 | deptype = "depends" | 280 | deptype = 'recommends' if m.group('rec') else 'depends' |
282 | if dot.match(line): | 281 | |
283 | deptype = "recommends" | 282 | if not pname in images[target]: |
284 | if not pname in images[target]: | 283 | images[target][pname] = {'size': 0, 'depends' : []} |
285 | images[target][pname] = {'size': 0, 'depends' : []} | 284 | if not dependsname in images[target]: |
286 | if not dependsname in images[target]: | 285 | images[target][dependsname] = {'size': 0, 'depends' : []} |
287 | images[target][dependsname] = {'size': 0, 'depends' : []} | 286 | images[target][pname]['depends'].append((dependsname, deptype)) |
288 | images[target][pname]['depends'].append((dependsname, deptype)) | ||
289 | 287 | ||
290 | # files-in-image.txt is only generated if an image file is created, | 288 | # files-in-image.txt is only generated if an image file is created, |
291 | # so the file entries ('syms', 'dirs', 'files') for a target will be | 289 | # so the file entries ('syms', 'dirs', 'files') for a target will be |